Skip to content

Instantly share code, notes, and snippets.

@zacechola
Forked from vreon/distractions.sh
Created April 8, 2011 17:47
Show Gist options
  • Save zacechola/910356 to your computer and use it in GitHub Desktop.
Save zacechola/910356 to your computer and use it in GitHub Desktop.
#!/bin/bash
function usage {
echo "Usage: distractions [on/off]"
exit
}
if [ $# -eq 0 ]; then
usage
fi
if [ $1 = "off" ]; then
sudo sed -i '/^#-d-/,/^#-d-/ { /^#-d-/b; s/^# // }' /etc/hosts
elif [ $1 = "on" ]; then
sudo sed -i '/^#-d-/,/^#-d-/ { /^#-d-/b; s/^/# / }' /etc/hosts
else
usage
fi
127.0.1.1 mymachine
#-d- Productivity mode blacklist
# 0.0.0.0 reddit.com
# 0.0.0.0 www.reddit.com
# 0.0.0.0 news.ycombinator.com
# 0.0.0.0 facebook.com
# 0.0.0.0 www.facebook.com
# 0.0.0.0 twitter.com
# 0.0.0.0 www.twitter.com
# 0.0.0.0 reader.google.com
# 0.0.0.0 minecraft.net
# 0.0.0.0 www.minecraft.net
# 0.0.0.0 minecraftforum.net
# 0.0.0.0 www.minecraftforum.net
#-d- End productivity mode blacklist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment