Thursday, 16 April 2015

Streaming BBC Radio

Since the last Ashes series, the BBC have changed their URLs for their radio streaming, so I had a quick hunt around and found their up-to-date URLs.

Below, is code which uses mpc to stream your station of choice. Listening to TMS on the laptop at strange hours of the day is working again.

It uses mpc to play the stream, so get to it.

Code here on pastebin.

Wednesday, 10 July 2013

New version of update-dnsomatic

I've had a change request for update-dnsomatic! A fairly sensible one, as it happens, to force updates even if the IP address hasn't changed.

There is a new parameter, force, in the config file to set the value in days, eg:


will force an update if /etc/update-dnsomatic/myip is older than seven days. The default value is 7.

You can download the new version (0.2.1) here.

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.

#bong n hours of the time (12 hour clock) mimicking @big_ben_clock

I=$(date +'%l')

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

#tweet bigben bongs while @big_ben_clock is down
/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.

Wednesday, 16 January 2013

update-dnsomatic and dig

I have been using update-dnsomatic on my home server for some years now and it has worked well. Yesterday, I noticed that an update had 'worked' but the DNS entry had not propagated for some reason or other.

As a result of this, I have written a quick script that compares my public IP with a dig query which sends me a DM via twitter to let me know when they are different.

Files below: digip, cihip (Can I Haz IP), dmpr4wn

You need dnsutils (for dig) and a working copy of TTYtter for this to work.

Simply run digip every half hour or so and any discrepancy will be notified via twitter direct message.


# digip
DIG=$(dig | grep ^ | awk '{ print $5 }')

if [ "$CIH" == "" ]
        echo "Public IP address is blank. Exiting."
        exit 1

if [ "$DIG" == "" ]
        echo "DNS IP address is blank. Exiting."
        exit 2

if [ "$DIG" != "$CIH" ]
       echo "Dig IP $DIG does not match public IP $CIH"
dmpr4wn "Dig IP $DIG does not match public IP $CIH"
echo "Dig IP $DIG matches public IP $CIH ok"


#cihip Can I haz IP
wget -qO -


TWEET="/dm pr4wn"
ttytter -status="$TWEET $1" -hold

Sunday, 13 January 2013

Tweeting uptime

I thought I'd write a quick bash script to tweet uptimes for my machines using TTYtter.

It's a simple enough script which I intend to run once a week (so as not to pollute followers timelines).

So, here it is:

TWEET="Uptime for $(hostname) is $(date '+%d/%m/%Y') $(uptime)" 
ttytter -status="$TWEET"

Wednesday, 5 December 2012

ttytter daemon with systemd

Now that Arch Linux has made a permanent move to systemd, I thought I should write up a guide on how to start a ttytter daemon to allow you to log your timeline into a MySQL database using the pwntter extension. Of course, these instructions will work on any such system that utilises systemd.

Service configuration file

Create a file /etc/conf.d/ttytterd and put what ever arguments this instance of TTYtter needs to run as a daemon

# Settings for the TTYtter daemon.
TTYTTERDARGS="-keyf=/root/.ttytterkey -rc=/root/.pwntterrc -exts=/usr/local/bin/ -daemon -hold -backload=500"

Service file


Create a file /usr/lib/systemd/system/ttytterd.service

Description=A TTYtter daemon

# Change the arguments in the file below to suit
ExecStart=/usr/bin/ttytter $TTYTTERDARGS 




Enable and start the service.

systemctl enable ttytterd.service
systemctl start ttytterd.service

Further reading

ttytter documentation

pwntter documentation

Arch Linux systemd documentation

My stats page - warning, it's my home server and is as reliable as I am.

Not much to see, but here it is running automagically

Friday, 19 October 2012

cihip bash script

Just a quickie, I wrote a bash version of my Can I Haz IP script which does little more than display your public IP address by returning content from I use it more often than I imagined, so I thought I'd put a copy up here.

#cihip Can I Haz IP?
IP=$(curl -sS
echo $IP