gwern comments on Open Thread, August 2010 - Less Wrong

4 Post author: NancyLebovitz 01 August 2010 01:27PM

You are viewing a comment permalink. View the original post to see all comments and the full post content.

Comments (676)

Sort By: Leading

You are viewing a single comment's thread.

Comment author: gwern 05 August 2010 10:08:51AM *  4 points [-]

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.)

Comment author: gwern 14 August 2010 04:17:49PM *  1 point [-]

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
Comment author: Risto_Saarelma 05 August 2010 10:23:02AM 1 point [-]

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.

Comment author: gwern 10 October 2010 11:17:58PM *  0 points [-]

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"
Comment author: h-H 07 August 2010 07:14:09AM *  0 points [-]

It might have an opposite effect to what is intended since the number would simply be too large.

Comment author: gwern 05 August 2010 10:29:55AM 0 points [-]

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.