Skip to content

Commit

Permalink
AOC helper
Browse files Browse the repository at this point in the history
  • Loading branch information
dawranliou committed Dec 3, 2023
1 parent 49655c2 commit db45487
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions 2023/aoc.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
;; Adapted from https://gist.github.com/amno1/08f4d98b425b44bb342acbfbe183116a

(defun save-input-for-day (arg day)
"Save the input of the year 2023 and DAY."
(interactive "P\nnAdvent of Code 2023 Day: ")
(let* ((year 2023)
(url (format "https://adventofcode.com/2023/day/2/input" day))
(input (expand-file-name (format "input/day-%02d-input.txt" day)
default-directory))
(cookie (with-temp-buffer
(insert-file-contents (expand-file-name "session_id" default-directory))
(buffer-substring-no-properties (point-min) (point-max))))
(url-request-extra-headers (list (cons "Cookie" (concat "session=" cookie)))))
(url-copy-file url input)))

0 comments on commit db45487

Please sign in to comment.