trevmex's tumblings

JavaScripter, Rubyist, Functional Programmer, Agile Practitioner.

Does anyone else remember this game? Every now and again I get the opening song in my head. It is simple, but I love it.

Manhunter 2 - San Francisco (by ShagittariusIntros)

 ()

Editing your hosts file to stop goofing off

So, when I get home, I want to work on my pet projects, but I often end up, well, not working on anything. I end up goofing off on the internets.

I have a Windows 7 laptop at home that I use, and I knew that I could block sites by adding entries to my hosts file.

You can access your hosts file by following the great instructions at Help Desk Geek.

Once you have the hosts file open, you want to add lines to it that look like the following:

127.0.0.1 reddit.com
127.0.0.1 imgur.com
  • The first entry is the IP Address of your computer (127.0.0.1)
  • The second entry is the domain you want to direct to your local computer (note that these entries do not have paths, they are only the domain parts of the URL, e.g. reddit.com, not reddit.com/r/funny).

Why would you want this, you ask?

Well, I want to stop myself from going to websites that suck my time away. By essentially blocking these sites (like reddit and imgur) from my computer, I am giving myself a wake up call to do something productive.

But for me, that isn’t good enough. I want to be reminded that I am slacking off when I try to go to these sites. So to do that I created a little page and added it to a web server running on my Windows 7 laptop. Here is how I did it:

  1. Download and install WampServer. It is free (as in freedom), and installs with a click of a button. Easy!
  2. Once installed click Start Menu -> All Programs -> WampServer -> start WampServer. This will start up your server.
  3. Navigate to http://127.0.0.1/. You should see something that looks like the following:
    WampServer Homepage
  4. But we want that page to be a bit better. No problem. I wrote an HTML page that you can use. Save the following gist in a file on your Desktop called index.html:
  5. Open up Windows Explorer by clicking on Start Menu -> All Programs ->Accessories -> Windows Explorer.
  6. Paste C:\wamp\www into the address field at the top of the window and press Enter:
    Windows Explorer Address Bar
  7. Drag and drop the index.html file from your Desktop to the C:\wamp\www directory in Windows Explorer.
  8. Finally, delete the index.php file (different from the index.html file) in the C:\wamp\www directory.

Now, when you go to http://127.0.0.1/ you should see something like:
Do it!

Even better: When you are tempted to go to someplace like http://www.reddit.com/, you will see the above page, which is a nice reminder that you could be more productive right now.

I have a few ideas on how to make this better, for example, it needs some CSS love, and I think it would be neat to let people design their own productivity pages with a simple web app. In any case, this is a good start, and it helps me (at least it helped me write this post. :D).

I hope it can help you too. Take care!

 ()
 ()
 ()