update scripts

This commit is contained in:
xenia 2020-12-14 19:55:55 -05:00
parent 1a2b3cfb9a
commit be494d8bfd
2 changed files with 8 additions and 7 deletions

View File

@ -7,12 +7,11 @@ export TZ="America/New_York"
function init_day { function init_day {
day=$(($(date +%-d))) day=$(($(date +%-d)))
if [ ! -f $day.rkt ]; then if [ ! -f inputs/$day ]; then
set -m set -m
scripts/get-challenge $day & scripts/get-challenge $day &
sleep 1 sleep 1
scripts/make-day $day scripts/get-input $day
tmux split-pane -v -- "bash -li <<< 'watch $day; exec</dev/tty'"
fg fg
return 1 return 1
fi fi
@ -21,6 +20,11 @@ function init_day {
if init_day; then if init_day; then
next_day=$((day + 1)) next_day=$((day + 1))
if [ ! -f $next_day.rkt ]; then
scripts/make-day $next_day
fi
next_timestamp=$(date --date="$(date +%Y-%m)-$next_day" +%s) next_timestamp=$(date --date="$(date +%Y-%m)-$next_day" +%s)
while true; do while true; do
secs_left=$((next_timestamp - $(date +%s))) secs_left=$((next_timestamp - $(date +%s)))

View File

@ -25,7 +25,4 @@
(call-with-output-file (call-with-output-file
(format "~a.rkt" day) (format "~a.rkt" day)
(lambda (out) (lambda (out)
(eval-template (path->string template) (hash 'day day) out))) (eval-template (path->string template) (hash 'day day) out))))
;; get input
(define in (aoc-fetch-input (getenv "AOC_YEAR") day (getenv "AOC_SESSION")))
(call-with-output-file (build-path "inputs" day) (lambda (out) (copy-port in out))))