AdventOfCode2024/today.sh
2024-12-04 22:18:24 -05:00

22 lines
588 B
Bash
Executable File

#!/bin/bash
__year=2024
__day="${1}"
if [ "${__day}" == "" ]; then
__day=$(date '+%d')
fi
padded=$(printf "%02g" ${__day})
mkdir -p ${padded}/inputs
touch ${padded}/inputs/testinput
if [ ! -f "${padded}/inputs/input" ]; then
curl -s \
-A "https://git.yetaga.in/alazyreader/AdventOfCode${__year}/" \
-H "Cookie: session=`cat .cookie`" https://adventofcode.com/${__year}/day/${__day##0}/input > "${padded}/inputs/input"
fi
if [ ! -f "${padded}/index.ts" ]; then
cp index.ts.tmpl ${padded}/index.ts
fi
open "https://adventofcode.com/${__year}/day/${__day##0}"