Skip to content

Instantly share code, notes, and snippets.

@marianposaceanu
Last active December 19, 2015 16:28
Show Gist options
  • Save marianposaceanu/5983435 to your computer and use it in GitHub Desktop.
Save marianposaceanu/5983435 to your computer and use it in GitHub Desktop.

Ruby one liners for fun and profit

pretty JSON print

version 1
curl -L "http://goo.gl/PohSd" | ruby -e "require 'pp'; require 'json'; j=gets(nil); pp JSON.parse(j)"
version 2
curl -L "http://goo.gl/PohSd" | ruby -e "%w(json pp).each(&method(:require));pp(JSON.parse(gets(nil)))"
version p (python)
curl -L "http://goo.gl/PohSd" | python -mjson.tool
version 3 with prettify_json.rb
curl -L "http://goo.gl/PohSd" | prettify_json.rb
links :
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment