Skip to content

Instantly share code, notes, and snippets.

@supertunaman
Created November 26, 2012 16:10
Show Gist options
  • Save supertunaman/4149016 to your computer and use it in GitHub Desktop.
Save supertunaman/4149016 to your computer and use it in GitHub Desktop.
Because this was so needed.
#!/bin/bash
MPD_HOST=192.168.0.105
MPC=/usr/bin/mpc
NOISY_SHIT='Cowboy Bebop/Cowboy Bebop OST 1 - Cowboy Bebop/01 - Tank!.mp3'
CHECK_URL="http://flying.sexsnak.es/alarmclockdisable"
CHECK_FILE="/root/.alarmclockdisable"
check_disabled() {
# are we really going to do this?
echo -n "Checking if disabled via HTTP request... "
disabled=$(/usr/bin/curl -I $CHECK_URL 2>/dev/null | grep -c '^HTTP/1.1 200 OK')
if [ $disabled -eq 0 ]; then
echo 'PASS'
else
echo 'STOPPING!'
echo "$CHECK_URL returns 200."
exit
fi
echo -n "Checking if disabled via $CHECK_FILE... "
if [ -f $CHECK_FILE ]; then
echo 'STOPPING!'
echo "$CHECK_FILE exists."
rm -fv $CHECK_FILE # so we have a temporary alarm stop (this file) and a semi-permanent one (the HTTP check)
exit
else
echo 'PASS'
fi
}
email_me() {
date | mail -s 'Dear appletini, pl0x wake up, sincerely komputah.' rev@badthin.gs
}
incessant_beeping() {
# final warning before I start blasting music at 9pm for 3 hours.
for i in {1..27}; do
/usr/bin/beep -f 659 -l 460 -n -f 784 -l 340 -n -f 659 -l 230 -n -f 659 -l 110 -n -f 880 -l 230 -n -f 659 -l 230 -n -f 587 -l 230 -n -f 659 -l 460 -n -f 988 -l 340 -n -f 659 -l 230 -n -f 659 -l 110 -n -f 1047-l 230 -n -f 988 -l 230 -n -f 784 -l 230 -n -f 659 -l 230 -n -f 988 -l 230 -n -f 1318 -l 230 -n -f 659 -l 110 -n -f 587 -l 230 -n -f 587 -l 110 -n -f 494 -l 230 -n -f 740 -l 230 -n -f 659 -l 460
sleep 1
done
}
annoy_neighbors() {
$MPC clear
$MPC volume 100
$MPC repeat
$MPC add "$NOISY_SHIT"
$MPC play
}
check_disabled
email_me
incessant_beeping
check_disabled # i might disable the alarm clock before it's finished witht he incessant beeping
annoy_neighbors # sorry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment