-
Notifications
You must be signed in to change notification settings - Fork 0
/
woof.bash
87 lines (75 loc) · 2.38 KB
/
woof.bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#################################
# _ ______ ____ ______ #
# | | / / __ \/ __ \/ ____/ #
# | | /| / / / / / / / / /_ #
# | |/ |/ / /_/ / /_/ / __/ #
# |__/|__/\____/\____/_/ #
#################################
# Some utilities for sending notifiations to yourself from the command line
# (mac only). Just add them to your ~/.bashrc and fill in these parameters.
# See them all in action:
#
# music <long running command> && woof command succeeed || woof command failed
TWITTER_HANDLE= # twitter handle
EMAIL_ADDRESS= # email address
CELL_EMAIL_ADDRESS= # email address for your cell phone (ie [email protected])
TERMINAL_APP="com.apple.Terminal" # replace with iterm if you use that
THEME_SONG="~/waiting.mp3" # replace with a path to your theme song
# we recommend jeopardy
# play music file in THEME_SONG continuously
playmusic() {
if [ ! -f ${THEME_SONG} ]
then
echo "You need to download a theme song to ${THEME_SONG}. We recommend the jeopardy theme"
else
while :; do afplay ${THEME_SONG}; done;
fi
}
# Play your theme song until a command finishes
# Usage: music git status
music() {
playmusic &
tokill=$!
echo $tokill
$*;
kill $tokill
killall afplay
}
# Display a growl notification (install https://github.com/alloy/terminal-notifier first)
# Usage: notify your job just finished
notify() {
terminal-notifier -title "$*" -message "$*" -activate ${TERMINAL_APP} # replace with iterm if you use that
}
# Send yourself a text
# Usage: text your job just finished
text() {
echo "$*" | mail -s "" ${CELL_EMAIL_ADDRESS}
}
# Send a tweet (set up https://github.com/twitter/twurl first)
# Usage: tweet my job just finished
tweet() {
twurl -d "status=$*" /1.1/statuses/update.json
}
# Send yourself a twitter direct message (set up https://github.com/twitter/twurl first)
# Usage: dm_me your job just finished
dm_me() {
twurl -d "text=$*&screen_name=${TWITTER_HANDLE}" /1.1/direct_messages/new.json
}
# Send yourself an email
# Usage: email your job just finished
email() {
echo "$*" | mail -s "" ${EMAIL_ADDRESS}
}
# Also note that the "say" command is built into mac osx
# Usage: say your job just finished
# Send yourself a message by all available means
# Usage: woof your job just finished
woof() {
email $*
dm_me $*
text $*
notify $*
say $*
# uncomment this if you want to tweet as well:
# tweet $*
}