Tool-building hacks #1: audible pings

By , February 11, 2012 8:07 pm

I think I’m genetically a tool-builder. My dad and uncle both take great pleasure in carefully selecting and buying or building tools for their workshops, my mum’s an expert woodcarver with a fair array of sharp pointy things, and these are not the only examples in the family. For me, the habit has manifested in electronic form, and I really enjoy programming new scripts etc. to help me work more efficiently. In fact I’ve collected such a vast array of them over the years that I had to start tracking them under version control back in 1999. (CVS did me proud for many years, but it did not age well, and I finally migrated them to git a few months ago.)

I can’t claim to be remotely unusual in this respect though – there’s a whole subculture of programmers (“hackers”) who can relate to this mindset. Sometimes when I build a new tool, I get the impulse to share it with the world in case it turns out to be of use to anyone else. In the past, these hacks have ended up on my software web page, but I think this blog might be a better medium.

So, without further ado, here’s a cute hack I just built: bping, a wrapper around ping(8) which makes it do a lot of beeping ;-) – one beep per packet received, with pitch going up an octave for every doubling of the response latency. (See below for installation instructions.) Why did I want this?

I use ethernet over power to connect the machines in my bedroom to the equipment in the lounge. In a high-rise apartment block with about 100 wireless networks fighting over the same spectrum band, this is (normally) a much more reliable option. However yesterday the connections in my home network started behaving very weirdly. I tried pinging various machines on the network from each other to narrow down the problem, but it was annoying to have to keep going between rooms to visually monitor the output from the various pings when it would have been quicker to be able to hear the quality of the connections being tested. So I wrote bping, which also turns a laptop into a sort of Geiger counter for wifi.

Currently bping uses bip (here’s a suggested approach to installation) which in turns uses sox to make the beeps. This works fine on Fedora 15 but unfortunately for some reason takes longer than one second to run on Ubuntu 11.10 and openSUSE 12.1, regardless of how short the beep is. I think it’s something to do with pulseaudio, but I haven’t bothered to figure it out yet. Answers on a e-postcard please …

By the way, many of my hacks are already publically available on my github account, but most aren’t documented yet. The current exceptions are:

I’ll try to document some of the others soon. Watch this space!

Share

Panorama Theme by Themocracy