aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Irish <paul.irish@gmail.com>2012-05-31 20:09:28 +0200
committerMathias Bynens <mathias@qiwi.be>2012-05-31 20:10:05 +0200
commita9942ac635f1f55c2c585e9d256419a48c2ba5ee (patch)
tree89743c1c73cf8ac1ed5f3ed59ae1b8d6b3edcf45
parent9d618bae3ad4aabaa9530e0b5c884dfafcf7cc1d (diff)
downloaddotfiles-a9942ac635f1f55c2c585e9d256419a48c2ba5ee.tar.gz
dotfiles-a9942ac635f1f55c2c585e9d256419a48c2ba5ee.tar.bz2
dotfiles-a9942ac635f1f55c2c585e9d256419a48c2ba5ee.zip
.functions: Add `gz` function to get gzipped file size
-rw-r--r--.functions8
1 files changed, 8 insertions, 0 deletions
diff --git a/.functions b/.functions
index b9ec9dd..1754c93 100644
--- a/.functions
+++ b/.functions
@@ -25,6 +25,14 @@ function server() {
python -c $'import SimpleHTTPServer;\nmap = SimpleHTTPServer.SimpleHTTPRequestHandler.extensions_map;\nmap[""] = "text/plain";\nfor key, value in map.items():\n\tmap[key] = value + ";charset=UTF-8";\nSimpleHTTPServer.test();' "$port"
}
+# Get gzipped file size
+function gz() {
+ echo "orig size (bytes): "
+ cat "$1" | wc -c
+ echo "gzipped size (bytes): "
+ gzip -c "$1" | wc -c
+}
+
# 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!)
function httpcompression() {