One little anti-akrasia thing I’m trying is editing my crontab to periodically pop up an xmessage with a memento mori phrase. It checks that my laptop lid is open, gets a random integer and occasionally pops up the # of seconds to my actuarial death (gotten from Death Clock; accurate enough, I figure):
1,16,31,46 * * * * if grep open /proc/acpi/button/lid/LID0/state; then if [ $((`date \+\%\s` % 6)) = 1 ]; then xmessage "$(((`date --date="9 August 2074" \+\%\s` - `date \+\%\s`) / 60)) minutes left to live. Is what you are doing important?"; fi; fi
(I figure it’s stupid enough a tactic and cheap enough to be worth trying. This shell stuff works in both bash and dash/sh, however, you probably want to edit the first conditional, since I’m not sure Linux puts the lid data at the same place in /proc/acpi in every system.)
OK, I can’t seem to get the escaping to work right with crontab no matter how I fiddle, so I’ve replaced the one-liner with a regular script and meaningful variables names and all:
1,14,32,26 * * * * ~/bin/bin/memento-mori
The script itself being (with the 32-bit hack mentioned below):
#!/bin/sh
set -e
if grep open /proc/acpi/button/lid/LID?/state > /dev/null
then
CURRENT=`date +%s`;
if [ $(( $CURRENT % 8 )) = 1 ]
then
# DEATH_DATE=`date --date='9 August 2074' +%s`
DEATH_DATE="3300998400"
REMAINING=$(( $DEATH_DATE - $CURRENT ))
REMAINING_MINUTES=$(( $REMAINING / 60 ))
REMAINING_MINUTES_FMT=`env printf "%'d" $REMAINING_MINUTES`
(sleep 10m && killall xmessage &)
xmessage "$REMAINING_MINUTES_FMT minutes left to live. Is what you are doing important?"
fi
fi
I had to reinstall with 32-bit to use a document scanner, so this became a problem for me. What I did was punch my 2074 date into a online converter, and use that generated date:
- DEATH_DATE=`date --date='9 August 2074' +%s`
+ # DEATH_DATE=`date --date='9 August 2074' +%s`
+ DEATH_DATE="3300998400"
But seriously, you could probably shell out to something else. Or you could change the output—it doesn’t have to be in seconds or minutes. For example, you could call date to get the current year, and subtract that against 2074 or whatever.
One little anti-akrasia thing I’m trying is editing my crontab to periodically pop up an
xmessage
with a memento mori phrase. It checks that my laptop lid is open, gets a random integer and occasionally pops up the # of seconds to my actuarial death (gotten from Death Clock; accurate enough, I figure):(I figure it’s stupid enough a tactic and cheap enough to be worth trying. This shell stuff works in both bash and dash/
sh
, however, you probably want to edit the first conditional, since I’m not sure Linux puts the lid data at the same place in /proc/acpi in every system.)OK, I can’t seem to get the escaping to work right with crontab no matter how I fiddle, so I’ve replaced the one-liner with a regular script and meaningful variables names and all:
The script itself being (with the 32-bit hack mentioned below):
Dates that far into the future don’t seem to work with the date on 32-bit Linux.
Fun idea otherwise. You should report back in a month or so if you’re still using it.
I had to reinstall with 32-bit to use a document scanner, so this became a problem for me. What I did was punch my 2074 date into a online converter, and use that generated date:
It might have an opposite effect to what is intended since the number would simply be too large.
People still use 32-bit OSs?
But seriously, you could probably shell out to something else. Or you could change the output—it doesn’t have to be in seconds or minutes. For example, you could call
date
to get the current year, and subtract that against 2074 or whatever.