Blog Posts

Adding a generic oembed handler for Hugo

If you’re at all like me, you have content on a bunch of different sites (Instagram, Youtube, Flickr, Soundcloud, Bandcamp…) and, especially for multimedia content, it’s great to be able to link to ‘live’ versions of that content. Of course, all those sites will let you ‘share’ content and usually have an ‘embed’ option that hands you a bunch of HTML that you can paste into your blog entry. But screw that! I’m a programmer for whom laziness is one of the cardinal virtues – if it’s at all possible, I prefer to let the computer do the work for me.

If nothing else, once I’ve got the programming right, it’s less likely to screw up than me

Hugo1 sort of supports this out of the box with its youtube, instagram, vimeo etc. built in shortcodes. The thing is, they’re not lazy enough – you have to dig into each URL to extract a content ID and pass that in to {{% youtube kb-Aq6S4QZQ %}} or whatever. Which would be kind of fine, if you weren’t used to the way sites like Facebook, Twitter, Tumblr and so on work. With those sites, you enter a URL and they disappear off behind the scenes and fill in a fancy preview of the page you linked to. Why can’t Hugo do that?

My Virtual Gig-Like Thing

On Thursday the 9th of April at 7pm UK time, I’m streaming my first attempt at a full folk club style gig from my study to my Twitch stream and I would love for you to be there. Schedule It all kicks off at 7pm, UK time with a kind of Q&A session and introduction to Twitch for newcomers. I’m particurly planning to help other independent musicians reach their audience through the platform.

A Wizard of Earthsea

This was the first.

Before I read Tolkien at the suggestion of the wonderful Miss Reese, my teacher for my last year of primary school; before I pulled Diana Wynne Jones, Alan Garner, Susan Cooper and others from the shelves of Bawtry’s small, but enchanting branch library; before Anne McCaffrey’s DragonSong found me in my school library and set a fire in my imagination. Before all that, I read A Wizard of Earthsea and it stuck with me.

A recipe is just a directed acyclic graph…

In the last post I handwaved the way I represented bakery formulae in the bakery database, so here’s a little more detail. It helps to think of a bakery formula as a node on a directed acyclic

If you ignore the fact that a starter is made of flour, water and starter. Which, of course, we’re going to.

graph with weighted edges, where the weights are literally weights. Here’s the graph a for a couple of products

Running a bakery on Emacs and PostgreSQL

Just over a year ago now, I finally opened the bakery I’d been dreaming of for years. It’s been a big change in my life, from spending all my time sat in front of a computer, to spending most of it making actual stuff. And stuff that makes people happy, at that. It’s been a huge change, but I can’t think of a single job change that’s ever made me as happy as this one.

MacOS Sierra Niggles

I shouldn’t be surprised. Every time I upgrade the OS on my Macbook a few little behaviours I’d taken for granted start breaking. It’s just the way of the world. Here’s a couple of things I’ve fixed already

Big Data and Singing Crowds

I watched the rugby yesterday. England vs Wales at Cardiff Arms Pack. It was a great game of rugby - England were comprehensively outthought by a Welsh side with more experience where it counts, but by gum, they went down fighting to the very end. It’s going to be an interesting few years in the run up to the next World Cup. While the game was going on, I found myself wondering why the crowd’s singing sounded so very good.

Getting Softer

Welcome back. I realise that I left off without telling you how I’d chosen to wire the matrix up. I’m basing my layout on the Jesse’s “Blue Shift” layout:

However, the Maltron has a slightly different layout and I’m less gung ho about getting rid of the extra little finger keys, especially the left hand control and the shifts. The layout I’m starting from looks a little like this:

Fun with solder

