
Get-shit-done - Easy way to stop distractions - leftnode
https://github.com/leftnode/get-shit-done
======
adnam
I once wrote a similar script which was configurable and it installed as a
service. It would periodically scan /etc/hosts to check I wasn't cheating.

    
    
      $ sudo /etc/inid.d/procrastination-ctl start
      OK.
      $ sudo /etc/inid.d/procrastination-ctl stop
      You need to wait 59 minutes before you can stop.
    

Managed to waste a whole day on that one.

~~~
tgandrews
> Managed to waste a whole day on that one

I love the irony.

~~~
adnam
I always wanted to rename the script to "/etc/init.d/procrastination" whereby
the command "stop" would start the service and vice-versa.

------
JacobAldridge
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.

~~~
lionhearted
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.

------
bajsejohannes
I do this, although only by saying

    
    
        sudo cp hosts.play /etc/hosts
    

or

    
    
        sudo cp hosts.work /etc/hosts
    

It's simple, and surprisingly efficient.

~~~
ianl
The only problem with this method is that if you modify your hosts file, you
have to modify both.

~~~
pyre
Just create a Makefile or something that cats together hosts.common and
hosts.work or hosts.play.

    
    
      all:
          cat hosts.common hosts.work.in > hosts.work
          cat hosts.common hosts.play.in > hosts.play
    

Make common changes to hosts.common and easily build your final hosts files.

    
    
      play:
         cat hosts.play | sudo tee /etc/hosts > /dev/null
    
      work:
         cat hosts.work | sudo tee /etc/hosts > /dev/null

------
ericmoritz
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.

~~~
aniket_ray
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.

------
agj
Why such interest in this script? Besides being written in php, it's also a
fairly kludgey approach to managing /etc/hosts. Is it the vulgarities?

    
    
        #!/bin/sh
        [ $UID -eq 0 ] || { echo "You're not root, asshole."; exit 1; }
        [ -f "/etc/hosts.$1" ] || { echo "/etc/hosts.$1 doesn't exist, asshole."; exit 1; }
        cat /etc/hosts.{$1,tail} > /etc/hosts
    

...

    
    
        sudo ~/bin/stopfuckingoff play

~~~
thyrsus
It was a sad day when Red Hat removed the insults from sudo.

------
thurn
For Mac users, SelfControl is a GUI approach to this idea:
<http://visitsteve.com/made/selfcontrol/>

~~~
guywithabike
One of the best features is that it runs on a timer and you can't cancel it
prematurely. Even if you restart.

~~~
rimantas
You can. It uses ipfw, and I think you can reset the rules. At least I managed
when I tried it, but this was some 3 years ago.

------
rbxbx
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.

