This little script helps with Remind Calendars ---- #!/bin/bash # This script creates a file called SolarDataReminders that contains precise times and dates # for Perihelion, Equinox, Solstice, and Aphelion. It can be added to your ~/.reminders # file, or included in a other ways. # The list of sun positions below is from the Astronomical Applications # Department of the U.S. Naval Observatory # Widely speaking, it connects to their website over and over again, replacing ${Year} with # each of a sequence of years between 2022 and 2100. # The grep below then looks for the partial words helion quinox and olstice, but removes the # line that also says 'Earth's Seasons' # The sed script converts multiple spaces to singles, and removes leading and trailing space # The result gets sent to a temporary file. # Then, read in from that file, one line at a time, breaking the words of each line to get # what Event, and the Year, Date, and Time, then convert the time from 6:10 to 6,10. # Write the results out to a Remind statement in the form of; # REM [trigger(date(2100,January,3), time(13,54), 1)] MSG Perihelion # to a second file, do this in a loop for a years records, then delete the temporary file # and add a blank line after the year's worth of events. # Finaly, go back for the next year in the sequence. # Love *nix! Output=SolarDataReminders File=$(mktemp) for Year in $(seq 2022 2100) do links -dump "https://aa.usno.navy.mil/calculated/seasons?year=${Year}&tz=0&tz_sign=-1&tz_label=false&dst=false&submit=Get+Data" \ | grep -E 'helion|quinox|olstice' \ | grep -v "Earth's Seasons" \ | sed -e 's/ */ /g' -e 's/^ *\(.*\) *$/\1/' \ >> ${File} while read Event Year Month Day Time do Comdelimit=$(echo ${Time} | tr ":" ",") echo "REM [trigger(date("${Year}","${Month}","${Day}"), time("${Comdelimit}"), 1)] MSG "${Event} ; done < ${File} >> ${Output} rm ${File} echo >> ${Output} done