zachinglis (owner)

Forks

Revisions

gist: 143695 Download_button fork
public
Public Clone URL: git://gist.github.com/143695.git
Embed All Files: show embed
Bash #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 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."
}