diff --git a/shell/aliases.sh b/shell/aliases.sh index 3a76962..a0c66d7 100644 --- a/shell/aliases.sh +++ b/shell/aliases.sh @@ -35,3 +35,5 @@ alias webshare='python -c "import SimpleHTTPServer;SimpleHTTPServer.test()"' alias pubkey="cat $HOME/.ssh/*.pub" alias colorslist="set | egrep 'COLOR_\w*'" # lists all the colors + +alias jsonify='python -mjson.tool' diff --git a/shell/functions.sh b/shell/functions.sh index 2afaf92..49c6ff2 100644 --- a/shell/functions.sh +++ b/shell/functions.sh @@ -66,3 +66,19 @@ function command_not_found_handle() { command_not_found_handler $* return $? } + +function json() { + tmpfile=`mktemp -t json` + curl -s $* | python -mjson.tool > $tmpfile + cat $tmpfile + cat $tmpfile | pbcopy + rm $tmpfile +} + +function xml() { + tmpfile=`mktemp -t xml` + curl -s $* | xmllint —format - > $tmpfile + cat $tmpfile + cat $tmpfile | pbcopy + rm $tmpfile +}