URI: 
       Add script to get 70th day - day-70 - Files related to Day 70, official gopher holy-day
   DIR Log
   DIR Files
   DIR Refs
       ---
   DIR commit 13cb13c7acf484cc3272ee7d8ad7c3db1f14b9ef
  HTML Author: Scarlett McAllister <git@roygbyte.com>
       Date:   Sun, 25 Jun 2023 20:23:17 -0300
       
       Add script to get 70th day
       
       Diffstat:
         A day-70.sh                           |      45 +++++++++++++++++++++++++++++++
       
       1 file changed, 45 insertions(+), 0 deletions(-)
       ---
   DIR diff --git a/day-70.sh b/day-70.sh
       @@ -0,0 +1,45 @@
       +#!/bin/sh
       +
       +# day-70.sh
       +#
       +# Find the 70th day of a given year
       +#
       +# Author: ROYGBYTE
       +# Date: 2023
       +
       +leap_year() {
       +        year=${1}
       +        rule_1=$((year%4))
       +        if [ ! $rule_1 -eq 0 ]; then
       +                # Not divisable by 4, no leap.
       +                return 1
       +        fi
       +        rule_2=$((year%100))
       +        rule_3=$((year%400))
       +        if [ $rule_2 -eq 0 ]; then
       +                # Divisable by 100, maybe leap.
       +                if [ ! $rule_3 -eq 0 ]; then
       +                        # Not divisable by 400, no leap.
       +                        return 1
       +                fi
       +        fi
       +        return 0
       +}
       +
       +# 70th day of year fluctuates depending on whether it's leap year or no.
       +nth_day_march=11
       +leap_year ${1}
       +if [ $? -eq 0 ]; then
       +        nth_day_march=10
       +fi
       +
       +# Sanity check: day num should be 70, duh.
       +date_string="${1}-03-${nth_day_march}"
       +day_num=$(date --date="${date_string}" +%j)
       +if [ ! $day_num -eq 70 ]; then
       +        printf "Something went wrong\n"
       +        exit 1
       +fi
       +
       +# Pretty print the date information
       +date --date="${date_string}"