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: https://github.com/exhuma/braindump/tree/master/jsonformat

Installation

pip install jsonf

or

easy_install jsonf

Screenshot

Posted in Uncategorized | No Comments »

Update to bash completion for fabric tasks.

August 20th, 2012 by exhuma.twn
cURL error 28: Connection timed out after 5001 milliseconds
Fatal error: Uncaught Error: Cannot use object of type WP_Error as array in /var/www/foobar.lu/www/htdocs/wp/wp-content/plugins/embed-github-gist/embed-github-gist.php:86 Stack trace: #0 /var/www/foobar.lu/www/htdocs/wp/wp-content/plugins/embed-github-gist/embed-github-gist.php(164): embed_github_gist('2136677', NULL, '1', NULL) #1 /var/www/foobar.lu/www/htdocs/wp/wp-includes/shortcodes.php(325): handle_embed_github_gist_shortcode(Array, '', 'gist') #2 [internal function]: do_shortcode_tag(Array) #3 /var/www/foobar.lu/www/htdocs/wp/wp-includes/shortcodes.php(199): preg_replace_callback('/\\[(\\[?)(gist)(...', 'do_shortcode_ta...', '<p>In a <a href...') #4 /var/www/foobar.lu/www/htdocs/wp/wp-includes/class-wp-hook.php(286): do_shortcode('<p>In a <a href...') #5 /var/www/foobar.lu/www/htdocs/wp/wp-includes/plugin.php(208): WP_Hook->apply_filters('<p>In a <a href...', Array) #6 /var/www/foobar.lu/www/htdocs/wp/wp-includes/post-template.php(247): apply_filters('the_content', 'In a <a href="h...') #7 /var/www/foobar.lu/www/htd in /var/www/foobar.lu/www/htdocs/wp/wp-content/plugins/embed-github-gist/embed-github-gist.php on line 86