Chris Dzombak

I wrote ‘hosts-timer’ to help quit my (desktop) Twitter and Facebook habits

Part of the Project Announcements series.

It was really easy for me to get into the habit of checking Facebook and Twitter while waiting for my computer to finish something. These sites are, after all, designed to be addicting.

There are some apps that are supposed to help solve this, but I figured I could build my own pretty quickly & easily, and for free. The result is a simple Go program: hosts-timer. It works like this:

  1. First, install it for certain domains you’d like to restrict access to: sudo hosts-timer -install
  2. Then, you can enable a site for a certain amount of time: sudo hosts-timer -time 5m
  3. hosts-timer unblocks the site, and waits until the specified time has elapsed (or until you kill it with Ctrl-C).
  4. When hosts-timer exits, the site is blocked again.

Under the hood, the program works — as its name implies — by adding and removing entires in /etc/hosts.

With this installed on all my computers, I’ve dramatically cut the amount of time I spend on Facebook and Twitter.

As documented in the project’s README, there are some tips & tricks to make usage easier:

Hopefully this program is as useful for some of you as it has been for me.