The earliest memory I have of ‘programming’ is in the early/mid 90s when my father brought home a computer from work. We could play games on it … so of course I took the spreadsheet program he used (LOTUS 123, did I date myself with that?) and tried to modify it to print out a helpful message for him. It … halfway worked? At least I could undo it so he could get back to work…

After that, I picked up programming for real in QBASIC (I still have a few of those programs lying around), got my own (junky) Linux desktop from my cousin, tried to learn VBasic (without a Windows machine), and eventually made it to high school… In college, I studied computer science and mathematics, mostly programming in Java/.NET, although with a bit of everything in the mix. A few of my oldest programming posts on this blog are from that time.

After that, on to grad school! Originally, I was going to study computational linguistics, but that fell through. Then programming languages (the school’s specialty). And finally I ended up studying censorship and computer security. That’s about where I am today!

But really, I still have a habit of doing a little bit of everything. Whatever seems interesting at the time!

Ensuring docker-machine is running

When developing using docker on OS X, you’ll currently1 have to use docker-machine to spin up a virtual machine that is actually running the docker containers. Running a virtual machine takes up a bit more in the way of resources than just the docker containers, so if you’re not actually developing at the moment, it’s helpful to be able to start up the virtual machine only when you need it.

The current way I have to do that:

$ docker-machine start default
$ eval $(docker-machine env default)

What’s worse, the latter command has to be run for every shell that you start up. It’s by no means a hard pair of commands and you could easily wrap them in an alias or put them in your .profile equivalent (which is what I used to do). But unfortunately, I found a completely unrelated bug in tmuxp: if the shell takes too long to start up, tmuxp essentially won’t work. The above eval command took long enough to hit this limit.

read more...


Audiobooks to Podcasts

I’ve recently started to listen to audiobooks again (The Aeronaut’s Windlass). If you buy books through Audible or some other setup that has their own app, it’s a straight forward enough process. On the other hand, if you have them on CD and want to play them on a mobile device… It’s a little more interesting.

I tried a few different apps that purport to do exactly what I wanted: import an audiobook as a folder full of MP3s and play them, but none that quite meet what I wanted. Since I also listen to a lot of podcasts and have more than one podcast app that I really like (I’ve used and liked both Downcast and Pocket Casts), I decided to see if I couldn’t use one of those as an audiobook player.

read more...


Duplicating AeroSnap on OSX with Hammerspoon

Relatively recently, I switched my last Windows machine over to OSX. For the most part, it’s been great. One bit of functionality that I’ve been missing though is AeroSnap. Specifically the ability to use a keyboard shortcut to move windows to the left/right half of a monitor.

read more...


Command line unicode search

Similar to Monday’s post about command line emoji search, I often find myself wanting to look up Unicode characters. I have a custom search engine / bookmark set up in Chrome / Firefox (uni %s maps to http://unicode-search.net/unicode-namesearch.pl?term=%s&.submit=Submit&subs=1). That actually works great, but given how relatively much of my day I spend on the command line, I thought it would be interesting to do something there:

$ uni delta
⍋	apl functional symbol delta stile
⍙	apl functional symbol delta underbar
⍍	apl functional symbol quad delta
≜	delta equal to
Δ	greek capital letter delta
δ	greek small letter delta
ẟ	latin small letter delta
ƍ	latin small letter turned delta
𝚫	mathematical bold capital delta
𝜟	mathematical bold italic capital delta
𝜹	mathematical bold italic small delta
𝛅	mathematical bold small delta
𝛥	mathematical italic capital delta
𝛿	mathematical italic small delta
𝝙	mathematical sans-serif bold capital delta
𝞓	mathematical sans-serif bold italic capital delta
𝞭	mathematical sans-serif bold italic small delta
𝝳	mathematical sans-serif bold small delta
ᵟ	modifier letter small delta

read more...


Command line emoji search

Sometimes, I find myself wanting to communicate in emoji.

🐔

How about this:

$ emoji chicken
🐔

$ emoji "which came first, the 🐔 or the 🥚"
which came first, the 🐔 or the 🍳

read more...


Inlining plaintext attachments in Gmail

When you send a text message to a Gmail email address (at least from an iPhone using AT&T), you get something like this:

It’s vaguely annoying to have to click through every single time just to see what the message is, especially when various extensions (such as uMatrix) break overlay rendering or when you have multiple attachments.

Much better would be to just display the plaintext attachments inline:

read more...


Advent of Code: Day 24

Source

Part 1: Split a list of integers into three groups of equal sum. Find the grouping such that the smallest group has the least items, breaking ties by the smallest product for that group.

read more...


Advent of Code: Day 23

Source

Part 1: Create a simple virtual machine with two registers (a and b, non-negative integers) and six instructions:

  • hlf (a|b) - divide the given register by half, round down
  • tpl (a|b) - triple the given register
  • inc (a|b) - add 1 to the given register
  • jmp [+-]\d+ - jump forward/backwards by the given number of instructions
  • jie (a|b), [+-]\d+ - if the given register is even, jump
  • jio (a|b), [+-]\d+ - if the given register equals one, jump

read more...