Last active
December 30, 2015 03:19
-
-
Save danshearmur/7768334 to your computer and use it in GitHub Desktop.
Test domain length with gzip
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*html* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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