Skip to content

Instantly share code, notes, and snippets.

@danshearmur
Last active December 30, 2015 03:19
Show Gist options
  • Save danshearmur/7768334 to your computer and use it in GitHub Desktop.
Save danshearmur/7768334 to your computer and use it in GitHub Desktop.
Test domain length with gzip
#!/bin/bash
function generate {
rm $2 2> /dev/null
for i in {1..150}
do
echo "<img src=\"$1image-$i.jpg\" />" >> $2
done
}
function zip {
gzip --best -f -c -- "$1" > "$1.gz"
}
function size {
wc -c $1
}
function process {
generate $1 $2
zip $2
size $2.gz
}
LONG=http://some.really.long.domanin.name/assets/images/
SHORT=http://short.io/i/
LONG_FILE=long.html
SHORT_FILE=short.html
process $LONG $LONG_FILE
process $SHORT $SHORT_FILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment