Created
June 14, 2013 01:41
-
-
Save jesseditson/5778832 to your computer and use it in GitHub Desktop.
Installs 2 utilities - slow, and unslow. Will throttle your unix machine's connection to the internet. Good for testing what your website looks like on a shitty connection.
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 | |
BINEXISTS=`echo $PATH | grep /usr/local/bin` | |
if [ -z $BINEXISTS ] | |
then | |
echo "This script installs slow and unslow to /usr/local/bin, but it is not in your path." | |
echo "Please add /usr/local/bin to your path and run this script again." | |
exit 1 | |
fi | |
if [[ $1 = "uninstall" ]] | |
then | |
echo "uninstalling slow and unslow" | |
rm -f /usr/local/bin/slow /usr/local/bin/unslow | |
exit 0 | |
elif [[ -n "$1" ]] | |
then | |
echo "Unknown option '${1}' passed. Please pass nothing or 'uninstall'." | |
exit 0 | |
fi | |
echo ' | |
#!/bin/bash | |
if [[ `whoami` != "root" ]] | |
then | |
echo "you must be root to slow your connection." | |
exit 1 | |
fi | |
KBPS=$1 | |
if [ -z $KBPS ] | |
then | |
KBPS=750 | |
fi | |
echo "slowing connection to ${KBPS}kbits per second" | |
ipfw pipe 1 config bw ${KBPS}kbit/s plr 0.05 delay 100ms | |
ipfw add pipe 1 dst-port http' > /usr/local/bin/slow | |
chmod 755 /usr/local/bin/slow | |
echo ' | |
#!/bin/bash | |
if [[ `whoami` != "root" ]] | |
then | |
echo "you must be root to unslow your connection." | |
exit 1 | |
fi | |
ipfw flush' > /usr/local/bin/unslow | |
chmod 755 /usr/local/bin/unslow | |
echo "installed slow and unslow. You can now run 'slow' or 'unslow' to throttle your connection." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment