Skip to content

Instantly share code, notes, and snippets.

@fallengiants
Created March 16, 2012 20:40
Show Gist options
  • Select an option

  • Save fallengiants/2052529 to your computer and use it in GitHub Desktop.

Select an option

Save fallengiants/2052529 to your computer and use it in GitHub Desktop.
Mac OS Traffic Simulator
#!/bin/bash
if [$(ipfw show | grep 'pipe 1' | wc -l) -lt 1 ];
then
echo "Slowing down network, bro"
ipfw add pipe 1 all from any to any
ipfw pipe 1 config bw 300Kbit/s delay 400ms
else
echo "Speeding things up again, boss"
ipfw show | grep 'pipe 1' | awk '{print $1;}' | awk '{gsub(/^0+/, "")}; 1' | xargs ipfw delete
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment