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.
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.
There are a few versions of it in Python, PHP and sh so you can pick your preference :-)
https://github.com/richardjharris/get-shit-done
I've just realised I'll need to update it now Arch is using systemd...
var hostsFile = process.platform == "linux" ? "/etc/hosts/" : "C:\\Windows\\System32\\drivers\\etc\\hosts";
Surely this won't work on anything but Windows.What if instead of blocking sites, the nonproductive internet slowed down a lot? Then in the 10 seconds you waited for Hacker News to load, you might think to yourself that this is a bad idea and give up.
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?
However, in practice it doesn't work too well for me. If you block youtube.com or plus.google.com it tends to block other parts of Google (including Search and Docs), which is a big dealbreaker. There's an Issue on Github for the bug, but it's really old and there hasn't been any progress on it. If it worked as it should, then I'd actually consider using Self Control.
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)
http://www.clockwise.ee/gasmask/
here's my 'focus mode'
env: node\r: No such file or directory
(I'm on a Mac)EDIT: Are you using Windows newlines? I think that's the problem.
https://gist.github.com/3907633
[pac file in this gist is merely a demo, please clone it and add your sites-to-blackhole-during-work]the advantages of using a pac file over /etc/hosts are
* you can safely version control it
* you dont need to install extra software (at least on mac/windows)
* you can gist your determination
for more details of pac file, please dig into the reference link of pacfile:
http://findproxyforurl.com/pac-functions/
there could be fun to use weekdayRange/timeRange to specify exact hours you want to be away from any self-distraction.Unfortunately it doesn't seem to be well maintained.
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.
# 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.
alias play="sleep 120 && ..."
Two minutes should be enough for the craving to pass :-)