get-shit-done - Boost productivity by blocking distracting websites
version 0.4
sudo get-shit-done [work|play]
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.
get-shit-done
work
play
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:
/etc/get-shit-done.yaml
/etc/gsd.yaml
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.
Path to the system hosts file, e.g. /etc/hosts. If not supplied, a default is guessed based on operating system.
A command to flush DNS and/or restart the network. If not supplied, a default is guessed based on OS.
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.
Inspired by the PHP/shell/python version by leftnode and contributors (https://github.com/leftnode/get-shit-done).
Richard Harris <RJH@cpan.org>
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.
To install App::GSD, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::GSD
CPAN shell
perl -MCPAN -e shell install App::GSD
For more information on module installation, please visit the detailed CPAN module installation guide.