Luckily you don't need this if you have a mac mini. The wireless card in it is so shitty that it essentially performs this service for you randomly throughout the day.
Bravo! I wish something like this existed on Linux: preferably implemented in the kernel so that it cannot be overridden with ifconfig or another command. Also: cute name for such a service: Go DOS Yourself.
This is actually not a bad idea, considering that pretty much everyone uses distributed version control now. Set the timer for an hour, commit commit commit, push, read hackernews, repeat. :)
It would be easy for the service to reject port 80 but allow the port used by the version-control system.
More difficult would be allowing access to programming documentation on the web while rejecting time-wasting web sites. One idea is to reject any web page that has changed in the last 24 hours on the theory that the time-wasting sites are constantly changing (are topical) whereas the sites you need to do your work are not. (I do not know if it possible programatically to determine when a page last changed.)
Honestly, I just removed reddit from my bookmarks toolbar, and make a conscious effort to not go there. That has made me much more productive even during "downtime". The side effect is that I post here more, but at least there is the lock out feature if I notice I'm wasting too much time here ;)
https://addons.mozilla.org/en-US/firefox/addon/4476
It will allow you to block time consuming websites at time you configure.
I block Reddit, Digg, and Hacker News throughout the day with the exception of the first hour of the morning, over the lunch hour, and from 5:30pm on.