Skip to content

Instantly share code, notes, and snippets.

@randomcamel
Created April 15, 2022 16:58
Show Gist options
  • Save randomcamel/9f33db13a5dc13a661829493209ffb67 to your computer and use it in GitHub Desktop.
Save randomcamel/9f33db13a5dc13a661829493209ffb67 to your computer and use it in GitHub Desktop.
A shell function to wrap a Perl invocation to tell you what day of March 2020 it is.
# I didn't write this, but it's too good not to share.
# See also: https://www.mcsweeneys.net/articles/heres-how-time-works-now.
march () {
perl -e 'use Date::Parse; use POSIX; my @t = localtime; print strftime ("%a Mar ", @t) . int (1 + 0.5 + ((str2time (strftime ("%Y-%m-%d 3:00", @t)) - str2time ("2020-03-01 3:00")) /(60*60*24))) . strftime (" %X %Z 2020\n", @t);'
}
@randomcamel
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment