Socially distant

I haven’t posted at all since COVID-19 hit in this area, partly because work (from home) has been all-consuming and a welcome distraction from the outside world, and partly because, during my non-work hours, the old brain has loaded up an endless patter of anxiety:

Was that coughing gentleman really two meters away or maybe one and a half? Is it drafty in here, or do I have the chills? Is the shortness of breath and periodic chest pain a sign of COVID-19, or just your run-of-the-mill heart attack? Should I write another blog post and if so, will it be my last one, and if is the last, would that really be the blog post I want to end on?

And so on.

But I have decided that in some future generation there will be a Ken Burns style documentary on this whole thing and the future Ken Burns will need contemporaneous writing for his voice-overs. And who am I to deny future Ken Burns that material.

So know, dear reader, that so far in Month Six of the Apocalypse, we are all doing well. We have our health, food, shelter, and depressions in the driveway where our cars have sat motionless for half a year.

One silver lining: it turns out my hobbies were fairly pandemic-aligned: I already had sourdough starter going, a garden planned, puzzles for months, and a sewing machine at the ready. Since then, I also learned how to cut my own hair, make my own espresso, and service my own furnace. The children have traded meat-space friends for 24/7 screen time and, from their point of view, this seems to have been an auspicious swap. If they are any indication, we’ll all be just fine when the singularity hits. Which will probably be next year at this rate.

Watts up

One of my goals with this new computer is to be more aggressive about power saving: keeping it in suspend more often, using wake-on-lan for external access, etc. To that end, I dusted off the old kill-a-watt and took some baseline measurements:

Off, but plugged in: 2W
Suspend: 2W
On, idle: 48W (old machine: 100!)
Kernel build: 200W (old machine: 150, but also took 15x longer)
ML training with GPU at 100%: 400W

So long as I don’t run ML training 24-7, I am already going to save a lot of energy with this build.

New build

Last year, I spent a few weeks dabbling in machine learning, which remains an interesting area to explore though not directly related to my day-to-day work. Although the economics generally work in favor of doing ML in the cloud, there’s something to be said for having all of your code and data local and not having to worry about shutting down virtual hosts all the time. My 10+ year old PC just doesn’t cut it for ML tasks, and so I made a new one.

The main requirements for me are lots of cores (for kernel builds) and a hefty GPU or four (for ML training). For more than two GPUs, you’re looking at AMD Threadrippers; for exactly two you can go with normal AMD or intel processors. The Threadrippers cost about $500 more factoring in the motherboard. I decided that chances of me using more than two GPUs (or even more than one) were pretty darn slim and not worth the premium.

In the end I settled on a 12-core Ryzen 9 3900X with RTX 2070 GPU coming in around $1800 USD with everything. Unfortunately, in this arena everything is marketed to gamers, so I have all kinds of unasked-for bling from militaristic motherboard logos to RGB LEDs in the cooler. Anyway, it works.

Just to make up a couple of CPU benchmarks based on software I care about:

filling a 7x7 word square (single core performance)
real	0m10.689s
user	0m10.534s
sys	0m0.105s

real	0m2.274s
user	0m2.243s
sys	0m0.016s

allmodconfig kernel build
with -j $CORES_TIMES_TWO (multicore performance)
real	165m11.219s
user	455m42.557s
sys	135m37.557s

real	9m31.778s
user	193m31.477s
sys	23m19.117s

This is all with stock clock settings and so on. I haven’t tried ML training yet, but the speedup there would be +inf considering it didn’t work at all on my old box.

Virtual doorbell

We had some cameras installed at our house last year, partly for security, but mainly so we could know who is at the door before answering it in our PJs. Unfortunately, the software that comes with the camera DVR is pretty clunky, so it takes way too long to bring up the feed when the doorbell rings and I often don’t bother.

Luckily, the DVR exposes RTSP streams that you can capture and playback with your favorite mpeg player. And I just learned how to build a pretty good image classifier that needed a practical application.

A ridiculously good-looking person is at the door

Thus, I built an app to tell whether someone is at the door, before they ring the bell. I labeled some 4000 historical images as person or non-person, trained a CNN, and made a quick python app to run inference on the live feed. When a person is in range of the door camera, it aims the lasers tells you so.

Doorbell MVP

Not bad for having two whole weeks of deep learning under my belt. The interface could stand to be much better, of course. A little web page that sends a browser notification and link to the image or live feed would be the obvious next step. Perhaps the lasers are after that.

I know this is something that comes out of the box with commercial offerings such as Ring, but at least my images aren’t being streamed to the local police.


Summer came late and is leaving early this year, so it’s about harvest time now. This year, I did some radishes, onions, salad greens, carrots, green beans, jalapenos, bell peppers, basil, and tomatoes. Most of the carrots didn’t grow long roots, but I got a few. The rabbits got to the peppers and green beans before I did, while leaving the lettuce mostly alone — I realized when I had a dozen full heads that we just don’t eat that much salad, so a lot of it bolted in the end. Now I know what 4-foot tall red lettuce looks like.

