Other articles

  1. Git blame for better diffs

    When reviewing a pull request against nameko today there was a chunk of code moved from a function into a method, though oterwise mostly unchanged. Unfortunately, it also moved around in the file, and so even git diff -w (abbreviation for git diff --ignore-all-space), ignoring all whitespace showed everything as …

    read more
  2. Strace to the rescue

    Recently I was debugging a strange error when using the eventlet support in the new the new coverage 4.0 alpha. The issue manifested itself as a network connection problem: Name or service not known. This was confusing, since the host it was trying to connect to was localhost. How …

    read more
  3. Show git branches with recent changes

    As I work on various projects, I tend to end up with a bunch of git branches lying around in my repo. Every once in a while, I run a git branch --merged on master to see what can be trivially trimmed, but sometimes the list of unmerged branches grows …

    read more
  4. Custom redirects in the django admin

    On one of my sites i have a bunch of different models for various content resources, e.g. articles, videos and podcasts. For admins I wanted to add an "edit this item" link to the menu when browsing the site. Pretty easy: check permissions and add a link to the …

    read more
  5. There's no such thing as a trivial change

    Often when developing it's easy to let "trivial" edits just slip in without having to jump through all the hoops we put "more serious" patches through. Be this a code-review, running the test suite or any other means of checking over our code: nothing is too small to matter.

    A …

    read more
  6. Dynamically creating django models for m2m relationships

    Occasionally when using a django ManyToManyField I find myself wanting to query the join table directly. Consider for example the models below:

    class Category(models.Model):
        name = models.TextField()
    class Entry(models.Model):
        data = models.TextField()
        categories = models.ManyToManyField(Category)

    Suppose I have an entry, and want to find entries …

    read more
  7. Puppet requirement chains and partially satisfied conditions

    At work we use (among other things) puppet to manage our server configurations. For those uninitiated, puppet provides a dsl for specifying server configurations. I won't go into details here, there are plenty of resources elsewhere.

    Puppet works by specifying Resources, describing the desired state of the system. The provisioning …

    read more
  8. Changing keyboard shortcuts in osx

    Sat 28 April 2012

    tags: osx

    I use iterm2 as my terminal, and to navigate between tabs, I use cmd-shift-{ and }. Not infrequently, I mistap and hit cmd-shift-p instead, which launches the page setup dialog (and in doing so, freezes for a second or so). Now, I rarely (never?) actually need this functionality, and to my …

    read more
  9. Automating save-build-refresh on os x

    This blog is powered by Pelican. When I first started out, I was composing in vim, switching over to a terminal to build, and finally to my browser to preview the result. Clearly this becomes tedious pretty quickly.

    I was already familiar with tools to watch folders for changes and …

    read more
  10. Introspecting django urls for fun and profit

    One of the projects I work on has a fairly large and old code base, and is unfortunately somewhat lacking in the test suite department. We are working to improve this, but in the medium term we are stuck with a fair amount of manual testing.

    As part of some …

    read more
  11. Git case gotcha on os x

    Sat 10 March 2012

    tags: git osx

    Found myself caught by a gotcha using git on os x today. The issue is the way os x (hfs+) handles letter case in file names. File names are case insensitive, which means that File and file are considered to be the same file.

    To see this in action, create …

    read more
  12. Remove "tweet" from os x context menu

    Sun 04 March 2012

    tags: osx

    I rarely (read: never) want to tweet when I right click to bring up a context menu. Actually, most of the time, I'm just looking for "Inspect Element" in Chrome. I was happily surprised to find I could remove the option entirely:

    1. Open System Preferences
    2. Choose "Keyboard"
    3. Choose the "Keyboard …
    read more
  13. Time to start blogging?

    Sat 03 March 2012

    Have been thinking about starting to blog for a while. I think the vague plan is to write about code. Mostly notes-to-self a la "How did I get that thing to work again?", but if any of this could be useful to others, all the better. We'll see where this …

    read more