What's black, white, and red all over?


HTML Reference Docs

This html version of the C standard is cool. It's converted from a pdf by a script, which is probably a reasonably useful technique. There are also html references for x86 and aarch64 instruction which are both nicer to use than their official counterparts (check out this vs this for example). All of these have saved me time and mental anguish.

I've done some of this myself using pdftotext. You can't really parse the output, but there will be consistent patterns, so you can write something like "lines 300-325 is a list" and get html that way. It's hard to completely automate it, but you can reduce data entry to manageable amounts this way, while still having fine-grained control for weird parts.

I've got a couple of projects converting unstructured data to html, and I'll write a longer guide on how to do it once I'm finished.

Gotta Go Fast

https://en.algorithmica.org/hpc/ hosts "Algorithms for Modern Hardware", an "an upcoming high performance computing book [...] by Sergey Slotin". I found it while looking for material on optimising matrix multiplication, since mathematical software is so much faster than just writing the formula into a program. While the book itself is incomplete, it looks like that only means that some sections haven't been written yet. The existing sections are perfectly well fleshed out and definitely useful.

While I'm at it I'll also link "Is Parallel Programming Hard, And, If So, What Can You Do About It?" by Paul E. McKenny. It's very readable — I'd almost call it light reading. It never feels like anything is made more complicated than it has to be, which is a welcome relief compared to some other material. If you've ever wondered "why couldn't the author just have said that?" after understanding a simple idea underlying some complicated prose, you'll be happy to receive the simple idea directly for once.


I've been using lxml for a few things on this site, which has been going well. I'm mostly using interfaces from lxml.etree, namely the ElementTree and Element classes, along with the E-constructor from lxml.builder.

  • You can parse your XML document into an ElementTree with etree.ElementTree(etree.fromstring(doc)).
  • You can construct elements with the E-constructor, for example E("span", "your text here") will correspond to <span>your text here</span>. The examples in the documentation are good, so I won't dwell on this. You can also access the element's data via the corresponding attribute, for example .tag or .text.
  • You can search for elements with a given tag using the .find() or .iter() methods on your tree. Once you have a matching element, you can use methods like .append(), .addnext(), or .replace() to add a new element into the document.

This section of documentation explains the rules for matching tags, which apply to other methods like .find() as well. There are other things you can do with lxml, and other things you can do with the parts of it I've listed, but this was what I needed to do what I wanted.


the last layer of a Rubik's cube


There are a lot of people hosting images of last-layer cases via flaky sites rather than just generating image files, so I made one that works locally and designed a better template while I was at it. This page has some examples of PLL and OLL algs and some usage advice since you probably want to call it from another program that generates the sheet.

a glider from Conway's game of life

The Education of a Programmer

The other day, someone asked me to teach them programming. I didn't agree to do that, since I didn't know them, I was already at maximum capacity dealing with more important things, and probably couldn't help them anyway. Why did that happen? What's so hard about learning programming that people resort to asking random people like that? What's so hard about teaching it that I didn't think I could convey what knowledge and skills I do have effectively?

a 5 by 5 grid of squares, with the outer 16 squares highlighted red

Counting Squares with Mathematical Tricks

If you take a shortcut in some kind of process, then usually that exploits some kind of mathematical structure, which is often worth investigating. This time we're counting squares, and then cubes, and potentially more, with possibly interesting results.

the wayland logo with a red background


Every now and then (though especially now) I see people arguing about X vs Wayland. I don't particularly care if people prefer one or the other, but a lot of the things people say about Wayland are wrong, or at least give an incorrect impression through omission, confusing terminology, or otherwise. Since those impressions can cause concrete problems, this is my attempt to clarify things.