Sunday, January 10, 2010

Automatically block websites at certain times

One of my greatest barriers to productivity is my internet addiction.  In order to quit this addiction, I have figured out how to block the sites that seem to eat up the greatest majority of my time.

The Windows host file redirects URLs to IP addresses.  It can however, be edited so that if you try to go to a URL, you are sent to a different IP address, in this case, you are harmlessly sent to your local IP (127.0.0.1).

If you want to block a website outright, ie you never want to see facebook again, you could simply edit your hosts file by adding the line

127.0.0.1     www.facebook.com


However, I am not that hard on myself, so instead I have created a batch file, that switches my host file.  By running that batch file at 6:30 AM and 9:30 AM, I can limit my access to facebook and other time wasting sites to the morning.





  1. Open your hosts file with notepad (most likely located in C:\WINDOWS\system32\drivers\etc ) and save it as "hosts1." when saving, make sure to save with a period after hosts1 so that it does not automatically save as a .txt file, this will be the host file that doesn't block sites (ie what I use in the morning).
  2. Also save the file as "hosts2."
  3. While in hosts2 add lines to the bottom of the host file in the form




    127.0.0.1       www.someurl.com
    , blocking whatever urls you like. The lines in my hosts1 file are displayed below:




  4. 127.0.0.1       localhost
    127.0.0.1       www.facebook.com
    127.0.0.1       www.textsfromlastnight.com
    127.0.0.1       www.megavideo.com
    127.0.0.1       www.myspace.com
    
  5. Save hosts1 and close
  6. Open Notepad and paste the following into it:
  7. copy host2 hosts
    
    :chrome
    taskkill /im chrome.exe
    if errorlevel 128 goto :firefox
    start chrome.exe
    
    :firefox
    taskkill /im firefox.exe
    if errorlevel 128 goto :eof
    start firefox.exe
    Save the file as "allow.BAT" in the same folder as your host file.  Make sure that when you save, "Save as type: All Files" is selected so it saves as a Batch file and not as a text file..
  8. Open Notepad and paste the following into it:


      copy host1 hosts
      
      :chrome
      taskkill /im chrome.exe
      if errorlevel 128 goto :firefox
      start chrome.exe
      
      :firefox
      taskkill /im firefox.exe
      if errorlevel 128 goto :eof
      start firefox.exe
      Save the file as "block.BAT" in the same folder as your host file.




  9. Create 2 scheduled tasks, The first task should be set at the beginning of the time that you wish to allow yourself to procrastinate, and should target allow.BAT, and the second one should be set for the time that you wish to stop procrastinating and should target block.BAT.

If for some reason, the host file is letting you procrastinate when it shouldn't, and stopping you from procrastinating when you want to, manually run the hostswitcher.BAT file by double clicking it.  This could happen if you shut down your computer during the time you normally block the sites and start it at a time that you normally allow access or vice-versa.

Tuesday, January 5, 2010

Lets Fucking Automate our Lives ~ Part 1

One of my new years resolutions this year was to get up earlier, in the interest of doing so I have begun to set up a ghetto smart-house, or smart-dorm as the case may be.

What I have thus-far is
  • A Lamp Timer, which controls the light, and my espresso machine
  • My computer wakes up automatically at 6:30 and displays the news and my gmail
The Lamp Timer is a neat little gadget that plugs into an electrical outlet and automatically allows power to flow at programmed times, in my case, at 6:25, 5 minutes before my alarm clock

My computer, which is close to my bed, automatically turns on at 6:25, and loads the NY times home page and my email (gmail).  I did this using Windows XP's scheduled tasks utility.  Windows XP Scheduled tasks is a little utility that automatically runs a program at a specified time.

The Scheduled tasks utility is located at
Start > All Programs > Accessories > System Tools > Scheduled tasks

In this case, I will show how to make a link to this blog, so that every morning, it will be automatically opened for you.  Although you should definitely follow along, feel free to tweak the instructions to your fancy.

First, open the add new task dialog box



Name the task, and then double-click it

If you are using Google Chrome:
  • In the first box (Run), type in the path to the Google Chrome launcher in quotations and then --app=.  For example
"C:\Documents and Settings\\Local Settings\Application Data\Google\Chrome\Application\chrome.exe" --app=http://letsfuckindoit.blogspot.com/
  • In the second box (Start in), type the path of the folder that contains the chrome application.  For example.
 C:\Documents and Settings\\Local Settings\Application Data\Google\Chrome\Application







If you are using Firefox


  • In the first box (Run), type in the path to the Google Chrome launcher in quotations and then
"C:\Program Files\Mozilla Firefox\firefox.exe" http://letsfuckindoit.blogspot.com/
  • In the second box (Start in), type the path of the folder that contains the chrome application.  For example.
"C:\Program Files\Mozilla Firefox\"

 Setting up the schedule

Click on the schedule tab on the top of the window

By default it will run every day at 9 AM, however, if only want it to run Monday through Friday, in the Drop Down box, select Weekly

Select the days you want it to run, see example below





If your computer typically goes to sleep overnight, make sure to check "Wake the computer to run this task" in the Settings tab

Click Apply, enter your username and password in the dialog box that appears and rest assured that your mornings will be that much easier

Monday, December 14, 2009

The Boil

When making beer, the ingredients are typically boiled together in a pot that holds 1/3 or more of the batch size. In this process the ingredients are dissolved into water, forming the unfermented beer - called wort (pronounced wert.)

If you're like most college students, then you don't have a huge stock pot sitting around. The enamel stock pot I use is from target, and it only cost me $15. You'll want a pot that is at least 3 gallons although larger would be better, and stainless steel would be better.

Although the particular recipe you are using will dictate the exact details of the process, typically any grains you have will be soaked like a giant tea-bag in water that is around 160 degrees. Then it will be brought to a boil, extract will be added - either dry or as a syrup along with bittering hops. After about 30 minutes, more hops will be added, the heat will be removed and the wort will be cooled.

The wort needs to be cooled to about 70 or 80 degrees before the yeast can be added. Placing the wort in a refrigerator or in a sink with icewater will help cool it. The faster the wort cools, the better, as this will lead to a clearer end product and decrease the chance of contamination.

Once the wort is done boiling, it is diluted to the final volume, the yeast is pitched, the top with airlock is added and the whole thing is set to the side to ferment for a 10 - 14 days.

The yeast