aoc/scripts/get_input.sh

21 lines
383 B
Bash
Executable File

#!/usr/bin/env zsh
get(){
curl -s --cookie "session=$1" "$2" | perl -pe 'chomp if eof' > "$3"
}
rm -rf input
for year in {2015..2023}; do
mkdir -p input/"$year"
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"
get "$1" "$url" "input/$year/$d" &
done
touch "input/$year/test"
done