• "I'm less nostalgic for old kinds of HTML than for the part of myself that was young and fearless and desperate to connect to the wider world. I get a kick out of the under construction images but, I mean, they actually are hosted and served on a perfectly modern boxes into browsers that are essentially virtualized supercomputers." Paul Ford: still the best.
  • "As serious intellectuals often do, we spent hours discussing these questions, what data we would want to collect to answer them, and even how we might go about collecting it. It sounded like a fun project, so I wrote a program that takes video captures of our Mario Kart 64 sessions and picks out when each race starts, which character is in each box on the screen, the rank of each player as the race progresses, and finally when the race finishes. Then I built a web client that lets us upload videos, record who played which character in each race, and browse the aggregated stats. The result is called Kartlytics, and now contains videos of over 230 races from over the last year and change." Yes, it's a plug for manta, but it's also a nifty piece of engineering.
  • "Termshows are purely text based. This makes them ideal for demoing instructions (as the user can copy-paste), making fail-safe "live-coding" sessions (plain text is very scalable), and sharing all your l33t terminal hacks." Really lovely: record terminal activity, upload it to a URL, share it with others, dead simple. And the client playback is all javascript. Lovely.

I’m working on a hardware project at the moment that’s more complex than a basic microcontroller-build that I could have implemented with an Arduino. So I’ve been using a Raspberry Pi as the centre of the project, and writing my code in the high-level languages I’m most proficient in. (In this case, Ruby).

As the project nears completion, it’s really important that the device doesn’t manifest as a computer in any way: it’s just a physical object. To that end, I’d like all the software inside the miniature computer to run at startup without any manual intervention.

My Pi is running Raspbian – the Pi-focused version of Debian – so, fortunately, there’s a tool easily available to do that for us: upstart.

We’ll write an upstart configuration for our script, which will turn our script into an upstart service, which we can then start at login.

First, let’s install upstart:

sudo apt-get install upstart

This will issue some warnings, because – on my install – it was replacing the traditional init.d setup. Don’t worry; everything will continue to work.

Once you’ve installed upstart, reboot your Pi, either from the command line or with a power-cycle.

Let’s now make an upstart config file. Here’s a very basic one:

Put this code into /etc/init/myscript.conf. You should then be able to run the script by typing sudo start myscript, and kill it with sudo stop myscript. And, of course, you’ll discover it’ll start automatically on startup.

That’s a very simple example, with no dependencies. But that won’t work for the script I’d like to use. In this example, I’m running a Ruby script (using the Pi Piper library) that blinks an LED attached to GPIO Pin 17. That script needs to be run as root to get access to the GPIO pins, and it needs to reference the directory’s Gemfile. Upstart scripts are run as root, so that’s not an issue – but we need to set up the environment correctly. That’s not so hard:

As you can see, we just have to export the BUNDLE_GEMFILE variable so that Bundler will know where the Gemfile is located.

Also, you’re going to have to make sure that all references to files in your code are done with absolute paths. That wasn’t a problem with the simple shell script example, but becomes an issue with more real-world type code – especially the program I’m ultimately running, which has various includes, dependencies, and data files to load. An obvious place you’ll run into this with Ruby is when setting up the $LOAD_PATH.

Rather than starting my Ruby script

$LOAD_PATH << 'lib'

I had to do this:

$LOAD_PATH << File.expand_path(File.dirname(__FILE__)) + '/lib'

And similarly, any other references to file loading will need to be absolute – and, ideally, derived using tricks like File.dirname(__FILE__) rather than through hardcoded paths.

Anyhow: it took me a while to piece together, but now that I have, it felt worth writing down – because I’ve now got reasonable complex computation-backed hardware working in an entirely headless enclosure – and one that’s resilient to power-cycling.

  • "All operating systems know when they were born. Their internal clocks start counting then, so they can calculate the date and time in the future. It is unclear whether it was Mr Ritchie or Mr Thompson who set the so-called start Unix time at January 1st, 1970. That moment came to be known as the epoch. Mr Ritchie helped bring it about. And with it, he ushered in a new era." Which is as poetic a way as any of expressing how deeply rooted K&R are in the modern world.
  • "It’s hard to believe that there was a time when any of these weren’t conventional wisdom, but there was such a time. Unix combines more obvious-in-retrospect engineering design choices than anything else I’ve seen or am likely to see in my lifetime.

    It is impossible — absolutely impossible — to overstate the debt my profession owes to Dennis Ritchie. I’ve been living in a world he helped invent for over thirty years."

  • List of all 58 fonts now in iOS, mainly for reference. (Although, eesh, Zapfino AND Papyrus? Really?)
  • Critical, critical, to the world we live in today.
  • "And all this time I can’t help thinking that this was because I’m working with games. If I was a fimmaker, this is issue would never crop up. But games have to constantly defend their status as a way of creative expression. When creating games, you are by default suspected of either selling out or producing nothing of value what so ever. Or both." Seriously, Vimeo need to sort this out: it's embarrassing, and contrary to the messages they send out.
  • "I wanted to talk about the Occupy $CITY movement here (in fact, that’s where this post started); a protest movement that is not about the event, or the movement through the city, or even the disruption per se. It is protest as part of the fabric of the city; a constant questioning and reassessment of a conversation with both the fabric of the city physically, economically and politically; taking the concept of Wall St and Main St and making it suddenly concrete, forcing a conversation to take place."
  • "If this doesn’t seem like a big issue imagine the state of cinema if film students were only able to study films made in the last two decades? Or if English Literature students no longer have the ability to examine the works of Shakespeare or Twain? What might be lost?" Seriously, companies: stop turning servers off. Processor power is cheap.
  • "Q: I don't imagine that a design meeting with Takahashi is a typical PowerPoint affair.

    A: He has singlehandedly invented the animated GIF as the design spec. It's fucking hilarious." Animated GIF as design spec. Superb. (And: nice interview with Stuart Butterfield about Glitch).

  • "One succeeds because it leverages the player's motivated, explorative, self-driven experience; the other fails because it relies on a hackneyed, disjointed "epic" plotting (told in 3 separate plot-lines via cutscenes) with incongruous settings and 2-dimensional characters. One succeeds because its formal systems directly feed the player's connection to the world and characters; the other fails because its formal systems bear no discernible relationship to the stories the game wants to tell." This is strong stuff from Michael; I am increasingly fed up of the focus on (poorly-told) stories in games.
  • "Know that there are no "accidents" in this game design. Everything you notice about the game, and every subtle interaction that you experience, is intentionally packed with meaning." (Gravitation, still, being my favourite of Rohrer's games, I think).
  • "Crucially, Goodrich entreats the public to note the following: "this change should not directly affect gamers, as it does not fundamentally alter the gameplay." This one statement should cause considerable distress, as it suggests a troubling conclusion about Medal of Honor as a work of public speech.<br />
    <br />
    To wit: it suggests that the Taliban never had any meaningful representation in the game anyway. If a historically, culturally, and geographically specific enemy can simply be recast in the generic cloth of "opposition," then why was it was called "Taliban" in the first place?<br />
    <br />
    And if the Afghan war in which the new Medal of Honor is set was one explicitly meant to drive the Taliban from their strongholds in Afghanistan, why should it matter that the game is set in that nation in the present day at all? In short, how was this Medal of Honor title meant to be a game about this war in particular?" This is a marvellous, critical piece of writing from Bogost.
  • Nice post on Awk basics – most of which I knew, but the examples are still great, especially those involving variables. The links out to the Hacker News and Reddit threads are also full of good stuff.