Saved by the Prompt

One of the most-used apps on my iPhone is Prompt, an SSH client by Panic. I use it for connecting to the Linode web server that powers this blog. SSH on the iPhone might seem silly. (I only ever installed it as an experiment.) But in sticky situations, it turns out that having the Unix command line in my pocket can be really useful.

A recent example: I was staying at a hotel for work, and the booking reference had been sent in an Excel spreadsheet. When viewed in Safari on iOS, the booking number was “helpfully” recognised as a number, and shown in the approximated form 1.41+E9. Since I don’t have a spreadsheet app installed, I had no way to see the original number.

There are plenty of tools for converting Excel files into nicer formats, but they all need a command-line. No problem with Prompt: I synced the spreadsheet to my Linode with Dropbox, then used csvkit to turn the file into a CSV. Voila: the booking reference.

All that took less than five minutes, and used just a handful of megabytes of data.

I never use Prompt for long sessions – I’d always grab a laptop for that. But when I’m in a pinch, I can fall back on my trusty command-line tools. There’s a lot you can do with simple Linux tools that’s much harder to do with full-sized iOS apps. If you’re comfortable in the shell, it’s a great app to have handy.

The Harry Potter Collector’s iPod 

I like to think of myself as a Harry Potter geek, and I follow Apple as well. But I was blown away today by Stephen Hackett’s post about the Harry Potter Collector’s iPod. This is an intersection of my hobbies that I never knew existed.

Check out his post for what little information we know about this product — like Stephen, I can find almost nothing about it.

But I did manage to find a few things Stephen couldn’t — a few pictures, and the date it was discontinued.

There are some old terms and conditions on Apple’s UK website. This tells us when the promotion was discontinued, at least in Europe:

The closing date for this offer is March 7, 2006. All purchases must be made by this date.

And I found three sets of photographs:

  • A Polish website called “Museum iPodów”, in a post titled The most mysterious iPod. There’s a pretty good photo of the crest engraving.

  • On “Say Hello to iPod”, a post about all the editions of the fourth generation iPod, with another photo of a slightly beaten-up version.

  • A YouTube video from user “Bart” showing off a version of the device. You can see the back of the iPod towards the end of the video, although the engraving is barely visible.

I also found an Ebay auction with two of the devices for sale. It claims the devices were only for sale for a few months in 2005, but unfortunately all the picture links are broken.

I’m impressed by this device. Partly because it’s evaded my knowledge for so long, and partly for how well it’s managed to disappear. In the age of the Internet, where everything is seemingly recorded forever, it’s amazing to find something that’s been almost completely forgotten.

The Skeletor clip loop, 2015 edition 

As is becoming a tradition, The Incomparable posted their 2015 Clip Show a few weeks ago, which extended Steve Lutz’s recursive Skeletor clip loop. Slightly later than usual, I’ve updated the chart I maintain to track the progress of the clip loop.

I call this the “Oh god, what have we done” edition.

A few changes this year:

  • Different mentions within the same episode get different points on the chart. Trying to contain all the mentions within an episode around a single point was getting unwieldy.

  • I completely redrew and rewrote the chart this year. The old version was made in OmniGraffle, but I’ve switched to using LaTeX and TikZ. I already use those tools very heavily, so it will be much easier for me to make updates in future. I’ve also provided source code — so you can make your own clip loop at home!

  • This year’s clip show added no less than four events to the chart. I also added an entry for Nathan Gouwens’s interactive audio chart.

It’s possible that this clip loop is getting a little silly. All we need now are some bowls of stew

A cautionary tale about Fusion Drive repairs

In September, my iMac became pretty sluggish. Apps were slow to launch, the Finder was like treacle, and anything that touched the disk caused the fans to spin up. I had a disk failure.

Since my iMac is sealed up tightly, I didn’t want to try replacing the drive myself. I took the machine to the local Apple Store. The repair was a terrible experience1 – it overran by a month and with very poor communications from the Apple Store. There’s not much I could do about that.

But listening to Casey’s iMac tale of woe on the latest ATP, I realised there was some useful advice I could give to other people going for a repair.

My iMac has a Fusion Drive – a combination of an SSD and a spinning platter hard drive, presented as a single volume in the OS. Only the spinning platter part had failed, so that was all that got replaced.

When I got the iMac back, I was a bit tentative: I installed and configured a few key applications, set up Dropbox, played around for a bit. Once I was happy that the machine was in working order, I tried to copy my iTunes directory from my backup disk, and got a surprise:

An OS X warning dialog that says 'The item iTunes Media can't be copied because there isn't enough free space.

It turns out that when Apple’s Genius had replaced the spinning platter, they hadn’t rebuilt the Fusion Drive. The two devices were showing up as separate volumes in the Finder, and I was trying to copy my massive iTunes folder onto the tiny SSD.

I was, to say the least, quite annoyed.

Fixing this turned out to be fairly easy. I was worried I’d have to muck about on the command-line, but rebooting into Recovery Mode and opening Disk Utility was all I needed. It immediately said “This disk is damaged, would you like to repair it?”. I clicked “Yes”, and it rebuilt my Fusion Drive.

Cautionary note: doing so also reformatted both drives, so I had to start my installation from scratch.

So if you have a computer with a Fusion Drive, and you send it to get repaired, make sure they restore the Fusion Drive. Because fixing this problem requires wiping the disk, I’d check it as soon as you get the machine back.

