An umbrella project for Advent of Code exercises.
aoc init
lang/${LANG}/run ${YEAR} ${DAY}
lang/${LANG}/test ${YEAR}
I like to use AoC each year to learn a new programming language. Unfortunately, this means installing a new programming language each year, keeping it updated as needed, and remembering to uninstall it once AoC is complete for the year. Toolchain managers like asdf take some of the pain away, but not all of it.
Another thing I'd like to try is using a year's solutions in one language to help learn another. Depending on how I go about it, I could be downloading and storing multiple copies of the contest data. I'd like to avoid this if possible.
I decided to see if I could leverage Docker. Several advantages came to mind:
- Docker containers can mount storage, and this storage can be shared by several containers. I'll need to take care to not write to storage from more than one container.
- Docker images for programming languages are commonly available, so working with a new language should be as simple as finding an image and creating a container from it.
Follow these instructions to get your auth token and paste it in the prompt below.
- Open https://adventofcode.com/auth/login in a web browser.
- Open your browser's developer tools (usually F12) and switch to the network tab.
- On the Advent of Code login page, click on the link for the auth provider of your choice.
- Follow the steps to complete authentication. This should result in a logged-in Advent of Code page.
- Switch back to the developer tools and look for a network request starting with "callback?" - click on it.
- Under Response headers, find the "set-cookie" header and look for a string starting with "session=".
- Paste everything after "session=" until the semicolon into the prompt below.
-
aoc-get
to fetch data