blog.tommy.sh

Unfocus

I wrote a script called Unfocus to prevent me from wasting too much time reading the news and Twitter. I wish that weren't necessary, but wataryagonnado, huh?

Example:

~/.unfocus.sh 15

Which lets me bum around for 15 minutes. After that, I'm greeted by:

Unfocus

Nice! 😅

How's it work

A popular trick to prevent visiting a website is to convince your computer that its domain resolves to localhost. This can be done by manually editing the /etc/hosts file:

127.0.0.1    site-you-do-not-want-to-visit.com

The problem is that, if you ever want a little taste of what you're missing, you have to manually edit again to unblock and remember to edit again when you're ready to re-block...

Anyway, this tool tries to do that for you.

Give it a go

For now, the default blocked sites are: twitter, netflix, google news, and HN; but it's configurable.

Code: https://github.com/rocktronica/unfocus