2020-12-03 06:09:19 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
# 👆 hazel i hope you're happy
|
|
|
|
|
|
|
|
# challenges released in EST
|
|
|
|
export TZ="America/New_York"
|
|
|
|
|
|
|
|
function init_day {
|
2020-12-09 04:39:43 +00:00
|
|
|
day=$(($(date +%-d)))
|
2020-12-03 06:09:19 +00:00
|
|
|
|
|
|
|
if [ ! -f $day.rkt ]; then
|
2020-12-06 05:44:32 +00:00
|
|
|
set -m
|
|
|
|
scripts/get-challenge $day &
|
|
|
|
sleep 1
|
2020-12-03 06:09:19 +00:00
|
|
|
scripts/make-day $day
|
2020-12-12 06:52:02 +00:00
|
|
|
tmux split-pane -v -- "bash -li <<< 'watch $day; exec</dev/tty'"
|
2020-12-06 05:44:32 +00:00
|
|
|
fg
|
2020-12-03 06:09:19 +00:00
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
if init_day; then
|
2020-12-03 06:14:43 +00:00
|
|
|
next_day=$((day + 1))
|
2020-12-03 06:09:19 +00:00
|
|
|
next_timestamp=$(date --date="$(date +%Y-%m)-$next_day" +%s)
|
|
|
|
while true; do
|
2020-12-03 06:14:43 +00:00
|
|
|
secs_left=$((next_timestamp - $(date +%s)))
|
2020-12-03 06:09:19 +00:00
|
|
|
if [ $secs_left -le 0 ]; then
|
|
|
|
break
|
|
|
|
fi
|
2020-12-10 04:55:15 +00:00
|
|
|
out=$(printf "\r\x1b[H\x1b[J";
|
|
|
|
printf "%s secs left..." "$secs_left" | toilet --gay -f slant)
|
|
|
|
echo -n "$out"
|
2020-12-03 06:14:43 +00:00
|
|
|
sleep 0.3
|
2020-12-03 06:09:19 +00:00
|
|
|
done
|
|
|
|
printf "\r\x1b[K"
|
|
|
|
init_day
|
|
|
|
fi
|