Monthly Archives: May 2009

New Theme

I recently learned of the Blueprint CSS framework, and wanted to apply it to a project I’m doing for work. However, I needed something simpler to try it in first, so I used it to design a new WordPress theme for this blog. This is something I’ve been wanting to do for a while, but it wasn’t really a priority.

Overall, I’m pretty happy with how it turned out, and Blueprint made it easy to get the layout right without hours of CSS fiddling. I’m not a CSS expert by any means, so often hours of fiddling are unavoidable if I need to do some complicated CSS.

For comparison, here’s an archive of what the old theme looked like:

I still want to theme the comments at some point, to get the Gravatars bigger, but it’s not a high priority. That aside, what do you think of the new theme?

Death Stats

Inspired by this blog post by Tim Ferriss and the letter “On the shortness of life” by Lucius Seneca contained therein, I created a “death stats” script to help remind me to make good use of the time that I have left.

Of course, I could die in a car accident any day, but we have to think of these things practically and probabilistically.

The script runs in Bash — you’ll need a Mac or Linux machine, or Cygwin on Windows I suppose, in order to run it. I have it running on my webserver and emailing me each morning via a cron job. The math should be pretty self-explanatory, and you could easily add your own metrics. Note that I’ve changed my exact birth date for the posted script here, since in some situations that could be considered confidential information.

The estimated death date I got using the “Normal” mode of the Death Clock.


#!/bin/bash
# Prep
# YYYYMMDD
BIRTHDATE="19820301"
DEATHDATE="20570127"
DAYSPERYEAR="365"
SECONDSPERDAY=$((24*60*60))
SECONDSLEFT=$((`date -d $DEATHDATE "+%s"`-`date "+%s"`))
SECONDSTOTAL=$((`date -d $DEATHDATE "+%s"`-`date -d $BIRTHDATE "+%s"`))
# There's probably a nicer way to format the percentage but this works
PCTOVER=`echo "scale=2; (($SECONDSTOTAL - $SECONDSLEFT) / $SECONDSTOTAL)*100" | bc | sed "s/\.00//"`
DAYSLEFT=$(($SECONDSLEFT / $SECONDSPERDAY))
YEARSLEFT=$(($DAYSLEFT / $DAYSPERYEAR))
# Output
echo "Percent Over: $PCTOVER"
echo "Days Left: $DAYSLEFT"
echo "Years Left: $YEARSLEFT"

The output looks like this (the numbers are made up):

Percent Over: 29
Days Left: 19002
Years Left: 51

I do hope and think it reasonably likely that Ray Kurzweil is right, and that my life could be substantially extended, but I’m not counting on it, and I don’t think I should — it would kind of defeat the purpose here. Read the letter by Seneca in Tim Ferriss’ post to see what I mean.

Suggestions for improvements to the script are welcome.

NB: This doesn’t work on OS X, because the date command is different.