I waste time to not waste time

I’m using a web server on my local machine plus an edited /etc/hosts file to serve up a page that reminds me to get back to work when I should be getting back to work, rather than, say, reading facebook. Yes, I can get around this by clearing my hosts file, but that makes it work to get to the blocked sites, and if I’m going to be doing work, it’s not time-wasting is it?

The hosts file looks like this:

ams@robot-lab7:~/weblock$ cat /etc/hosts
127.0.0.1 localhost.localdomain localhost
#I elided a couple of lines here
127.0.0.1 www.facebook.com facebook.com
127.0.0.1 www.dresdencodak.com dresdencodak.com
127.0.0.1 www.xkcd.com xkcd.com
127.0.0.1 www.boingboing.net boingboing.net
127.0.0.1 ab3nd.livejournal.com livejournal.com
127.0.0.1 www.questionablecontent.net questionablecontent.net
127.0.0.1 www.hackday.com hackaday.com

# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

That takes care of redirecting a lot of pages to localhost, rather than their real IP addresses. On my computer, I have a little web server, which is launched with the command
sudo webfsd -p 80 -f index.htm -u ams -r /home/ams/weblock/

Webfs, and it’s daemon part webfsd, is a static-file-only http server. In this invocation, it runs as my user after binding to port 80 as root, and serves the file index.htm out of the directory /home/ams/weblock. That file is a very simple HTML file:

<div style=”display: table; height: 100%; width: 100%; background: #fff; _position: relative; overflow: hidden;”>
<div style=”_position: absolute; _top: 50%; display: table-cell; vertical-align: middle; text-align: center;”>
<h1>What should you be doing?</h1>
</div>
</div>

It just shows the text “What should you be doing?” in the middle of the page. This is also interesting because it shows how to center HTML content in the middle of the page, at least for small content. I’m not sure how well this works with larger or more complex content.