Skip to content

Instantly share code, notes, and snippets.

@ukiahsmith
Last active January 21, 2019 22:19
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 ukiahsmith/4bd8373da2d76d0aa0d7e5d4b83f3ffd to your computer and use it in GitHub Desktop.
Save ukiahsmith/4bd8373da2d76d0aa0d7e5d4b83f3ffd to your computer and use it in GitHub Desktop.
#!/usr/bin/env sh
MINUTES=`echo $1 | bc 2>/dev/null`
if [[ $MINUTES -eq 0 ]]; then
MINUTES=10
fi
if [[ $MINUTES -gt 360 ]]; then
MINUTES=11
fi
ENDALERT=$(cat << END
set theDialogText to "You have completed your work time \r\rNow go and relax."
display dialog theDialogText
--> Result: {button returned:"OK"}
END
)
defaults write org.eyebeam.SelfControl BlockDuration -int $MINUTES
# set the sites we want to block
defaults write org.eyebeam.SelfControl HostBlacklist -array news.ycombinator.com lobste.rs elektronauts.com
defaults write org.eyebeam.SelfControl HostBlacklist -array-add sfpl.overdrive.com kyunbound.overdrive.com twitter.com
defaults write org.eyebeam.SelfControl HostBlacklist -array-add facebook.com app.hackerwebapp.com linkedin.com
defaults write org.eyebeam.SelfControl HostBlacklist -array-add mobileread.com m.facebook.com ebay.com meetup.com
defaults write org.eyebeam.SelfControl HostBlacklist -array-add swappa.com feedly.com macrumors.com
defaults write org.eyebeam.SelfControl HostBlacklist -array-add reddit.com new.reddit.com old.reddit.com
sudo /Applications/SelfControl.app/Contents/MacOS/org.eyebeam.SelfControl $(id -u $(whoami)) --install
say -v Samantha "Are you ready to do some work?"
say -v Samantha "Let's take a moment to breathe deep."
sleep 60
say -v Samantha "Good. [[slnc 900]] Now let go of the world and focus on your task."
sleep `echo $MINUTES*60 | bc`
say -v Samantha "All done. You have completed your work time. [[slnc 1500]] Now, [[slnc 700]] let's go and relax." &
osascript -e "$ENDALERT"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment