Watching the National Debt grow… in your terminal

I was watching this little video and came across the idea that it’d be much cooler to see how fast the debt is actually growing at each iteration (I can’t subtract numbers in the proximity of 1014 every second or so just in my head).

The crazy thing is that US government is piling up about $42,000 of fresh debt every second. It’s like a size of annual gross income for many americans 😦

Here I came with the little script below 🙂

#!/bin/bash
curr=0;
prev=0;

while true; do
curr=`wget --quiet http://www.brillig.com/debt_clock -O - | \
grep debtiv.gif | \
sed -e 's/.*ALT="//' -e 's/".*//' -e 's/\ //g' -e 's/^\\$//'`;
echo -n `date +%d/%m/%Y-%H:%M:%S`" "
echo -n "$"$curr " "
curr=`echo "$curr" | sed -e 's/,//g' -e 's/\..*$//g'`
if [ $prev != 0 -a $curr != 0 ]; then
echo -n "Grown by: $";
expr $curr - $prev;
else
echo
fi
sleep 1;
prev=$curr
done

All formating for blogger.com has been prepared by this handy tool

Advertisements