My absolute favourite thing to do is to go places on sleeper trains. People love to hate on Amtrak, but I’ve taken overnight trains in four continents and its sleeper experience as good as most and better than some. The food’s surprisingly decent, the conductors are lovely, and you can’t beat looking out the window and watching Colorado or Utah or the Hudson Valley go by.
Today it’s mostly trees and Georgia and Alabama, but that’s good too! The sun is streaming in the window, the Crescent is chu-chunking along, and I brought along my raspberry pi to see whether pygame could make the touch screen do something more interesting than displaying cats. Well, so far I’ve mostly just fought python3 (print is a function now!), but eventually I’ll internalise the differences and make things work again.
I love coding on trains. It’s peaceful and pretty, and you get a good long distance to stare into when you need to think.
The Viewliner, Amtrak’s standard train on the East Coast, is especially good for that. It has windows on the top bunk so you can see over the trees, and it’s lovely to fall asleep looking at the stars. But it has one super annoying design flaw: its only power outlets are just under the fold-out sink, and if you can fold out one of those things without unplugging anything, you have a skill I don’t have.
The second time I abruptly yanked the power out of the raspberry pi, it stopped booting, whoops. It’s probably been a decade since I’ve had to deploy fsck, so it was kind of fun to plug the sd card reader into the laptop and remember how to repair the filesystem. When you’re used to running on a ridiculously large fleet of machines operated by someone else, the raspberry pi is a series of small fun adventures. (But please don’t make me go back to being a sysadmin of individual servers with names and habits. I love this cloudy future.)
Anyway, the lesson here is I should probably get a backup battery/UPS, but I don’t think one exists that slots neatly onto the raspberry pi case. Someone should get on inventing that and then take my money.
The other thing I love about coding on trains is the magic of mobile hotspots. Ok, it’s 2017 and I need to get over it, but I still get a kick out of turning on the hotspot on my phone and watching all of the devices slurp down internet. Best of all is when the phone’s charging from the laptop and the laptop’s tethering from the phone. Go team mobile!
I genuinely get very excited about it every time and I tweeted about it yesterday when the train was in Delaware or somewhere, and learned something new in response:
So today I had to go read about mDNS and Avahi. mDNS is a zero-config DNS that creates a .local domain with the hostnames of whatever it can find on your network. So you can connect to DHCP hosts without having to know what IP addresses they’ve been assigned. There are a bunch of implementations of it, most notably Apple’s Bonjour, but also a Linux/BSD open-source package called Avahi.
I definitely wanted some of that, so I went to install avahi on my laptop and discovered that it’s not only installed but already running on Ubuntu by default. So, wait, should I just be able to…
$ ping raspberrypi.local PING raspberrypi.local (192.168.43.88) 56(84) bytes of data. 64 bytes from raspberrypi (192.168.43.88): icmp_seq=1 ttl=64 time=214 ms 64 bytes from raspberrypi (192.168.43.88): icmp_seq=2 ttl=64 time=7.95 ms
Haha, amazing! That made my day.
And that’s how I had fun not writing any Pygame this afternoon.