Skip to content

Instantly share code, notes, and snippets.

@jdewind
Created April 14, 2011 16:28
Show Gist options
  • Save jdewind/919851 to your computer and use it in GitHub Desktop.
Save jdewind/919851 to your computer and use it in GitHub Desktop.
slow_connection () {
if [ -z $1 ]; then
echo "Bandwidth must be provided"
return
fi
default_port="80"
sudo ipfw pipe 1 config bw $1KByte/s
sudo ipfw add 1 pipe 1 src-port ${2:-$default_port}
}
edge_connection() {
slow_connection 56 $1
}
3g_connection() {
slow_connection 200 $1
}
alias restore_connection="sudo ipfw delete 1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment