dip

old school recipes for janitorial snafu.
git clone git://git.ricketyspace.net/dip.git
Log | Files | Refs

commit 195a67d7e20d9b9f69c60f3ea90f64749e15b0b5
parent e6780bdc5a08cbdb8caa281d72c5ee87b2616e17
Author: rsiddharth <s@ricketyspace.net>
Date:   Thu, 24 May 2018 22:21:16 +0000

usr: Add alarm (from dotfiles).

Diffstat:
usr/local/bin/alarm | 22++++++++++++++++++++++
1 file changed, 22 insertions(+), 0 deletions(-)

diff --git a/usr/local/bin/alarm b/usr/local/bin/alarm @@ -0,0 +1,22 @@ +#!/bin/sh +# +# License: CC0-1.0 +# +# Usage +# +# $ alarm HH:MM +# + +# Time in seconds since epoch. +TIME=$(date --date="$1" +%s 2> /dev/null); + +if [ -z $TIME ];then + echo 'Invalid time' + exit 1 +fi + +# Calculate delay [ time - current_time ] +FOR=$(($TIME - $(date +%s))) + +echo "Will disturb in " $FOR "seconds." +sleep $FOR; mpc play