From f47445775d915c72d838bae15e0416dbbf38e124 Mon Sep 17 00:00:00 2001 From: augustin64 Date: Tue, 19 Dec 2023 21:54:30 +0100 Subject: [PATCH] Add timer --- utils/new_day.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/utils/new_day.sh b/utils/new_day.sh index 7fa9bde..d137e00 100755 --- a/utils/new_day.sh +++ b/utils/new_day.sh @@ -10,9 +10,17 @@ DAY="$1" YEAR="$2" FILENAME="${YEAR}/day${DAY}.py" -python utils/cli.py download -y $YEAR -d $DAY -python utils/cli.py show -y $YEAR -d $DAY - cp utils/template.py "$FILENAME" sed -i "s/DAY/${DAY}/" "$FILENAME" sed -i "s/YEAR/${YEAR}/" "$FILENAME" +codium "$PWD" "$PWD/$FILENAME" + +if [[ $(date +%H) -lt 6 ]]; then + SECONDS_UNTIL_START=$(( $(date -f - +%s- <<< "today 06:00"$'\nnow') 0 )) + echo "Waiting ${SECONDS_UNTIL_START} seconds.." + sleep $SECONDS_UNTIL_START; +fi; +echo "Goooooo !" + +python utils/cli.py download -y $YEAR -d $DAY +python utils/cli.py show -y $YEAR -d $DAY \ No newline at end of file