Skip to content

Instantly share code, notes, and snippets.

@vreon
Created March 18, 2011 01:16
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save vreon/875467 to your computer and use it in GitHub Desktop.
Save vreon/875467 to your computer and use it in GitHub Desktop.
Cheesy script to encourage productivity by blocking time sinks at the DNS level
#!/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