Where were we? Ah yes, I’d just unwired my Maltron, pulled out all the switches, ordered some Cherry MX brown stem keyswitches from a Deskthority Group buy and a Teensy++ from Pieter Floris. Now all I had to do was work out how I was going to wire the thing up. Jesse’s article had some great pointers, but as I disassembled the Maltron wiring loom, I gained a great deal of respect for their decision to use fine enamelled wire (which a bit of googling revealed to be solderable copper magnet winding wire - I bought some 30SWG stuff from wires.

In which Piers prepares to void the warranty...

Some years ago (I have the awful feeling it was 1999) I was stricken with a bout of tingly numbness in my right hand. When you’re a computer programmer, the thought of being unable to type, and thus unable to program isn’t something you ever want to deal with. Terry Pratchett’s words about gnawing the arse out of a dead badger if it would make it better spring to mind. So, I replaced my mouse with a trackball, got a better chair and invested three hundred and some pounds of my own money in a Maltron keyboard.

Belated OSCON writeup

I had such fun. Though I’m never, ever, livecoding half an unwritten talk in an Emacs window again. You want proof? Also. I’m not dead, I’m just writing a book on Higher Order Coffeescript for O’Reilly and I alternate between bouts of horrid mental block and massive splurges of disorganized content where everything seems to be more important than everything else.


Today is Alan Turing’s 100th birthday. I’ve been thinking about him lately, in particular about a story that demonstrates the perils of working with genius. The story goes that, when Turing was working with the Manchester Baby (the first stored program computer ever built. Just) a colleague wrote the first ever assembler which would turn (relatively) human readable assembly language and turn it into the ones and zeroes of machine code that the machine could actually execute.

An instructive joke for all occasions

Two bulls were grazing at the bottom of the big pasture, when the farmer let a load of heifers in at the top gate. “Hey,” said the young bull to the old, “What do you say we run up there and fuck us a couple of heifers?” “Well,” said the old one, “You’re welcome to do that if you want to, but I plan on walking up there and fucking all of them”.

References in Child of the Library

I sometimes think that I should have published the lyrics to Child of the Library with a bibliography. The references in the second verse are all obvious to me, but I’m a white middle class English boy who grew up around boats. My childhood reading and yours may not intersect all that much. So… The Walkers and the Blacketts Also known as the Swallows and Amazons. Swallows and Amazons is the first ‘big’ book that I can remember reading for myself.

The Further Adventures of Child of the LIbrary

Or… what I did this summer. Summer as been frantic. Mostly joyous, but frantic. I had talks accepted at both YAPC and OSCON. Because YAPC was in Asheville, and the Swannanoa Gathering Traditional Song Week fell the week after YAPC, that meant I flew out to Asheville for an intense fortnight of Perl community engagement followed by a week spent singing myself hoarse and being blown away by Sheila Kay Adams’s singing and her stories of mountain life and listening to future stars like Sam Gleaves and inspiring activists like Saro Lynch Thomason.

A Child of the Library, revised

Here’s a revised version of A Child of the Library.

  <iframe width="100%" height="400" scrolling="no" frameborder="no" src=""></iframe>

Save Our Libraries

So, on Saturday, the opening line, and pretty much the entire tune, of a song banged on my head as we went to our local Library to fill our boots with books and generally get with the “Save our Libraries” message. Here it is. Sing it out. Sing it loud.

  <iframe width="100%" height="400" scrolling="no" frameborder="no" src=""></iframe>

The OSCON Proposal I really, really want to be accepted

Open Ears, Open Mind, Open Mouth. Music Making Made Easy Blurb Our bodies are the most versatile and sophisticated musical instrument we know. From the complexities of making at beat with our hands and feet to the surprising simplicity of harmony singing, we are all of us musicians. Abstract Musicmaking isn’t some kind of sophisticated profession that requires the intervention of gatekeepers and techno priests. You don’t need autotune, you don’t need a record label, you don’t need drums, a guitar or anything else but your hands, feet, ears, brain and mouth to make music that will satisfy you for the rest of your life.

A Handy Builder Pattern

I’m working on a web service, and that means that I need to build lots and lots of mildly different looking HTTP requests with various combinations of headers and requested URLs. The camel’s back got broken this morning when I realised I didn’t want to be writing a method called ssl_request_from_uk_with_bad_cert, which builds me an HTTP::Request with a particular combination of headers, that I can use with Plack::Test to test our webservice.

Asynchronous Streams

In Higher Order Javascript, I introduced Streams and showed how to use them to implement a lazy sort. I think that’s neat all by itself, but it’s not directly useful in the asynchronous, event driven execution environment that is the average web page. We’d like a structure where we spend less time twiddling our thumbs as we wait for force to return something to us. Non blocking streams What if we change the protocol of our stream to something more asynchronous?

Higher Order Javascript

To my surprise, several people have asked for the slides from my Øredev talk on Higher Order Javascript, and I’ve followed my usual practice of saying “Sorry, no”. Slide decks are a terrible teaching medium - they’re fine if they come with the presenter, but if they contain enough information to read as if they were a book, then I’m prepared to bet that they made a terrible presentation. Good presentations have a synergy; slides illustrate what the speaker is saying and neither the speech nor the slides should really stand alone.

... and relax

Crikey! What an intense few days.

Last Friday, I got some email from Giles Bowkett saying that he’d had to flake on a conference in Sweden and could I take his place. The brief was to “be interesting, and I know you can nail that in your sleep”.

Last Saturday, I read it. And being flattered by Giles’s silver tongue answered to say “Probably, when is it?".