Blog posts

An interposer to debug C++ exceptions (2020-04-26 15:18:53 +0000)

I've just released, which solves some problems I've had with tracking down the source of C++ exceptions (especially in environments where using gdb's catch throw command is impractical).

50 short programs in Rust, #6 - xscreensaver (2020-04-13 11:02:18 +0000)

In Coders at Work, jwz talks about writing screensavers for fun ("They make this neat result and you don't have to think about them too much. They don't haunt you."). I've wanted to try writing one since I read that, and I finally got around to it this weekend.

Stack corruption and how to debug it (2020-04-11 17:45:08 +0000)

I hit some stack corruption bugs recently, and have been looking at tools to debug/prevent them. Here's what I learnt!

50 short programs in Rust, #5 - symlinks (2020-03-14 17:52:26 +0000)

I can almost never remember how to create symlinks - that is, which way round the arguments to 'ln' go. So I wrote a Rust equivalent, called symlink, which you invoke as symlink file-a --pointing-to file-b - more characters, but if I don't have to look it up every time, quicker overall.

How to write a C++ function that behaves like emplace_back? (2020-01-29 23:16:18 +0000)

Recently I was working on some C++ code where I had one class (Foo), and another class (FooDoer) that took ownership of Foo objects and did stuff with them.

50 short programs in Rust, #4 - raw sockets (2019-11-10 22:11:29 +0000)

(I'm writing 50 short programs in Rust, often ones I would normally write in Python, to improve my fluency - starting here).

Why does bind() to a SOCK_RAW return EADDRNOTAVAIL in FreeBSD but not Linux? (2019-11-03 10:50:48 +0000)

I tracked down an interesting bug this weekend - a SIPp user reported getting a "Can't bind media raw socket" error on FreeBSD 11.2, which I was able to repro. This was in the code that replays packet captures of media, by opening a raw socket and sending the media packets through it, with the raw sockets giving it full control (including the UDP headers).

50 short programs in Rust, #3 - simulating a hash collision attack (2019-10-16 22:17:40 +0000)

(I'm writing 50 short programs in Rust, often ones I would normally write in Python, to improve my fluency - starting here).

50 short programs in Rust, #2 (2019-10-12 20:11:29 +0000)

I use XFCE4 as my main window manager, and I like its flexibility/customisability. I recently found out about xfce4-genmon-plugin, which is a "generic monitor" - it runs any command on a configurable interval and includes the output on the XFCE panel. By having that command return XML, it can even display tooltips and images as well as plain text (see

50 short programs in Rust, #1 (2019-10-07 20:49:00 +0000)

I'm at the point where I can read and write Rust (well, with a fair bit of help from the compiler), but I don't yet feel fluent in it and it doesn't feel completely natural. For example, I still reach for Python when I want to implement short programs to try out an idea.

Code navigation with fzf/vim/ctags/ripgrep (2019-05-27 20:25:23 +0000)

I've recently been trying to improve my skills at navigating code. I've used Vim's ctags support and the ctrlp package, but they've never really stuck - possibly I just find it tricky to remember new Vim keybindings or commands - so my normal approach to "find this function in this codebase" is still to grep it from the command line.

Automating Arch Linux setup on an RPi (2019-04-07 17:31:19 +0000)

I bought a Raspberry Pi 3 recently, and installed Arch Linux, in order to have a small, cheap, home server. For various reasons (e.g. plugging in USB devices with too much power draw, causing corrupted SD card writes) I keep having to reinstall it, so I've put together some scripts to make it simple.

pyforwarder, a Python message forwarding library (2019-03-04 23:47:30 +0000)

Preferring composition to inheritance is a nice design pattern, and one which makes it simpler to break functionality into independent classes that can then be brought together (without the complexities of multiple inheritance).

Theming Cobalt (2019-01-20 18:26:18 +0000)

When I switched from Pelican to Cobalt as my static site generator this year, one of the trickiest things was theming the site. Cobalt doesn't (yet) have anything like, so you need to roll your own theme, and I thought I'd write up some notes on how.

Automated blog publishing with AWS CodeBuild (2019-01-03 12:47:26 +0000)

I was reading recently, and the Side-Project Manifesto ("Don’t do things in such a way that I have to remember how shit works 6 months from now") struck a chord with me. Amongst other things, it's a bit of a pain point when updating this blog - besides writing the posts, I need to remember how to publish and upload it. So as part of revamping my blog (and moving it from Pelican to Cobalt), I decided to set something up so that pushing to Github would automatically publish it.

Podcasts on the command-line, in Rust (2018-04-08 22:10:00 +0100)

I've been listening to more podcasts recently on my commute and at the gym, including New Rustacean and AB Testing. I currently use Clementine to manage my podcasts, but it's not perfect - the "Copy to device" menu option was greyed out this morning, so I had to copy podcast episodes on manually.

Learning Rust (2017-11-04 22:28:00 +0100)

I've been learning Rust recently, and it's the first new language (with new concepts, like borrowing) I've learnt for a while - probably the first since Clojure in 2013. I thought it was worth writing up exactly what I'm doing to learn it, in the hopes that it's useful for others learning Rust and new programming languages in general.

Can testers prevent problems? (2017-09-25 14:59:00 +0100)

I read recently that testers can't prevent problems, with the specific example that if a tester found an issue while reviewing a design or prototype before any code had been written, the mistake had still been made and caught by testing. I thought that in one sense this was pretty close to being true, and that in another sense it was completely wrong.

Lightweight presentations with represent (2016-07-09 16:15:00 +0100)

I've been trying to find a good, lightweight way to write technical presentations for a while now. Specifically, I'm looking for one that avoids some of the common problems with Powerpoint:

Using Python and Pandas to check HTTP load distribution (2016-05-30 09:36:00 +0100)

Since writing my previous post on using standard Unix shell tools to analyse a HTTP access log, I've been thinking about how to do this with more standard data analysis tools. Using Pandas and Matplotlib, which are the main Python data libraries, you can get a bit more fine-grained control, and view the results graphically.

Intermediate Vim - Macros (2016-04-24 09:58:00 +0100)

(I previously posted on another Vim feature, sessions, which you can find here).

Is my load evenly distributed? (2016-04-16 10:59:00 +0100)

I recently had a log file full of timestamped data, and I needed to analyse it to see how evenly distributed it was. Turns out this is surprisingly easy with standard GNU command-line tools.

C++ static analysis (2016-04-10 11:54:00 +0100)

Recently, I've been looking at static analysis for some of my C++ codebases - tools that will warn about possible errors in my code without needing to run the code. I've been looking, in particular, for things that I can add as a build step - that is, cases where I can trust the static analyser to be right and fail the build if it fails, rather than fuzzier checks where you need human judgement to double-check that the analysis makes sense.

Clang vs. GCC - code coverage checking (2016-04-02 15:37:00 +0100)

Recently, I've been compiling some of the codebases I work on under Clang 3.8 instead of GCC 4.8, to take advantage of better compiler warnings and faster compilation speed (I've seen a 33% speedup, though I haven't tested this rigorously). Today, I got to grips with llvm-cov-3.8, and checked the coverage of my Clang-compiled test suite - and saw coverage failures, on a test suite I know has 100% coverage when compiled under GCC. Some of the uncovered lines were very odd - a closing brace, for example. What's going on?

Intermediate Vim - Sessions (2016-03-27 11:00:00 +0100)

I've been trying to improve my skill with Vim recently - I'm definitely nowhere near an expert, but I've been trying to move beyond just the basic "read files/write files/use regexps/install plugins" to understand and use more of Vim's built-in features. I'm planning to write blog posts on a couple of things, including macros, folding and ctags, but the first thing I've dug into and found useful are sessions.

Clearwater and Juju (2015-06-21 19:37:00 +0100)

I wrote a short piece a while ago on Juju, the software orchestration tool written by Canonical (the company behind Ubuntu Linux), and specifically on orchestrating Project Clearwater with Juju. You can find that at or

Concurrent-ruby and Minitest (2014-12-07 21:22:00 +0100)

I spent some time earlier today debugging an interesting interaction in Ruby between minitest/autorun and concurrent-ruby, and since none of my searches on it turned up quite the right answer, figured I'd write up my notes.

New PPA for OpenIMSCore FHoSS (2014-07-06 16:10:07 +0100)

A while back, I got in touch with the Fraunhofer FOKUS team behind OpenIMSCore, with some fixes I wanted to make to their HSS, and ended up being granted commit access to their repository. I've now made those fixes and wanted to distribute them more widely, so I've set up a PPA and made the Fraunhofer Home Subscriber Server (FHoSS) available as a Ubuntu 12.04 LTS package. (It should be trivial to build and install it for other Ubuntu systems, too, but 12.04 seemed like the best one to start with).

Four cool things from KamailioWorld 2014 (2014-04-15 20:50:00 +0100)

A week ago I got back from KamailioWorld in Berlin, where I was giving a talk on performance testing. I really enjoyed myself - it's a nicely-run conference, and it's useful to talk to the broader open-source community and find out about new trends (WebRTC, stronger cryptography) and tools.

Notes from the December 2013 Clojure eXchange (2014-01-07 22:10:07 +0100)

Last month, I went to the Clojure eXchange in London (run by SkillsMatter). I've been meaning since then to write up my notes from the most interesting talks, so here goes. You can see all these talks (and others I've not mentioned) at

Reconfiguring an AWS Elastic IP with Pallet (2013-12-08 21:50:00 +0100)

I was recently playing around with Pallet (as an offshoot of some of the DevOps-style cloud provisioning work I do on Project Clearwater), and had a bit of trouble getting from Pallet to the underlying jClouds API (I was using 1.5.5).

London Clojurians - October 2013 Clojure Dojo (2013-10-30 19:50:00 +0100)

I was at the London Clojure Dojo last night, and worked on 4clojure problem #146. I'm not going to post my code - that feels like a violation of the spirit of 4clojure - but I am going to talk about a cool feature of the Clojure 'for' macro that I discovered while playing with this.