15 lines
470 B
Plaintext
15 lines
470 B
Plaintext
|
#!/usr/bin/env racket
|
||
|
#lang racket
|
||
|
|
||
|
(require net/http-client)
|
||
|
(define *year* "2020")
|
||
|
|
||
|
(command-line
|
||
|
#:program "get-input"
|
||
|
#:args (day)
|
||
|
(define-values [status headers content]
|
||
|
(http-sendrecv "adventofcode.com" (format "/~a/day/~a/input" *year* day)
|
||
|
#:ssl? #t
|
||
|
#:headers (list (format "Cookie: session=~a" (getenv "AOC_SESSION")))))
|
||
|
(call-with-output-file (build-path "inputs" day) (lambda (out) (copy-port content out))))
|