Live data from Hacker News

Command line tool for blocking sites to be more productive

github.com

11–20 of 28 posts

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

#11
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

Also, try Self Control app: http://selfcontrolapp.com It has a black/white list (depending on what you need) of hosts, and lets you set up a timer.

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

#13
Optimized version:

# turn on

sudo rm /etc/hosts

sudo ln -s /etc/hosts{.work,}

# turn off

sudo rm /etc/hosts

sudo ln -s /etc/hosts{.play,}

Optimized further (in your ~/.bashrc):

alias work="sudo rm /etc/hosts && sudo ln -s /etc/hosts{.work,}"

alias play="sudo rm /etc/hosts && sudo ln -s /etc/hosts{.play,}"

Optimization cubed (lets you define a base hosts file):

alias work="sudo rm /etc/hosts && sudo cat /etc/hosts.base >> /etc/hosts && sudo cat /etc/hosts.work >> /etc/hosts"

alias play=...

The number of upvotes, the fact that you thought this was necessary and the fact that this application exists all made me facepalm hard. I can't even see right now.

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

#14
post #13

Optimized version: # turn on sudo rm /etc/hosts sudo ln -s /etc/hosts{.work,} # turn off sudo rm /etc/hosts sudo ln -s /etc/hosts{.play,} Optimized further (in your ~/.bashrc): alias work="sudo rm /etc/hosts && sudo ln -s /etc/hosts{.work,}" alias play="sudo rm /etc/hosts && sudo ln -s /etc/hosts{.play,}" Optimization cubed (lets you define a base hosts file): alias work="sudo rm /etc/hosts && sudo cat /etc/hosts.bas…

This is close to what I have, except less complex. A single line in /etc/hosts that redirects sites to 127.0.0.1, which gets commented or uncommented. The fact that I have to go through the hassle of sudoing up and removing the comment means I'm far more likely to catch myself before doing it and getting back to work.

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

#15

Nice project, though if you'd rather not install Node.JS and all of its dependencies, you might want to try https://github.com/leftnode/get-shit-done There are a few versions of it in Python, PHP and sh so you can pick your preference :-)

My version, in Perl with Arch support:

https://github.com/richardjharris/get-shit-done

I've just realised I'll need to update it now Arch is using systemd...

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

#16
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.

If you habitually procrastinate by browsing to reddit et al, these tools can help by killing the positive feedback (as the sites appear down). After a while you no longer have the urge to visit the sites, and the tool isn't necessary.

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

#17
post #13

Optimized version: # turn on sudo rm /etc/hosts sudo ln -s /etc/hosts{.work,} # turn off sudo rm /etc/hosts sudo ln -s /etc/hosts{.play,} Optimized further (in your ~/.bashrc): alias work="sudo rm /etc/hosts && sudo ln -s /etc/hosts{.work,}" alias play="sudo rm /etc/hosts && sudo ln -s /etc/hosts{.play,}" Optimization cubed (lets you define a base hosts file): alias work="sudo rm /etc/hosts && sudo cat /etc/hosts.bas…

I upvoted so that others share their similar setups/scripts (as you did).

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

#18

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?

I use it now and again, never come across that but you're right it does work on the hosts file in the same way.

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

#19
post #13

Optimized version: # turn on sudo rm /etc/hosts sudo ln -s /etc/hosts{.work,} # turn off sudo rm /etc/hosts sudo ln -s /etc/hosts{.play,} Optimized further (in your ~/.bashrc): alias work="sudo rm /etc/hosts && sudo ln -s /etc/hosts{.work,}" alias play="sudo rm /etc/hosts && sudo ln -s /etc/hosts{.play,}" Optimization cubed (lets you define a base hosts file): alias work="sudo rm /etc/hosts && sudo cat /etc/hosts.bas…

This is close to what I have, except less complex. A single line in /etc/hosts that redirects sites to 127.0.0.1, which gets commented or uncommented. The fact that I have to go through the hassle of sudoing up and removing the comment means I'm far more likely to catch myself before doing it and getting back to work.

Optimization #4:

alias play="sleep 120 && ..."

Two minutes should be enough for the craving to pass :-)

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

#20
For me, procrastination is a normal part of my routine. I've tried forcing myself not to do it, but you know what happens? Instead of reading hacker news, I just stare out the window for ten minutes, or think about what exercises I'm going to do at the gym.

Your mind is not willing to do the task you need it to do and there is nothing you can do about it. (that's my experience)

Post reply on HN