diff options
author | Paul Irish <paul.irish@gmail.com> | 2012-05-31 20:09:28 +0200 |
---|---|---|
committer | Mathias Bynens <mathias@qiwi.be> | 2012-05-31 20:10:05 +0200 |
commit | a9942ac635f1f55c2c585e9d256419a48c2ba5ee (patch) | |
tree | 89743c1c73cf8ac1ed5f3ed59ae1b8d6b3edcf45 /.functions | |
parent | 9d618bae3ad4aabaa9530e0b5c884dfafcf7cc1d (diff) | |
download | dotfiles-a9942ac635f1f55c2c585e9d256419a48c2ba5ee.tar.gz dotfiles-a9942ac635f1f55c2c585e9d256419a48c2ba5ee.tar.bz2 dotfiles-a9942ac635f1f55c2c585e9d256419a48c2ba5ee.zip |
.functions: Add `gz` function to get gzipped file size
Diffstat (limited to '.functions')
-rw-r--r-- | .functions | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -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() { |