Live data from Hacker News

Command line tool for blocking sites to be more productive

github.com

1–10 of 28 posts

Re: Command line tool for blocking sites to be more productive

#3
I prefer the /etc/hosts hack, putting in entries like `127.0.0.1 twitter.com`. That way, when I actually want to visit Twitter, I have to `sudo vim /etc/hosts`, enter my password, comment out the host entry, save, go to Twitter, and then uncomment the entry, save and quit when I'm ready to block it again.

The inconvenience of the action is what makes it work. If I only had to type `workmode stop` I'd have that committed to muscle memory by the end of a work day or two.

Re: Command line tool for blocking sites to be more productive

#6
post #5

if you're on a mac, Gas Mask is a really good tool to switch between different /etc/hosts files http://www.clockwise.ee/gasmask/ here's my 'focus mode' https://gist.github.com/2564478

On Windows, there's Focal Filter which changes the hosts file for a given period of time.

http://www.focalfilter.com/

Re: Command line tool for blocking sites to be more productive

#7
Similar to others here but I thought I'd share my way as well (on OSX here, but would work on other Unixes):

Throw these somewhere in your profile:

alias zonemode='sudo mv /etc/hosts /etc/hosts.zoneback && sudo mv /etc/hosts.zonemode /etc/hosts && dscacheutil -flushcache' alias zoneoff='sudo mv /etc/hosts /etc/hosts.zonemode && sudo mv /etc/hosts.zoneback /etc/hosts && dscacheutil -flushcache'

Then fill /etc/hosts.zonemode with the sites you want to block:

127.0.0.1 news.ycombinator.com

127.0.0.1 www.reddit.com

Then make sure your user can run passwordless sudo on those commands and you are set.

Re: Command line tool for blocking sites to be more productive

#8
post #2

Nice clean tool. Thing is, I'd like these tools to wearing muzzle to lose weight. It's misdirection of effort into avoiding rather than addressing the demonstrated issue of self-control.

No one has infinite willpower. Making it a tad harder to browse reddit is a useful deterrent. It makes you think twice. If you're trying to lose weight, wearing a muzzle is extreme. However, it's a good idea to remove all the junk food from your house. You can always buy more, but it's that much harder.

Re: Command line tool for blocking sites to be more productive

#10
Sweet. I am going to try this out!

Has anyone here used Self Control? (http://visitsteve.com/made/selfcontrol/). Sometimes when I block websites, like Reddit.com and this one and few others it makes other websites look weird. Like the page will still load but be broken. I think Self Control is blocking sites the same way this does. Any idea why this happens?

Post reply on HN