Last active
September 30, 2019 13:33
-
-
Save bennylope/dd0c723b6586ded254b3bd673a7861a3 to your computer and use it in GitHub Desktop.
Block (from Samuel Mullen on Legacy Rocks slack)
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
# 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 "127.0.0.1 ${line} # WORKTIME" | |
echo "fe80::1%lo0 ${line} # WORKTIME" | |
echo "127.0.0.1 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