Skip to content

Instantly share code, notes, and snippets.

@tobias
Created July 14, 2009 12:11
Show Gist options
  • Select an option

  • Save tobias/146913 to your computer and use it in GitHub Desktop.

Select an option

Save tobias/146913 to your computer and use it in GitHub Desktop.
#!/opt/local/bin/ruby
def play_alert()
play = 'afplay /System/Library/Sounds/Ping.aiff;'
%x{#{play * 2}}
end
def run_timers(timers)
timers.each do |seconds, times|
times.to_i.times do |index|
puts "Will beep in #{seconds} seconds (#{index + 1} of #{times})"
sleep(seconds.to_i)
play_alert()
end
end
end
timers = ARGV.collect { |x| x.split(/,/) }
run_timers(timers)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment