2022 day01

This commit is contained in:
nora 2024-11-10 16:43:01 +01:00
parent fd2ea0612b
commit e153ec51cd
20 changed files with 3180 additions and 82 deletions

7
aoc.sh
View file

@ -10,16 +10,17 @@ function get_cookie {
cat aoc_cookie
}
year=2022
: "${1:?usage: ./aoc.sh new}"
case "$1" in
new)
: "${2:?usage: ./aoc.sh new DAY}"
day="$(printf %02d "$2")"
cp -r "2023/day00" "2023/day$day"
find "2023/day$day" -type f -exec sed -i -e "s/00/$day/g" {} \;
cp -r "$year/day00" "$year/day$day"
find "$year/day$day" -type f -exec sed -i -e "s/00/$day/g" {} \;
curl -H "Cookie: $(get_cookie)" "https://adventofcode.com/2023/day/$2/input" -o "2023/day$day/input.txt"
curl -H "Cookie: $(get_cookie)" "https://adventofcode.com/$year/day/$2/input" -o "$year/day$day/input.txt"
;;
*)
echo "usage: ./aoc.sh new" >&2