2022-12-05 01:25:26 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
|
2023-12-02 01:01:55 +00:00
|
|
|
export PUZZLE_NAME="$1"
|
2022-12-05 01:25:26 +00:00
|
|
|
|
2023-12-10 20:19:14 +00:00
|
|
|
export DAY="${2:-$(date +%d)}"
|
2023-12-02 01:01:55 +00:00
|
|
|
export DAY_SHORT=$(($DAY))
|
2022-12-05 01:25:26 +00:00
|
|
|
|
2023-12-02 01:01:55 +00:00
|
|
|
year=$(date +%Y)
|
|
|
|
dir="$year/day_$DAY"
|
2022-12-05 01:25:26 +00:00
|
|
|
|
2023-12-02 05:54:53 +00:00
|
|
|
mkdir "$dir"
|
2022-12-05 01:25:26 +00:00
|
|
|
|
2023-12-02 05:54:53 +00:00
|
|
|
envsubst < "solution.ts.template" > "$dir/solution.ts"
|
2023-12-02 01:01:55 +00:00
|
|
|
envsubst < "solution.test.ts.template" > "$dir/solution.test.ts"
|
2022-12-05 01:25:26 +00:00
|
|
|
|
2023-12-02 01:01:55 +00:00
|
|
|
touch "$dir/sample.txt"
|
2022-12-05 01:25:26 +00:00
|
|
|
|
2023-12-02 01:01:55 +00:00
|
|
|
curl -H "Cookie: $(cat ./session.cookie)" \
|
|
|
|
"https://adventofcode.com/$year/day/$DAY_SHORT/input" \
|
|
|
|
-o "$dir"/input.txt
|