Skip to content

Instantly share code, notes, and snippets.

@shapr
Last active January 16, 2020 19:07
Show Gist options
  • Select an option

  • Save shapr/fbe79e53f44e9b6d5a615bce349eb588 to your computer and use it in GitHub Desktop.

Select an option

Save shapr/fbe79e53f44e9b6d5a615bce349eb588 to your computer and use it in GitHub Desktop.
wrapper for long running commands
# for long running commands
function try () {
tally $* && fin || die; # cargo install tally, replacement for time
}
function play_sound () {
aplay -N -q $HOME/.bin/$1.au
}
function fin () {
# terminal.png should be in /usr/share/icons/gnome/32x32/apps/terminal.png
notify-send "success" -i terminal # from http://manpages.ubuntu.com/manpages/eoan/man1/notify-send.1.html
play_sound monkey # monkey.wav from XEmacs https://bitbucket.org/xemacs/sounds-wav/src
}
function die() {
# error.png should be in /usr/share/icons/gnome/32x32/status/error.png
notify-send "fail" -i error # from http://manpages.ubuntu.com/manpages/eoan/man1/notify-send.1.html
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