Wednesday, 12 June 2013

Drop-in replacement for @big_ben_clock

Yesterday, @big_ben_clock announced it was going off-line for a while which was a shame as I like the hourly timestamp in my twitter stream.

I thought that I'd offer an identical service using my hardly-used @pwntter twitter account until such time as @big_ben_clock comes back on-line.

Code:  There's two bash scripts, one to generate the BONGs and one to tweet them using TTYtter.


#!/bin/sh
#bong
#bong n hours of the time (12 hour clock) mimicking @big_ben_clock

I=$(date +'%l')

for (( i=1; i <= $I; i++ ))
do
     echo -n "BONG "
done


#!/bin/sh
#bigben
#tweet bigben bongs while @big_ben_clock is down
TWEET=$(bong)
/usr/bin/ttytter -keyf="/home/prawn/.ttytterkeypwntter" -ssl=1 -norc -hold=5 -status="$TWEET"

Simply use cron to fire off the bigben script on the hour.

No comments: