Skip to content

Instantly share code, notes, and snippets.

Last active September 30, 2019 13:33
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Block (from Samuel Mullen on Legacy Rocks slack)
# List the domains you want to block, one per line, in your ~/.blocked_sites file,
# then ensure this script is included or sourced in your terminal configuration.
function worktime {
while read -r line; do
echo " ${line} # WORKTIME"
echo "fe80::1%lo0 ${line} # WORKTIME"
echo " www.${line} # WORKTIME"
echo "fe80::1%lo0 www.${line} # WORKTIME"
done < $HOME/.blocked_sites | sudo tee -a /etc/hosts > /dev/null
function slacktime {
while read -r line; do
[[ $line =~ "# WORKTIME" ]] && continue
echo $line
done < /etc/hosts > /tmp/hosts
sudo cp /tmp/hosts /etc/hosts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment