Days of productive life remaining. Demo
Download, chmod +x stat-mori.fish
and put it in your PATH
fish
is required to run this script, but doesn't have to be your SHELL
to do it.
#!/usr/bin/env fish | |
# lifetimer 3000 weeks where 1/2 is at 32 years of age, starts at ~3¼ y.o. | |
# i.e: Day 8375/10,500 · 1196/1,500 weeks · 275/345 more months · (since 2016 1/31) | |
# v0.3 gist.github.com/godDLL/b198f3311086491a5778035162653cd5 | |
# | |
set -q YOB ; or set -l YOB 1984 | |
set -q DOB ; or set -l DOB 01/23 | |
set -l NOW (string split -- ' ' (date +%Y\ %j)) | |
set -l tDOB (string split -- '/' $DOB) | |
set -- tDOB (math -s0 $tDOB[1]'* 30.4375 - 30.4375 + '$tDOB[2]) | |
set -l tDTL 10,500 | |
set -l tWKS 1,500 | |
set -l tMOS 345 | |
set -l BY (math -s0 $YOB' + 32') | |
if test $BY -ge $NOW[1] | |
set BY (math -s0 $YOB' + 17') | |
if test $BY -ge $NOW[1] | |
set tDOB (math -s0 $tDOB'+ 92.25') | |
set BY (math -s0 $YOB' + 3') | |
set tDTL 21,000 | |
set tWKS 3,000 | |
set tMOS 690 | |
else | |
set tDOB (math -s0 $tDOB'+ 228.75') | |
set tDTL 15,750 | |
set tWKS 2,250 | |
set tMOS 517½ | |
end | |
else | |
end | |
set -l DTL (math -s0 (string replace -- , '' $tDTL)\ | |
'- (('$NOW[2]'- '$tDOB')+ 365.25* ('(math $NOW[1]'- '$BY)"))") | |
set -l WKS (math -s0 "$DTL /7") | |
set -l MOS (math -s0 "$DTL /30.4375") | |
switch "$argv" | |
case '-x' | |
echo $DTL $WKS $MOS | |
case '-p' | |
set -l POH (math -s2 '100/ ('(string replace -- , '' $tDTL)' /'$DTL')') | |
echo -e \e\[2mDay \e\[m$DTL\e\[2m/$tDTL · \e\[m$WKS\e\[2m/$tWKS weeks · \e\[m$POH\e\[2m% left · \(since $BY $DOB\)\e\[m | |
case '' | |
echo -e \e\[2mDay \e\[m$DTL\e\[2m/$tDTL · \e\[m$WKS\e\[2m/$tWKS weeks · \e\[m$MOS\e\[2m/$tMOS more months · \(since $BY $DOB\)\e\[m | |
case '*' | |
echo 'USAGE: stat-mori [-x]'\n'Print a memento mori. Please set YOB and DOB.'\n\t'-p for PERCENTAGE in place of MONTHS, or'\n\t'-x for export: DAYS WEEKS MONTHS' >&2 | |
end #switch | |
License MIT, free to do whatever. Yours to fuck up.
asciinema.org/a/450958