Skip to content

Instantly share code, notes, and snippets.

@Unihedro
Created December 1, 2020 05:21
Show Gist options
  • Save Unihedro/c9ac8ca4e1d6cd60bb19494f7f2875f6 to your computer and use it in GitHub Desktop.
Save Unihedro/c9ac8ca4e1d6cd60bb19494f7f2875f6 to your computer and use it in GitHub Desktop.
my aoc input downloader.sh
#!/bin/bash
DAY=$(( $(date -d "$D" '+%d') ))
#DAY=9
echo "https://adventofcode.com/2020/day/$DAY/input"
while true;do
if [[ $(curl "https://adventofcode.com/2020/day/$DAY/input" -H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' -H 'cookie: session=[my session cookie dun hack pls]' --compressed --output input -w "%{response_code}") != 404 ]]; then
stat input
head input
break
fi
sleep 3
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment