The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

get-shit-done - Boost productivity by blocking distracting websites

VERSION

version 0.4

SYNOPSIS

 sudo get-shit-done [work|play]

DESCRIPTION

get-shit-done is a simple utility that blocks a user-specified list of sites at the DNS level by adding host entries pointing to 127.0.0.1 in the system's hosts file. Invoking with work as an argument blocks the sites; play unblocks them. After either operation, the DNS cache is flushed.

CONFIGURATION

The script will look for either /etc/get-shit-done.yaml or /etc/gsd.yaml for configuration. The file is in YAML format, with the following fields:

block

List of hostnames to block, without 'www.' prefix (if any). For example, if 'reddit.com' is provided, both 'reddit.com' and 'www.reddit.com' will be blocked.

hosts_file

Path to the system hosts file, e.g. /etc/hosts. If not supplied, a default is guessed based on operating system.

network_command

A command to flush DNS and/or restart the network. If not supplied, a default is guessed based on OS.

FLUSHING THE DNS CACHE

get-shit-done attempts to support Mac OS X and Linux (patches for other operating systems are more than welcome). For the former, it flushes the DNS directly. On Linux, it will flush nscd or unscd caches if they are present, and restart the network via one of the following methods:

  • /etc/init.d/networking, if present (e.g. Ubuntu)

  • /etc/init.d/network (e.g. CentOS)

  • rc.d (e.g. Arch) - will detect which of network, NetworkManager or wicd is being used and restart that.

CREDITS

Inspired by the PHP/shell/python version by leftnode and contributors (https://github.com/leftnode/get-shit-done).

AUTHOR

Richard Harris <RJH@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2012 by Richard Harris.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.