From 5869505d64c04c536bdcd71a197ade918c36bf1c Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Sun, 10 Aug 2014 11:19:38 +0100 Subject: init --- alarm | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 alarm (limited to 'alarm') diff --git a/alarm b/alarm new file mode 100755 index 0000000..0aa0381 --- /dev/null +++ b/alarm @@ -0,0 +1,24 @@ +#!/usr/bin/env ruby + + +u = ARGV[0][-1] +t = ARGV[0][0..-2].to_f + +if u == 'h' + t *= 60 + t *= 60 +elsif u == 'm' + t *= 60 +elsif u == 's' + true +else + exit +end + +t = t.round(0) + +puts "sleeping for to #{t} seconds" + +sleep t +`mplayer ~/var/alarm.mp3 &>/dev/null` + -- cgit v1.2.3