Created
October 3, 2012 21:38
-
-
Save andersonfreitas/3830035 to your computer and use it in GitHub Desktop.
blocking distractions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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