Format JSON documents on the command line

August 31st, 2012 by exhuma.twn

I tend to test my REST services using curl. Most of the time the JSON responses are not pretty-printed, which makes testing larger documents a pain. Copy pasting the results in online JSON formatters was really getting annoying. So I wrote a few lines of python to do that job for me. Note that this is a two-minute-hack and by no means very generic. It works for me, and with curl. The handling for Headers is especially eerie 😛 But maybe you will still find it useful.

Without further ado, here it is:


pip install jsonf


easy_install jsonf


Posted in Uncategorized | No Comments »

Update to bash completion for fabric tasks.

August 20th, 2012 by exhuma.twn

In a previous post I’d shown a way to enable bash-completion for fabric tasks.

With later revisions of fabric, you can now organise tasks in submodules. The new update takes this into account.

Posted in Uncategorized | No Comments »

Specifying “externs” using

August 13th, 2012 by exhuma.twn

The last hour or so I have been struggling with an “extern” definition using When running the compiler manually, you specify externs like this:

  java -jar compiler.jar [...] --externs myexterns.js

So, naturally, my command looked like this: [...] --compiler_flags="--externs myexterns.js"

However, this resulted in the following error:

  "--externs myexterns.js" is not a valid option

My next step was to verify this by running the compiler manually. And it worked. So, without a doubt, it had something to do with Suspecting a bug, I updated to the latest SVN revision. No luck. Still getting the same error.

So I dug into the code of closurebuilder, and the problem was obvious:

Each additional command-line flag --compiler_flags gets appended to a list. This list is then used as-is in the subprocess call. The subprocess API however expects each argument as a new item in the list. And technically --externs myexterns.js are two arguments. The first is --externs, the second is myexterns.js. The usual --compiler_flags="--compilation_level=ADVANCED_OPTIMIZATIONS" works because it is considered as one argument (it does not contain white-space).

So to get it working properly, you will have to modify the above line to the following: [...] --compiler_flags="--externs" --compiler_flags="myexterns.js"

Whether it makes sense to fix this inside is debatable. The arguments need to be passed as a list for security reasons (to be able to do proper shell escaping). Personally I don’t care that I have to specify my compiler flags in this wonky fashion. It’s in a makefile afterall…

Posted in Uncategorized | No Comments »

Clarification about MANIFEST changes in the packaging guide.

May 27th, 2012 by exhuma.twn

Just today I needed to remove files from a package. And I realised that I forgot to mention that removing files from the files has a small gotcha… Here’s the small note I added to the original article:

When running the setup script, it will create a folder with the extension .egg-info. If you make changes to your file, you should delete this folder. It contains a file named SOURCES.txt which contains all the file in the package. If you remove files from your manifest, the will only disappear when that file is changes as well. So the easiest way is to delete the egg-info folder and let the setup script re-create it!

Posted in Uncategorized | No Comments »

Update to the python packaging guide.

May 19th, 2012 by exhuma.twn

Following some of the comments, the previous article about python packaging has been updated.

  • Added a note about pip install -e as an alternative to python develop
  • Added a note about
  • Fixed the section about the manifest (I forgot to add include_package_data to the setup script)

Posted in Uncategorized | No Comments »


April 20th, 2012 by exhuma.twn

Yesterday evening I enabled comments on This should make commenting easier and more accessible in the future.

Existing comments have been put into the the disqus importer queue, and according to them, they should appear after 24 hours. So nothing is lost!

Posted in Uncategorized | 1 Comment »

Bogged down in spam

August 22nd, 2008 by exhuma.twn

I just realized that we’ve got plenty of spam comments in our moderation queue. I did my best to clean it up. I appologize if any comments were lost in the process.

At least now We’ve got a nice collection of links to sites where I can buy cheap viagra, find adult friends, and even buy some designer luis vuitton purses! Good stuff….. -__-

Posted in Uncategorized | No Comments »


Recent Posts