Nowhere near as broad-ranging, but I'll make the note for HN users not aware of it - if HN is your sole (main?) distraction, you can use the noprocrast feature on your user page. Change to Yes, add a max time you allow yourself to visit HN and then the min time you want to be forced to be away.
As I say, nowhere near as broadly applicable or useful as the OP, but worth noting especially if (like me) HN is your distraction of choice and you have minimal technical skills.
After playing with noprocrast, I found very good settings for me are
maxvisit: 20
minaway: 1
That means, every 20 minutes HN kicks me off for one minute. I leave it like that constantly - it means if I'm spending time on here nonstop for an hour or two, I get a couple little reminders to ask myself if I really want to be on here. If I do, it's not a big deal to get up and make myself a tea or whatever until 1 minute passes, if not I close the tab and get to business, and it's low enough that I don't cheat by logging in with another browser or Chrome Incognito Mode.
The noprocrast feature stops working very well when you use Safari. It has the web page preview stuff, and every-time that refreshes the noprocrast kicks in. Since it does that way more often than I visit the site the site is continuously in noprocrast mode.
It is not the greatest distraction, but a significant fraction of it (#1 distraction, and about 3x as big as #2, according to RescueTime).
While it is not a huge problem, and there is lot of value I extract from this site, culling seems like a good idea. A daily quota would help me avoid the high hitters and still keep myself "well read".
I did this in the past too. The amazing thing is that it actually cures the addiction, not just the symptoms. On the first day you find yourself clicking on the reddit bookmark like an idiot every 20 mins, only to be redirected to localhost. After a few days the impulse is gone and you can actually go back to a non censured /etc/hosts: your self control is back. YMMV.
When I am working on Linux I do the same thing, except I have cron job copy hosts.work to hosts at 9am(insert your favorite get to work time) and hosts.play at 5pm. Works really well.
I wonder if one can do the same on Windows 7, some way of scheduling tasks easily.
Does this work with Chrome?
I believe Chrome does it's own dns resolution and skips the host file. (I defiantly know it won't resolve localhost if you're offline)
I used StayFocusd for a day or two and realized I was a lost cause when I found myself opening its sqlite database in my Chrome profile to add time to the clock.
Unfortunately you can just right click and disable extensions on chrome. Since the exit barrier is so low, I was always able to exit even when I shouldn't have.
Sorry to be the guy decrying PHP, but the only arguments I've found in it's favor are it's ubiquity and being sometimes "the right tool for the job" if you're quickly hacking together a dynamic webpage.
Surely a simple cli app isn't the right job for this tool.
Now, all that said, it _does_ work, and blahblahblah.
Thank god! Let me just waste some time getting this installed and then I'll waste some more time testing it, then I'll waste some more time posting this comment to hacker news.
latest version has a neat feature which tracks links from blocked pages. Ie if I give myself 15 mins of HN a day, but end up wasting 2 hours because I only spend 10 secs on HN opening up tabs to read, it now tracks that. Any links you click from HN will count towards your time limit.
Isn't the point of this approach to be _difficult_ to switch back and forth? Next thing you know there will be a chrome extension that swaps your hosts file and you will be separated from procrastination by a single click.
I found it useful to force myself to manually comment/uncomment lines in my hosts file. It gives a critical few moments for a bit of humiliation to set in, as you realize how desperate you are for diversion. On the other end, it gives a moment to mentally pat yourself on the back for eliminating the distractions.
i'm actually surprised at the amount of time people spend procrastinating on something to help them stop procrastinating...
or even more surprising might be the amount of time i've spent procrastinating by reading about people who've procrastinated by making tools to aid their procrastination...
Instead of doing work, I got stuck modding this to get better behavior for Mac. First I tried to figure out what the $restartNetworkingCommand mac equivalent was (dscacheutil -flushcache for those who are curious). This works pretty well for non-Chrome browsers (i.e. browsers that don't have absurd caching behavior). Then, given that Chrome (which maintains its own DNS cache-- a decidedly not absurd caching behavior, I acknowledge) is my browser of choice, I also set out to fix it so I didn't need to restart Chrome. This endeavor I have accomplished using one of my favorite jank-tastic tactics: running applescript from the command line.
So here is my (Mac OS X 10.6+?) change:
$restartNetworkingCommand = 'dscacheutil -flushcache; osascript <<EOF
tell application "Google Chrome"
make new tab at end of tabs of window 1 with properties {URL:"chrome://net-internals/#dns"}
activate
delay .5
set URL of active tab of window 1 to "javascript:document.getElementById(\'clearHostResolverCache\').click()"
end tell
delay .5
tell application "System Events" to keystroke "w" using {command down}
EOF';
This, of course is made even more jank-tastic by manually sending command-w to close the window-- googling the proper command was more difficult than just doing it live :).
So yeah-- clearly I needed this script before reading this post, but if I had it probably would have done some terrible things to the space-time continuum... I guess I'll just amortize the one-time cost by actually using the script. Starting now.
I do this, and my scripts have actually gotten kind of complicated.
To start, it's a command line utility. I need to answer the question "Do you want to waste your time?" with "yes" to turn off the filters.
Then I didn't bother running in a way that the script had permissions to edit /etc/hosts so I need to enter my system password every time I want to make a change.
I also automatically turn the filters on every hour.
I also log both the number of times I turn the filters off and whether the filter is on at about 1pm.
I'm running a test right now to not turn on the filters automatically every hour and there is already a noticeable decrease in productivity in my rescuetime.
I'm about to update the logger to use the google charts API to save a historic graph of performance to a directory that is used as my desktop background.
Use to use cumbersome hacks with block lists in routers, but I discovered the SiteBlock extension for Chrome: make a list of "dangerous" sites, and give yourself a fixed time per day to visit them. In my casa, one hour works fine (although I'd probably prefer 2 :p)
I took a really simple approach: removing HN, Facebook, Clicky, and Google Reader from my bookmarks bar. Having to type them in manually instead of compulsively clicking is enough to limit me to an hour or two of dicking around per day.
I don't even use bookmarks because it would take longer to click a bookmark than typing "n" for HN (or "r" for reddit or "f" for facebook) and letting Chrome auto-complete and pressing enter, so this wouldn't help me that much.
Oh, I guess I would call myself a "burst typer", so I usually find it faster to just type all or most of the domain than to type one letter and check to see if Chrome got the right thing. But of course that requires a little bit of effort, so it's still just enough to make me consider whether to go there or get some work done.
I just subconsciously don't trust one-letter autocomplete I guess.
in firefox i have 'red' <down> <enter> already ingrained for reddit, same with 'new' for HN ... it's automatic and you can't tell me typing it all out is faster :P
Thankfully this was the first link on the HN homepage. Just reading the articles and comments made me feel sufficiently guilty to stop reading any more :)
Similar to this, I use eternity time tracker on my iphone to work in 30 minute intervals. During the interval, no email, news sites etc. It has worked really well for me.
You may be right. But repeating an action forms a habit, or in this case learning to not repeatedly open up HN or Reddit can become a long-term habit for anyone with the right mindset.
Use FreeBSD, set the kernlevel to something above the minimum, and add the flags to the file so it can't be changed, then until you reboot you won't be able to modify the hosts file =)
You should be able to use an asynchronous cron scheduler to implement something like Pomodoro with this. Combined with the right notification tool this could work quite well.
This will obviously leave me continuously trying to access hacker news while preventing me from doing so. My continued attempts will block all other operations [i.e. work] hence creating a race condition.
Far preferable is the event-driven technique whereby I make a cursory attempt at doing some real stuff until the HN bot tweets something of fleeting interest, at which point I defer said real stuff to a background thread to be completed in an asynchronous fashion.