Skip to content

Instantly share code, notes, and snippets.

@andersonfreitas
Created October 3, 2012 21:38
Show Gist options
  • Save andersonfreitas/3830035 to your computer and use it in GitHub Desktop.
Save andersonfreitas/3830035 to your computer and use it in GitHub Desktop.
blocking distractions
function block() {
if ! [ "$1" = "" ] ; then
case $1 in
on)
sudo ipfw add 7890 deny ip from news.ycombinator.com to any
sudo -s "echo '127.0.0.1 facebook.com' >> /etc/hosts"
sudo -s "echo '127.0.0.1 www.facebook.com' >> /etc/hosts"
;;
off)
sudo ipfw del 7890
sudo sed -i'.bak' '/.*facebook.com/d' /etc/hosts
;;
esac
else
echo "Usage: block [on|off]"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment