Skip to content

Instantly share code, notes, and snippets.

@mpvosseller
Last active September 25, 2020 15:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mpvosseller/9f6a19136412ec5f71effc3faf33aa2e to your computer and use it in GitHub Desktop.
Save mpvosseller/9f6a19136412ec5f71effc3faf33aa2e to your computer and use it in GitHub Desktop.
shell aliases to temporarily block and unblock a set of hostnames to better focus
# add to your shell startup file (e.g. ~/.zshrc or ~/.bash_profile)
export FOCUS_IGNORE_SITES="twitter.com api.twitter.com www.facebook.com www.nytimes.com"
alias focus='sudo echo "127.0.0.1 ${FOCUS_IGNORE_SITES} # FOCUS_IGNORE_SITES" | sudo tee -a /etc/hosts > /dev/null'
alias unfocus="sudo sed -i '' '/FOCUS_IGNORE_SITES/d' /etc/hosts"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment