Skip to content

Instantly share code, notes, and snippets.

@zachinglis
Created July 9, 2009 14:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save zachinglis/143695 to your computer and use it in GitHub Desktop.
Save zachinglis/143695 to your computer and use it in GitHub Desktop.
# Make port 80 "real life" speeds
# You can also use Mongrel ports.
function slow_port {
# Set the port variable if no port inputted. Defaulted to 80 (for Passenger).
if [ -z "$1" ]
then port=80
else port=$1
fi
# Slow the ports.
sudo ipfw pipe 1 config bw 15KByte/s
sudo ipfw add 1 pipe 1 src-port $port
sudo ipfw add 1 pipe 1 dst-port $port
echo "Port $port succesfully slowed."
}
function unslow_port {
sudo ipfw delete 1
echo "Port succesfully un-slowed."
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment