Skip to content

Instantly share code, notes, and snippets.

@toddself
Created January 22, 2015 17:01
Show Gist options
  • Save toddself/cb3d9d05f49ec58231c7 to your computer and use it in GitHub Desktop.
Save toddself/cb3d9d05f49ec58231c7 to your computer and use it in GitHub Desktop.
shitty wifi
#!/bin/bash
while true; do
trap "exit 0" SIGINT
CEIL=10
timeout=0
ip link show eth0 | grep UP > /dev/null
ISUP=$?
let "timeout = $RANDOM % $CEIL + 1"
if [ $ISUP -eq 0 ]; then
echo "eth0 is up, bringing down"
sudo ifconfig eth0 down
sleep $timeout
else
echo "eth0 is down, bringing up"
sudo ifconfig eth0 up
sleep $timeout
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment