37 lines
791 B
Bash
Executable File
37 lines
791 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# 👆 hazel i hope you're happy
|
|
|
|
# challenges released in EST
|
|
export TZ="America/New_York"
|
|
|
|
function init_day {
|
|
day=$(($(date +%-d)))
|
|
|
|
if [ ! -f $day.rkt ]; then
|
|
set -m
|
|
scripts/get-challenge $day &
|
|
sleep 1
|
|
scripts/make-day $day
|
|
fg
|
|
return 1
|
|
fi
|
|
return 0
|
|
}
|
|
|
|
if init_day; then
|
|
next_day=$((day + 1))
|
|
next_timestamp=$(date --date="$(date +%Y-%m)-$next_day" +%s)
|
|
while true; do
|
|
secs_left=$((next_timestamp - $(date +%s)))
|
|
if [ $secs_left -le 0 ]; then
|
|
break
|
|
fi
|
|
out=$(printf "\r\x1b[H\x1b[J";
|
|
printf "%s secs left..." "$secs_left" | toilet --gay -f slant)
|
|
echo -n "$out"
|
|
sleep 0.3
|
|
done
|
|
printf "\r\x1b[K"
|
|
init_day
|
|
fi
|