aoc/get_input.sh

21 lines
380 B
Bash
Raw Normal View History

2024-08-13 08:32:35 -07:00
#!/usr/bin/env sh
2021-07-14 13:50:33 -07:00
2023-11-29 13:51:48 -08:00
get(){
curl -s --cookie "session=$1" "$2" | perl -pe 'chomp if eof' > "$3"
}
rm -rf input
2023-11-29 13:51:48 -08:00
for year in {2015..2023}; do
2022-09-09 11:13:53 -07:00
mkdir -p input/"$year"
2021-07-14 13:50:33 -07:00
for day in {1..25}; do
if [[ day -lt 10 ]]; then
d="0$day"
else
d="$day"
fi
url="https://adventofcode.com/$year/day/$day/input"
2024-08-13 08:32:35 -07:00
get "$1" "$url" "input/$year/$d"
2021-07-14 13:50:33 -07:00
done
2022-09-09 11:13:53 -07:00
touch "input/$year/test"
2021-07-14 13:50:33 -07:00
done