Skip to content

Instantly share code, notes, and snippets.

@godDLL
Last active Nov 29, 2021
Embed
What would you like to do?
A simple status or greeting line with a memento mori in it.

Stat Mori Fish

Days of productive life remaining. Demo
Screen Shot 2021-11-25 at 14 38 40

Installation

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
@godDLL
Copy link
Author

godDLL commented Nov 23, 2021

License MIT, free to do whatever. Yours to fuck up.
asciinema.org/a/450958

Loading

@godDLL
Copy link
Author

godDLL commented Nov 25, 2021

v0.3 added percentage
Screen Shot 2021-11-25 at 14 32 11

If you're over 32 percentage drops 0.01% every day, except for every 21st day.

Loading

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