commit dff2cf26fce5a3b794246b39850cec7534b35558 Author: Peter Tillemans Date: Sun Nov 17 22:32:08 2024 +0100 initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b9fa3c1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +*.abcl +*.fasl +*.dx32fsl +*.dx64fsl +*.lx32fsl +*.lx64fsl +*.x86f +*~ +.#* diff --git a/README.markdown b/README.markdown new file mode 100644 index 0000000..baeaabc --- /dev/null +++ b/README.markdown @@ -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. diff --git a/README.org b/README.org new file mode 100644 index 0000000..d95e364 --- /dev/null +++ b/README.org @@ -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. diff --git a/aoc.asd b/aoc.asd new file mode 100644 index 0000000..714f853 --- /dev/null +++ b/aoc.asd @@ -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))) diff --git a/src/main.lisp b/src/main.lisp new file mode 100644 index 0000000..63a91b1 --- /dev/null +++ b/src/main.lisp @@ -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))) + + diff --git a/tests/main.lisp b/tests/main.lisp new file mode 100644 index 0000000..43d9d34 --- /dev/null +++ b/tests/main.lisp @@ -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))))