Last active
December 22, 2015 10:28
-
-
Save sadbox/6458721 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| if [ "$(whoami)" != "root" ] | |
| then | |
| echo "Must run as root." | |
| exit 1 | |
| fi | |
| for program in wget mplayer | |
| do | |
| hash $program 2>/dev/null || { echo >&2 "I require $program but it's not installed. Aborting."; exit 1; } | |
| done | |
| clean_up() { | |
| echo "RAVE CONCLUDED!" | |
| echo 0 > /sys/class/leds/tpacpi\:\:thinklight/brightness | |
| kill -9 $mplayerpid | |
| exit 0 | |
| } | |
| trap clean_up INT | |
| if [ ! -e /tmp/rave.wav ] | |
| then | |
| echo "FETCHING EPIC BEATS!" | |
| wget -O /tmp/rave.wav sadbox.org/static/rave.wav 1> /dev/null 2>&1 | |
| fi | |
| echo "RAVE TIME!" | |
| mplayer -loop 0 /tmp/rave.wav 1>/dev/null 2>&1 & | |
| mplayerpid=$! | |
| while true | |
| do | |
| echo 255 > /sys/class/leds/tpacpi\:\:thinklight/brightness | |
| sleep .05 | |
| echo 0 > /sys/class/leds/tpacpi\:\:thinklight/brightness | |
| sleep .05 | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment