From 63a4c3122b04d347152d6949e1abd7ad75a12634 Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Wed, 25 Sep 2019 07:16:15 -0500 Subject: [PATCH] Add helpful scripts for timing stuff --- scripts/bin/countdown | 13 +++++++++++++ scripts/bin/sw | 11 +++++++++++ 2 files changed, 24 insertions(+) create mode 100755 scripts/bin/countdown create mode 100755 scripts/bin/sw diff --git a/scripts/bin/countdown b/scripts/bin/countdown new file mode 100755 index 0000000..aa88762 --- /dev/null +++ b/scripts/bin/countdown @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +d=$((`date +%s` + $1)); +echo "Countdown started $(date)" + +while [ "$d" -ge $(date +%s) ]; do + _dt=$(($d - `date +%s`)) + days=$((_dt / 86400)) + echo -ne "\r${days}d $(date -u --date @$((_dt)) +%H:%M:%S) "; + sleep 0.1 +done + +echo -ne "\rCountdown finished $(date)\n" diff --git a/scripts/bin/sw b/scripts/bin/sw new file mode 100755 index 0000000..58f1713 --- /dev/null +++ b/scripts/bin/sw @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +d="$(date +%s)" +echo "Stopwatch started $(date)" + +while true; do + _dt=$((`date +%s` - d)) + days=$((_dt / 86400)) + echo -ne "\r${days}d $(date -u --date @$((_dt)) +%H:%M:%S) " + sleep 0.1 +done