Setup AoC for 2025

This commit is contained in:
Thraix
2025-11-30 16:31:38 +01:00
parent 76d824471c
commit 24ae9b5069
14 changed files with 507 additions and 8 deletions
+11 -3
View File
@@ -14,8 +14,16 @@ for item in $list; do
if [ ! -e $dir ]; then
webitem=$(echo $day | sed 's/^0//g')
echo "Fetching $dir"
mkdir -p "res/$year/day$day/"
touch "res/$year/day$day/test_input.txt"
curl -s --cookie cookies.txt https://adventofcode.com/$year/day/$webitem/input >$dir
tmp_file=$(mktemp)
HTTP_CODE=$(curl -s -w "%{http_code}" -o "$tmp_file" --cookie cookies.txt https://adventofcode.com/$year/day/$webitem/input)
if [ "$HTTP_CODE" -eq 200 ]; then
mkdir -p "res/$year/day$day/"
touch "res/$year/day$day/test_input.txt"
mv "$tmp_file" $dir
else
echo "Failed to fetch with status: $HTTP_CODE"
rm "$tmp_file"
exit 1
fi
fi
done