Created
January 17, 2012 14:03
-
-
Save umbrae/1626720 to your computer and use it in GitHub Desktop.
gotime
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Step 1. Put some commented-out entries in your /etc/hosts file for sites you | |
| # want to block while you're working, with a comment/hashtag of gotime, like | |
| # this: | |
| #127.0.0.1 reddit.com #gotime | |
| #127.0.0.1 www.facebook.com #gotime | |
| # Step 2. Add these lines to your shell's rc file: | |
| alias gotime="sudo perl -pi -e 's/#([^\n]+)#gotime/\$1#gotime/g' /etc/hosts" | |
| alias timetogo="sudo perl -pi -e 's/([^\n]+)#gotime/#\$1#gotime/g' /etc/hosts" | |
| # Step 3. Re-source your rc file, or start a new shell | |
| source .bashrc | |
| # Step 4. When you want to get work done, use "gotime" to block those sites | |
| # you specified above. Use "timetogo" to unblock them. You'll probably need to | |
| # enter your password. | |
| gotime | |
| # Step 5. Be more productive! After unblocking a site, you may need to flush | |
| # your DNS cache. In OS X, that's 'dscacheutil -flushcache' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment