If you want to learn about Nix, I wrote a series of posts called How to Learn Nix, and– oh, what’s this? It’s exactly what you’ve been looking for this whole time?

Or perhaps I could interest you in tonight’s special:

December 2, 2021

A Binary Musical Instrument

I had an idea that I wanted to try, so I tried it. You can try it too, by clicking below. Unless you’re on your phone. You can’t really try it on your phone. It needs a physical keyboard.

Hold the keys on the home row to change the pitch, and hold spacebar to play the currently selected note. You can also change the oscillator waveform, but it’s not going to win any awards for its sound synthesis.

It’s not going to win any awards as anything, really. It’s not a very good instrument!

So let’s talk about the problems, and see if we can do anything to improve them.

Keep reading…

Or perhaps a discriminating reader like yourself would prefer some of our more popular posts? The sommelier would like to recommend:

September 21, 2021

A different kind of keyboard

A photograph of an iPhone laying face-down on a wooden table. There is a small keyboard attached to the back of it, with eight keys arranged in a two by four grid.

I’ve always been attracted to chording keyboards in theory, but I lack whatever childhood musical training is required to wrap my fingers around them.

So I made something else: an arpeggio keyboard.

Peggi is an eight-key keyboard that fits on the back of your phone. While chording keyboards require you to press multiple keys at the same time, arpeggio keyboards only ask that you type multiple keys in sequence.

Keep reading…
April 1, 2021

tmux lets you select and copy text with your keyboard

Look, you already know that tmux lets you split your terminals or whatever. You know it lets you maintain remote sessions like a supercharged nohup. Neither of these features are very interesting, if you’re using a modern terminal emulator (or a tiling window manager) and doing your development locally.

So you’ve never tried tmux. People raved about it, but you didn’t listen: you’re not in the target audience. tmux is not for you.

I am projecting, obviously: that was my impression of tmux, a few years ago. Before I tried it. Before I learned how wrong I was.

Keep reading…
March 21, 2021

Getting Drunk with Datalog

Given the contents of my bar:

$ cat facts/bar
brandy
dry vermouth
lemon
light rum
lime
orange liqueur
reposado tequila
sugar

And my cocktail recipe book:

$ head facts/recipes
martini <- london dry gin
martini <- dry vermouth
daiquiri <- light rum
daiquiri <- lime juice
daiquiri <- simple syrup
margarita <- blanco tequila or reposado tequila
margarita <- lime juice
margarita <- orange liqueur
margarita <- lime wedge
...

What cocktails can I mix?

$ cat results/mixable
daiquiri
margarita
sidecar

Gosh, that’s not very many. What could I add to my bar to expand my options?

$ cat results/shopping-list
london dry gin -> gimlet
london dry gin -> martini
champagne -> airmail
cognac -> between-the-sheets
sherry -> sherry-cobbler
rhum agricole -> ti-punch
Keep reading…
March 14, 2021

sd: my script directory

~/sd is my script directory. It looks like this:

$ tree ~/sd
/Users/ian/sd
β”œβ”€β”€ blog
β”‚   β”œβ”€β”€ preview
β”‚   └── publish
β”œβ”€β”€ book
β”‚   β”œβ”€β”€ open
β”‚   β”œβ”€β”€ pdf
β”‚   β”œβ”€β”€ progress
β”‚   └── typeset
β”œβ”€β”€ cat
β”œβ”€β”€ dim
β”‚   └── visualize
β”œβ”€β”€ edit
β”œβ”€β”€ git
β”‚   └── ugh
β”œβ”€β”€ help
β”œβ”€β”€ new
β”œβ”€β”€ nix
β”‚   β”œβ”€β”€ diff
β”‚   β”œβ”€β”€ info
β”‚   └── sync
β”œβ”€β”€ tmux
β”‚   β”œβ”€β”€ init
β”‚   └── restore
└── which

sd is a command on my PATH. It dispatches its arguments to my script directory.

$ sd blog publish

Will run the script ~/sd/blog/publish.

This sounds like a dumb way to save myself having to type a few characters. Which it is. But it’s also slightly more than that:

Keep reading…
January 17, 2015

Decoding UTF-8 with Parser Combinators

We all know the absolute minimum every software developer must know about Unicode. We aren’t bad citizens of the internet, spreading malice and encoding errors willy-nilly around the world. We’re good people, just trying to get by.

But knowing the minimum is starting to bother us. And the more we think about UTF-8 and text encoding, the more we realize that we don’t “get it” at a messy, squishy level. We’ve read about it, sure, but we’ve never actually wrapped our hands around it and felt the blood pump through its veins.

So that’s what we’re going to do in this post: grab UTF-8 by the bytes and squeeze some real understanding out of it.

Keep reading…
May 4, 2014

If KVO is right, why does it feel so wrong?

Let’s do something extremely simple:

We’ve got a view controller, it has a user, the user’s got a username, and we want to show that in our navbar title. With an @ in front, because that’s what all the cool kids do these days. Simple, right?

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = [NSString stringWithFormat:@"@%@", self.user.username];
}

Yep! That’s all it takes. As long as the username never changes.

Keep reading…