Category: Hacking

  • A Few More Thoughts on Literate Programming

    A while back, I became intrigued by Donald Knuth’s idea of Literate Programming, and decided to give it a shot. That first attempt was basically just me writing down what I knew as quickly as I learned it, and trying to pass it off as a knowledgeable tutorial. More recently, I tried a second project, […]

  • Readable Code: Variable Overload

    It’s well known that reading code is a lot harder than writing it. But I recently got some insight as to why that is. I was debugging someone else’s sh script. This one seemed harder to read than most. There was a section that involved figuring out a bunch of dates associated with a particular […]

  • Campaign Manager: Serializing Recursive Objects

    There’s an idea for a game that’s been rattling around my brain for a while, so I finally decided to learn enough Unity to birth it. To get an idea of what I have in mind, think Sid Meier’s Civilization, but for elections: you play a campaign manager, and your job is to get your […]

  • Ansible As Scripting Language

    Ansible is billed as a configuration manager similar to Puppet or cfengine. But it occurred to me recently that it’s really (at least) two things: A configuration manager. A scripting language for the machine room. Mode 1 is the normal, expected one: here’s a description; now make the machine(s) look like the description. Same as […]

  • Pseudo-Numeric Identifiers

    Let’s say you’re a programmer, and your application uses Library of Congress Control Numbers for books, e.g., 2001012345, or ZIP codes, like 90210. What data types would you use to represent them? Or maybe something like the Dewey Decimal System, which uses 320 to classify a book as Political Science, 320.5 for Political Theory, and 320.973 for […]

  • Programming Tip: Open and Close at the Same Time

    One useful programming habit I picked up at some point is: if you open or start something, immediately close it or end it. If you open a bracket, immediately write its closing bracket. If you open a file, immediately write the code to close it. These days, development environments take care of the niggling little […]

  • If You Use Unix, Use Version Control

    If you’ve used Unix (or Linux. This applies to Linux, and MacOS X, and probably various flavors of Windows as well), you’ve no doubt found yourself editing configuration files with a text editor. This is especially true if you’ve been administering a machine, either professionally or because you got roped into doing it. And if […]

  • There Are Days When I Hate XML

    …and days when I really hate XML. In this case, I have an XML document like <?xml version=”1.0″ ?> <foo xmlns=”http://some.org/foo”> <thing id=”first”/> <thing id=”second”/> <thing id=”third”/> </foo> and I want to get things out of it with XPath. But I couldn’t manage to select things exactly, such as the <foo> element at the top. […]

  • DD-WRT Config Backups

    So the other day I managed to hose my DD-WRT configuration at home, badly enough that I figured I really ought to back up my config so I don’t wind up trying to reconstruct my config from memory. (If you just want to see the script, you can jump ahead.) I have nightly backups of […]

  • I Don’t Want Flying Cars; I Just Want Working Bluetooth

    I love Bluetooth. I love that it’s supported on all my various electronic gadgets, and lets them talk to each other and exchange information, be it streaming audio data, or a text note, or what have you. Or at least I love the idea of Bluetooth. The unfortunate reality is that the implementations that I’ve seen […]