initial commit

This commit is contained in:
Peter Tillemans 2024-11-17 22:32:08 +01:00
commit dff2cf26fc
6 changed files with 128 additions and 0 deletions

9
.gitignore vendored Normal file
View file

@ -0,0 +1,9 @@
*.abcl
*.fasl
*.dx32fsl
*.dx64fsl
*.lx32fsl
*.lx64fsl
*.x86f
*~
.#*

17
README.markdown Normal file
View file

@ -0,0 +1,17 @@
# Aoc - Advent of Code challenges and solutions.
## Usage
## Installation
## Author
* Peter Tillemans (pti@snamellit.com)
## Copyright
Copyright (c) 2024 Peter Tillemans (pti@snamellit.com)
## License
Licensed under the MIT License.

17
README.org Normal file
View file

@ -0,0 +1,17 @@
* Aoc - Advent of Code challenges and solutions.
** Usage
** Installation
** Author
+ Peter Tillemans (pti@snamellit.com)
** Copyright
Copyright (c) 2024 Peter Tillemans (pti@snamellit.com)
** License
Licensed under the MIT License.

30
aoc.asd Normal file
View file

@ -0,0 +1,30 @@
(defsystem "aoc"
:long-name "Advent of Code"
:version "0.1.0"
:author "Peter Tillemans"
:maintainer "Peter Tillemans"
:mailto "pti@snamellit.com"
:license "MIT"
:homepage "https://forge.snamellit.com/pti/aoc-cl"
:bug-tracker "https://forge.snamellit.com/pti/aoc-cl/issues"
:source-control "https://forge.snamellit.com/pti/aoc-cl"
:depends-on (#:dexador
#:plump
#:lquery)
:components ((:module "src"
:components
((:file "main"))))
:description "Advent of Code challenges and solutions."
:long-description "Solutions for the AOC challenges."
:in-order-to ((test-op (test-op "aoc/tests"))))
(defsystem "aoc/tests"
:author "Peter Tillemans"
:license "MIT"
:depends-on ("aoc"
"rove")
:components ((:module "tests"
:components
((:file "main"))))
:description "Test system for aoc"
:perform (test-op (op c) (symbol-call :rove :run c)))

44
src/main.lisp Normal file
View file

@ -0,0 +1,44 @@
(defpackage aoc
(:use :cl))
(in-package :aoc)
(defun load-ql-dependencies ()
())
(defvar *aoc-url* "https://adventofcode.com")
(defvar *cookie-jar*
(cl-cookie:make-cookie-jar
:cookies (list
(cl-cookie:make-cookie
:name "session"
:value (uiop:getenv "AOC_SESSION")
:origin-host "adventofcode.com"
:path "/"
:domain ".adventofcode.com"
:secure-p t))))
(setf *cookie-jar*
(cl-cookie:make-cookie-jar
:cookies (list
(cl-cookie:make-cookie
:name "session"
:value (uiop:getenv "AOC_SESSION")
:origin-host "adventofcode.com"
:path "/"
:domain ".adventofcode.com"
:secure-p t))))
(defun test-input (year day)
(let ((url (format nil "~A/~D/day/~D/input" *aoc-url* year day)))
(multiple-value-bind
(body)
(dex:get url :cookie-jar *cookie-jar* :verbose t)
body)))

11
tests/main.lisp Normal file
View file

@ -0,0 +1,11 @@
(defpackage aoc/tests/main
(:use :cl
:aoc
:rove))
(in-package :aoc/tests/main)
;; NOTE: To run this test file, execute `(asdf:test-system :aoc)' in your Lisp.
(deftest test-target-1
(testing "should (= 1 1) to be true"
(ok (= 1 1))))