Not planted this time were tomatillos, but I had a bunch of vines grow from last year’s seeds anyway. I have been pulling up most of those while keeping one large bush for possible salsa verde in a month or so.

Anyhow, I got enough produce to make a few jars of red salsa (when supplemented with some store-bought locally grown tomatoes), and I didn’t work as hard at it this year as previously, so I’m calling it a win.

In a few weeks I’ll be pulling up all the remaining plants, and trying to get a cover crop started, which is something I didn’t know about until recently.

In other uprooting news: I previously wrote a post about ending my engagement at facebook. I dropped that post, because the reasons aren’t actually very interesting and that bridge has plenty of water under it by now. But the outcome of all of that is that I’ll be starting at Amazon next week, in an actual, real live office. That last part is going to be a bit of a trial: after ten years of working from home, I’m not especially looking forward to commuting downtown, and it will certainly be a stress on the family to rearrange our schedules to accommodate that. But it will be nice to have non-virtual coworkers for a change, and I’m excited about tackling some of the challenges facing my new team.

In which I trained a neural net

The entire sum of my machine learning experience thus far is a couple of courses in grad school, in which I wrote a terrible handwriting recognizer and various half-baked natural language parsers. As luck would have it, I was just a couple of years too early for the Deep Learning revolution — at the time support vector machines were all the rage — so I’ve been watching the advancements of the last few years with equal measures idle interest and bewilderment. Thus, when I recently stumbled across the MOOC, I couldn’t resist following along.

I have to say I really enjoy the approach of “use the tools first, then learn the theory.” In the two days since I started the course, I already built a couple of classifiers and got very good results, much more easily than with my handwriting recognizer of yore.

My first model was trained on 450 baby pictures of my children and achieved 98% accuracy. Surprisingly, the mistakes did not confirm our priors, that Alex and Sam look most similar as babies — instead it tended to confuse them both with Ian. The CNN predicts that I am 80% Alex. Can’t argue with that math.

The second classifier was trained on Pokemon, Transformers, and Jaegers (giant robots from Pacific Rim). This gets about 90% accuracy; not surprisingly, it has a hard time telling apart the robot classes, but has no trouble picking out the Pokemons.

I’m still looking for a practical application, but all in all, it’s a fun use for a GPU.

New Directions in Commandline Editing

Update: I finally isolated this to gnome’s multiple input method support. Shift + Space is bound by default to switch input sources, and it is in whatever the next input method is that unusual things happen. Turn that stuff off in the keyboard shortcuts! Find below the original post about the visible symptoms.

Dear lazyweb,

Where in {bash, readline, gnome terminal, wayland, kernel input} does the following brain damage, newly landed in debian testing, originate?

  • pressing ctrl-u no longer erases to beginning of line, but instead starts unicode entry with a U+ prompt, much like shift-ctrl-u used to do, except the U is upper-cased now
  • hitting slash twice rapidly underlines the first slash (as if to indicate some kind of special entry prompt, but one I’m unfamiliar with and I cannot get it to do anything useful anyhow), and then just eats the second slash and the underline goes away
  • characters typed quickly (mostly spaces) get dropped

This stuff is so hard to google for and it is killing my touch typing. Email me if you know, and I’ll update this accordingly so that maybe google will know next time.

Playing With Flash

I recently picked up one of these $10 CH341A USB flash programmers and a test clip. I didn’t really have any initial plans for that it but thought it might come in useful someday while messing with router bootloaders. This unexpectedly turned out to be a lot of fun so far and not a bad tool for the price.

Rummaging through my parts bin, I found a Winbond 4K SPI flash of unknown provenance, hooked it up, and read out the contents with flashrom. Turns out this was an AMI BIOS that I pulled from some motherboard way back when. Disassembling the BIOS might make a good rainy day exercise.

I tried using chavrprog to program an ATTiny13, which did not work at all. The chip did not appear to respond to any of the SPI commands. Oh well.

On a bricked router I had sitting around, I read the flash directly from the board using the test clip. I happen to remember the confluence of events that lead to me bricking this (writing bootloader to wrong partition), and could finally verify the damage on the flash dump. When I get a free moment, I’ll try bringing it back to life by reflashing a repaired image.

On a different model, unbricked router, reading out the flash on the board didn’t work. Applying power to the flash chip powered up other components on the board, so I’m guessing I’d have to desolder this flash chip in order to read/write it. Maybe worth retrying after spending a few weeks practicing SMT rework.

Planting time

With the terribly cold and gray winter finally starting to abate, I’m going to start my indoor seeds this week. Nearly same setup as last year: I’m sowing the head-start seeds indoors, to go under basement grow lights in a couple of weeks when they have sprouted. A new addition is this heating mat, which I had to laugh at because of the prominently featured cannabis leaves on the package. I wonder just what the distribution of carrot growers to “other” is, now that it’s legal here.

For any curious persons or LEOs reading, no, I’m not planting weed. I’ll be starting basil, tomatoes, peppers, and lettuce in flats, and hopefully it will be warm enough to direct sow carrots and radishes. Beans should come a little later. Can’t wait!