~~~
yogsototh
Yep, beware I didn't even tested it:

    
    
        #!/usr/bin/env zsh
    
        (($#<1)) && {
            print -- "usage: $0:t (play|work)"
                exit 1
        }>&2
        blacklist=(
                reddit.com
                ycombinator.com
                slashdot.com
                )
    
        hostfile=/etc/host
    
        if [[ $1 = "play" ]]; then
            if [[ ! -e $hostfile.orig ]]; then
                cp $hostfile{,.orig}
            else
                print -- "You're already playin" >&2
                exit 1
            fi
            cp $hostfile{.orig,}
            for elem in $blacklist; do
                print -- "127.0.0.1\t$elem" >> /etc/host
                print -- "127.0.0.1\twww.$elem" >> /etc/host
            done
        fi
    
        if [[ $1 = "work" ]]; then
            cp $hostfile{.orig,}
            \rm $hostfile.orig
        fi
    
        /etc/init.d/networking restart

------
robinduckett
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.

------
pfarrell
<https://addons.mozilla.org/en-us/firefox/addon/leechblock/>

does windows of access, allows for x minutes, has grouping. Course, it's FF
only where hosts file gets your whole connection.

~~~
rodh257
StayFocusd for Chrome Users -
[https://chrome.google.com/webstore/detail/laankejkbhbdhmipfm...](https://chrome.google.com/webstore/detail/laankejkbhbdhmipfmgcngdelahlfoji)

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.

------
skid
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.

~~~
georgieporgie
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.

------
chriswoodford
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...

...I'm going to get back to work :)

------
keeganpoppen
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.

~~~
keeganpoppen
yikes-- that formatting got butchered... anyone know if there's a better way
to put code in comments?

------
datasink
<https://github.com/killsaw/Timeguard>

A similar script, but with an 'addsite whatever.com' command.

------
neurolysis
For anyone interested, I rewrote this entirely in bash.

<https://github.com/cdown/ncrast/blob/master/ncrast>
<http://aur.archlinux.org/packages.php?ID=48731>

------
ivankirigin
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.

------
radu_floricica
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)

Address:
[https://chrome.google.com/webstore/detail/pfglnpdpgmecffbejl...](https://chrome.google.com/webstore/detail/pfglnpdpgmecffbejlfgpnebopinlclj)

Website Blocker seems to be similar, but without a time limit:
[https://chrome.google.com/webstore/detail/hclgegipaehbigmbhd...](https://chrome.google.com/webstore/detail/hclgegipaehbigmbhdpfapmjadbaldib)

------
jcromartie
I've ported this to a Bash script which is simpler and more extensible. It
uses env variables to facilitate customization.

<https://gist.github.com/955437>

------
dananjaya86
A crude implementation of Get-shit-done in Python.
<https://github.com/dananjayavr/get-shit-done>

------
rebelidealist
For mac users, the Self Control app works really well.
<http://visitsteve.com/made/selfcontrol/>

------
yeag123
A Chrome extension that I use pretty regularly for this sort of thing is Stay
Focused: <http://goo.gl/gHWFQ>

------
mrtron
I permanently blocked all from my laptop and only surf from my iPad now. Works
great for me.

~~~
john2x
Curious, how do you permanently block the sites?

~~~
georgieporgie
I think it just means that the sites stay redirected in his hosts file.

~~~
mrtron
Correct. If I ever catch myself surfing to a website from my laptop, it gets
bookmarked for my iPad and blocked in my /etc/hosts.

------
jarin
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.

~~~
FaceKicker
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.

~~~
jarin
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.

~~~
kami8845
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

------
patrickk
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 :)

------
bearwithclaws
Throw in some ASCII art to make things sweeter:

    
    
      figlet -f univers time to work! | boxes
    
      figlet -f starwars game time!   | boxes -d dog

------
swah
How does this compare to Programming, Motherfucker?

------
chriswoodford
this comment thread is turning into quite the social experiment. is ADD a
prerequisite for being a good programmer/hacker/etc...?

------
huherto
Just a quick hack. I added timer-applet in ubuntu. I work on 30 mins intervals
and then rest 5 mins. It is pretty handy.

~~~
MauriceFlanagan
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.

------
rbarooah
Safari users might like <http://www.mindfulbrowsing.com>

------
keefe
treating the symptoms rather than the disease is only a good choice for short
term or for incurable diseases

~~~
eswat
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.

~~~
keefe
my main point being that if they stop with HN/Reddit something else will fill
that gap. Not working is the issue.

------
lani
oh no !! i checked the list of sites being blocked, now have more of them to
check up on ....

------
djbriane
Does it block Outlook because thats the real reason I can't get anything done
these days.

------
JoeAltmaier
Does it have a timer to keep me from modifying it every 2 minutes?

~~~
calloc
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 =)

------
sriram_sun
I'd call it git-er-done

------
sbkirk
So distracted by this.

------
rch
I might as well plug tasktop - it's great.

------
ajarmoniuk
Block reddit in /etc/hosts.

Memorize reddit's IP.

------
m0wfo
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.

------
idonthack
Is this really worthy of HN frontpage? Seriously, who among us couldn't write
something similar in 5 minutes or less?

