To quickly get started with a day, you can copy-paste this template:
today.ua
~ "git: github.com/amatgil/steal-gift" ~ AoCGet
# ====== INPUTS ======
Input ← AoCGet YEAR DAY
# ====== PART 1 ======
Part₁ ← ∘
# ====== TESTS =======
⍤⤙≍ "testsol1" Part₁ "testcase1"
# ======== RUNNING ========
#$"Part one solution is: '_'" Part₁ Input
.env
session="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
cachedInputsPath="/tmp/aoc-inputs" # Any path, may be relative
debug="any text here works!" # Enables information
IMPORTANT: You must place your session cookie and path inside a .env
file, like such:
# In .env
session="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
cachedInputsPath="/tmp/aoc-inputs" # Any path, may be relative
debug="hello hai :3" # Tells you if it the input was obtained from the server or locally
session
: Your Advent of Code (since the input changes per person). To get it, log into your account at adventofcode.com and use the DevTools to find it.cachedInputPath
: Where all inputs will be saved. For example, if you choose/tmp/aoc-inputs
, it'll slowly get populated by/tmp/aoc-inputs/2024-01.txt
,/tmp/aoc-inputs/2024-02.txt
, ...debug
: If this variable exists at all, it is taken as "true"; "false" otherwise. If true, it includes prints telling you the source of the input (server or locally).
Then, in your code, you may run:
Input ← AoCGet 2023 2
Which will download day 2, from the year 2023, to $cachedInputPath/2023-02.txt
.
If you've already got a file with that name, it will be read directly. If not, it will be fetched and saved under that name, so subsequent calls shall read from it.