Month: June 2011

DIY Rescue-Time, or how I keep myself from wasting time on websites, when I’d rather be working.

About a year ago, I realized that I had a developed a terrible habit. Whenever I was idle, even for a brief moment, I unconsciously visited my favorite news sites. A new browser tab would open, and my fingers would type away. After spending half an hour, an hour, sometimes even a couple of hours on the sites, I’d snap back to realize that I was wasting time. This happened several times every day – I often visited the same site only to discover that I had already read every article of interest.

My solution was to block off any website that I found was too distracting. I wrote the following script and stuck it in my home directory:

if [ "$1" = "free" ]; then
	echo 'Freeing hosts...'
	sudo cp /etc/free_hosts /etc/hosts
	echo '[Done]'
elif [ "$1" = "block" ]; then
	echo 'Blocking hosts...'
	sudo cp /etc/blocked_hosts /etc/hosts
	echo '[Done]'
	echo "You can either free or block hosts"
	echo "Usage: "
	echo "	\$switch_hosts free"
	echo "	\$switch_hosts block"

The idea was to replace the host file /etc/hosts with one with a list of blocked websites.
I created two copies of /etc/hosts. One was called /etc/free_hosts and the other was called /etc/blocked_hosts. I then changed /etc/blocked_hosts to look like this:	localhost	broadcasthost
::1             localhost 
fe80::1%lo0	localhost

Any websites that I did not wish to visit when I was working would simply be redirected to I replaced the default apache homepage on my laptop with a gentle reminder that I had a lot to get done before reading the news.

When I was ready to do work, I opened up a terminal window and typed in:

~/switch_hosts block

Two things happened as a result of this script: suffering from withdrawal, and increased productivity. Initially I tried to visit the blocked sites with even greater frequency than before, only to be presented with my own “get back to work” page. Despite this, I achieved hours more productivity everyday. And after a few days, my frequency attempted site-visits started to go down. I began to concentrate on work for longer stretches of time.

Sometimes it is good to get a small dose of TV, I mean Reddit =)..

~/switch_hosts free