The goal of aocodeR is to help me solve and share my advent of code puzzles.
aoc_get_input()
functionWith the help of my colleague Phil Tooley, I wrote a function to get the input for a given day directly from the Advent of Code server. It defaults to inputs for 2017
puzzles but you can override that by supplying a different year to year
. The server also needs to know who the user is so the path to a .txt
file containing a users session cookie needs to be supplied to argument cookie_path
.
library(devtools)
install_github("annakrystalli/aocodeR")
aoc_get_input(day = 1, cookie_path = "~/Documents/workflows/hackathon-output-repos/advent_of_code/secrets/session_cookie.txt")
In chrome, get your cookie details by clicking on the triple dot menu
value
column for row session
. Save that as a text file.I like solving my puzzles in vignettes and am compiling and sharing them in a github repo. Because many parts of documenting my puzzle solutions are repetitive across days, I made a .Rmd
template I can reuse which is also available through this package! There are a few paths and links that default to settings I want but you can either overwrite them or delete them all together.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.