Since the machine was repaired and I rebuilt the Fusion Drive, I’ve had no more problems. I’m still annoyed at the Apple Store for doing an incomplete repair, but hopefully this can save somebody else a bit of hassle if it happens again.

  1. I filed a long and detailed complaint after the repair was done, and to be fair, I did get a sincere apology. Even if it took another fortnight before I could get hold of a manager. ↩︎

The Incomparable’s “Best Of” 2015

Yesterday The Incomparable podcast posted their 2015 wrap-up show. This is always a good episode – the panellists recap their favourite media from the last year, which is always a source of good recommendations, and discuss highlights from a year of podcasting. Every year, I come away with a long list of things to look up later.

(This is also the annual episode for perpetuating the infamous Skeletor clip loop.)

I’ve written a list of everything recommended in the first half of the show, so that I can look it up later. This is no substitute for listening to the episode itself, but hopefully it will serve as a useful reference for other listeners.

Continue reading →

Pretty printing JSON and XML in the shell

Last year I read Craig Hockenberry’s magnus opus – a huge collection of information about the OS X Terminal and the Bash shell. It’s worth reading in its entirety, even if you don’t use a Mac. My favourite tips were opt-clicking to jump around in Terminal (which makes Vim far more usable for me), and using the lsof command when a disk won’t eject. Both super useful.

At the same time, I read Dr. Drang’s suggestion that we write up our own tips. I wrote this post at the time, and then it sat in drafts for over a year. Oops. Anyway, here are a few tips from me.

I work a lot with website APIs, which typically return responses that are formatted in XML or JSON. To save bandwidth, these responses are minified (stripped of unnecessary whitespace and newlines). That’s fine for a program, but it’s quite painful if I’m reading it.

Luckily, OS X includes a few tools for pretty printing JSON and XML. This makes the responses substantially easier to read for a human.

Continue reading →

Simpler syndication, by Dr. Drang 

A fortnight ago, Dr. Drang wrote about his new RSS service: a Python script that polls his subscriptions once every five minutes, and renders the output as a static HTML page. Reading it was one of those “doh” moments, an idea so simple that I’m annoyed I hadn’t thought of it myself.

I’m a very light RSS user – I only subscribe to a handful of feeds, and I don’t need any of the advanced syncing stuff. (Indeed, managing unread status is almost more work than it’s worth for me.) A Python script that I can modify as much as I want is a much better fit for my needs.

The nice thing about a Python script is that it gives me arbitrary control over the posts. Most RSS services already support basic keyword filtering to hide posts, but with a script I can write whatever rules I like. And I can modify or extend post content before it gets displayed – for example, on sites that only offer a truncated RSS feed.

(I’m probably the only person who cares about this level of tweaking, but I enjoy fixing small distractions in my RSS reader.)

I also made some cosmetic tweaks, mostly reusing the templates and CSS from this blog (albeit with a different colour scheme). This includes dating every post, and better support for linkposts.

This is what the revised version looks like on my Mac:

and on my iPhone:

My updated code is in a Gist.

Backups and Docker

I’ve spent a lot of time recently playing with Docker.

I’ve been building lots of images and containers, and that starts to take up disk space. Lots of disk space. That’s not much of a problem on a local system – space is cheap – but it becomes a problem with incremental backup programs like Time Machine. Suddenly I noticed backups were taking an order of magnitude longer, and backing up gigabytes at a time. Oops.

Incremental backups of my Docker images aren’t very useful, but they force out older snapshots of important data, and slow down my backups. Wouldn’t it be nice to cut that out?

Continue reading →

Export a list of URLs from Safari Reading List

I’ve accumulated a lot of URLs in Safari’s Reading List. Problem is, trying to navigate a long list in the Safari is quite buggy – items move around randomly, I lose my place, and I’d really like more space than afforded by a single sidebar. Wouldn’t it be nice if I could pull all those URLs out of Safari, and get them in a standalone file?

A quick poke around Google didn’t turn up anything obvious, so I decided to write my own Python script for doing it.

Continue reading →

Email with a purpose

I’ve just finished reading Operation Fortitude, by Joshua Levine. Fortitude was an Allied deception operation during WWII, intended to convince the Nazis that Normandy was not the target of the D-Day landings. The book is a good account, although at times I found myself wanting more detail.

I was particularly struck by an early passage:

This [failed operation] proved to be a valuable learning experience for Clarke. His response was to formulate his first rule of strategic deception: to make your opponent act as you want him to. It doesn’t matter what he thinks. In this case the Italian commander was led to expect an attack on Somaliland, but Clarke hadn’t considered what he would do as a result.

The deceiver, he realised, had to get inside the mind of the enemy commander. On this occasion he had failed. In future Clarke would make a point of asking his commander: “What do you want the enemy to do?” And very often, to his surprise, the commander would be unable to answer.

This rule comes up throughout the book, and things go poorly when it isn’t followed.

It made me think about email. Too often, when we write emails, we fire them into the aether without considering what we’d like the recipient to do next. This can lead to vague and unfocused emails – we want something, we just don’t know what.

Clarke’s stragegy gives us a good approach to email: when writing a message, we should ask What do I want the recipient to do? And when you’ve got an answer, include it in the email itself.

← Older Posts