Skip to content

Instantly share code, notes, and snippets.

@shapr
Created February 27, 2020 15:20
Show Gist options
  • Save shapr/bb14208c94a4c2b78c6d461830327eda to your computer and use it in GitHub Desktop.
Save shapr/bb14208c94a4c2b78c6d461830327eda to your computer and use it in GitHub Desktop.
my try command wrapper, updated for mac
# for long running commands
function try () {
tally $* && fin || die; # cargo install tally, replacement for time
}
function play_sound () {
afplay $HOME/.bin/$1.wav
}
function notify_success() {
osascript -e 'tell app "System Events" to display alert "Task Successful" message "Your task succeeded."'
}
function notify_failure() {
osascript -e 'tell app "System Events" to display alert "Task Failure" message "Your task has failed."'
}
function fin () {
notify_success
play_sound monkey # monkey.wav from XEmacs https://bitbucket.org/xemacs/sounds-wav/src
}
function die() {
notify_failure
play_sound yeep # yeep.wav from XEmacs https://bitbucket.org/xemacs/sounds-wav/src
play_sound yeep
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment