aboutsummaryrefslogtreecommitdiffstats
path: root/.functions
diff options
context:
space:
mode:
authorMathias Bynens <mathias@qiwi.be>2011-09-29 08:10:55 +0300
committerMathias Bynens <mathias@qiwi.be>2011-09-29 08:10:55 +0300
commit6117c55c10703fdcbc19719bc1dcff9f4c5c2379 (patch)
tree44a48c056f7190b5eb29c44b2e8041c3af07ff39 /.functions
parentacfce9eda5a99c7cd3c057bfe7122dad865ca97c (diff)
downloaddotfiles-6117c55c10703fdcbc19719bc1dcff9f4c5c2379.tar.gz
dotfiles-6117c55c10703fdcbc19719bc1dcff9f4c5c2379.tar.bz2
dotfiles-6117c55c10703fdcbc19719bc1dcff9f4c5c2379.zip
Add `json` function. Example usage: `json http://fronteers.nl/congres/2011/attendees.json`
Diffstat (limited to '.functions')
-rw-r--r--.functions10
1 files changed, 7 insertions, 3 deletions
diff --git a/.functions b/.functions
index 69cb034..62b69ef 100644
--- a/.functions
+++ b/.functions
@@ -1,15 +1,19 @@
# Create a new directory and enter it
-md() {
+function md() {
mkdir -p "$@" && cd "$@"
}
# Test if HTTP compression (RFC 2616 + SDCH) is enabled for a given URL.
# Send a fake UA string for sites that sniff it instead of using the Accept-Encoding header. (Looking at you, ajax.googleapis.com!)
-httpcompression() {
+function httpcompression() {
encoding="$(curl -LIs -H 'User-Agent: Mozilla/5 Gecko' -H 'Accept-Encoding: gzip,deflate,compress,sdch' "$1" | grep '^Content-Encoding:')" && echo "$1 is encoded using ${encoding#* }" || echo "$1 is not using any encoding"
}
+function json() {
+ curl "$*" | python -mjson.tool | pygmentize -l javascript
+}
+
# All the dig info
-digga() {
+function digga() {
dig +nocmd "$1" any +multiline +noall +answer
} \ No newline at end of file