Created
November 25, 2008 22:55
-
-
Save tommorris/29150 to your computer and use it in GitHub Desktop.
Linux (ALSA) command line alarm clock
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
#!/usr/bin/env ruby | |
# Linux (ALSA) command line alarm clock | |
# written in Ruby, but you can use any language you like. | |
# store original volume and set volume to 100% | |
original_volume = `amixer get Master | grep 'Front Left' | cut -d ' ' -f 6`.chop.to_i | |
`amixer set Master front 65536` | |
# I'm using 'Alarm Clock 2' from http://www.pacdv.com/sounds/domestic_sounds.html | |
`aplay ~/Downloads/alarm_clock_2.wav > /dev/null` | |
# it only lasts twelve seconds, so you may wish to wrap it in a 5.times {} block. | |
# set volume back to original | |
`amixer set Master front #{original_volume.to_s}` | |
# you can invoke this from a crontab or use the 'at' command (look it up | |
# in the man pages |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment