I wrote a bash function to get my daily Advent of Code input. It
assumes that you are in a directory ending in the pattern year/day
,
where year is the year you’re doing the problems. Here’s the code
Steps to Use
- You’ll need to get your Advent of Code session id. You can extract
this by using the network inspector while in chrome, and grabbing the
value of the cookie header. It’s a rather long value.
- Set
my_cookie
to this value.
- Set
- Put this function into your
.bashrc
. - Source your updated
.bashrc
. - Run it like
~/src/2020/3 $ get_advent_input > input.txt
- Remember to redirect your output to where you want to put your program input.
- You may want to modify the curl command to automatically output to a
file, but I didn’t since I want to see the output, or use
tee
.