1
0
Fork 0

setup 2025

This commit is contained in:
sloane 2025-12-03 09:38:00 -05:00
parent 0a5d25abb6
commit 835ad00ed1
No known key found for this signature in database
17 changed files with 141 additions and 0 deletions

1
2025/.env Normal file
View file

@ -0,0 +1 @@
SESSION_COOKIE=53616c7465645f5f72c2167a886b5ad84b79c7bd0781bfbf2cfd4814bcee55666ef54a7ff19e973043098359e30df3263605e989b7faf91439b0cfc453358b41

4
2025/.formatter.exs Normal file
View file

@ -0,0 +1,4 @@
# Used by "mix format"
[
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"]
]

25
2025/.gitignore vendored Normal file
View file

@ -0,0 +1,25 @@
# The directory Mix will write compiled artifacts to.
/_build/
# If you run "mix test --cover", coverage assets end up here.
/cover/
# The directory Mix downloads your dependencies sources to.
/deps/
# Where third-party dependencies like ExDoc output generated docs.
/doc/
# Temporary files, for example, from tests.
/tmp/
# If the VM crashes, it generates a dump, let's ignore it too.
erl_crash.dump
# Also ignore archive artifacts (built via "mix archive.build").
*.ez
# Ignore package tarball (built via "mix hex.build").
aoc-*.tar
/priv/inputs/*.txt

9
2025/README.md Normal file
View file

@ -0,0 +1,9 @@
# Advent of Code 2025
| S | M | T | W | T | F | S |
| :-: | :-: | :-: | :-: | :-: | :-: | :-: |
| | 1 | 2 | 3 | 4 | 5 | 6 |
| 7 | 8 | 9 | 10 | 11 | 12 | |

3
2025/config/config.exs Normal file
View file

@ -0,0 +1,3 @@
import Config
import_config "#{config_env()}.exs"

1
2025/config/dev.exs Normal file
View file

@ -0,0 +1 @@
import Config

1
2025/config/prod.exs Normal file
View file

@ -0,0 +1 @@
import Config

3
2025/config/runtime.exs Normal file
View file

@ -0,0 +1,3 @@
import Config
config :aoc, session_cookie: System.fetch_env!("SESSION_COOKIE")

1
2025/config/test.exs Normal file
View file

@ -0,0 +1 @@
import Config

45
2025/lib/aoc.ex Normal file
View file

@ -0,0 +1,45 @@
defmodule Aoc do
defmacro input do
day =
case Regex.run(~r/^Elixir\.Aoc\.Day(\d+)$/, "#{__CALLER__.module}", capture: :all_but_first) do
[day_str] ->
String.to_integer(day_str)
_ ->
raise "`input/0` must be called from a module of the format `Aoc.Day<n>`. Called in module #{inspect(__CALLER__.module)}"
end
quote do
input(unquote(day))
end
end
def input(day) do
input_file = :code.priv_dir(:aoc) |> Path.join("inputs/#{day}.txt")
if File.exists?(input_file) do
File.read!(input_file)
else
input = download_input(day)
File.write!(input_file, input)
input
end
end
def lines(str) do
String.split(str, "\n", trim: true)
end
defp download_input(day) do
Req.request!(
url: "https://adventofcode.com/2025/day/#{day}/input",
headers: [cookie: "session=#{session_cookie()}"]
).body
end
defp session_cookie do
Application.fetch_env!(:aoc, :session_cookie)
end
end

1
2025/lib/aoc/day_1.ex Normal file
View file

@ -0,0 +1 @@

6
2025/mise.toml Normal file
View file

@ -0,0 +1,6 @@
[env]
_.file = '.env'
[tools]
elixir = "1.19.4-otp-28"
erlang = "28.2"

27
2025/mix.exs Normal file
View file

@ -0,0 +1,27 @@
defmodule Aoc.MixProject do
use Mix.Project
def project do
[
app: :aoc,
version: "0.1.0",
elixir: "~> 1.19",
start_permanent: Mix.env() == :prod,
deps: deps()
]
end
# Run "mix help compile.app" to learn about applications.
def application do
[
extra_applications: [:logger]
]
end
# Run "mix help deps" to learn about dependencies.
defp deps do
[
{:req, "~> 0.5.16"}
]
end
end

11
2025/mix.lock Normal file
View file

@ -0,0 +1,11 @@
%{
"finch": {:hex, :finch, "0.20.0", "5330aefb6b010f424dcbbc4615d914e9e3deae40095e73ab0c1bb0968933cadf", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mint, "~> 1.6.2 or ~> 1.7", [hex: :mint, repo: "hexpm", optional: false]}, {:nimble_options, "~> 0.4 or ~> 1.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:nimble_pool, "~> 1.1", [hex: :nimble_pool, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "2658131a74d051aabfcba936093c903b8e89da9a1b63e430bee62045fa9b2ee2"},
"hpax": {:hex, :hpax, "1.0.3", "ed67ef51ad4df91e75cc6a1494f851850c0bd98ebc0be6e81b026e765ee535aa", [:mix], [], "hexpm", "8eab6e1cfa8d5918c2ce4ba43588e894af35dbd8e91e6e55c817bca5847df34a"},
"jason": {:hex, :jason, "1.4.4", "b9226785a9aa77b6857ca22832cffa5d5011a667207eb2a0ad56adb5db443b8a", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "c5eb0cab91f094599f94d55bc63409236a8ec69a21a67814529e8d5f6cc90b3b"},
"mime": {:hex, :mime, "2.0.7", "b8d739037be7cd402aee1ba0306edfdef982687ee7e9859bee6198c1e7e2f128", [:mix], [], "hexpm", "6171188e399ee16023ffc5b76ce445eb6d9672e2e241d2df6050f3c771e80ccd"},
"mint": {:hex, :mint, "1.7.1", "113fdb2b2f3b59e47c7955971854641c61f378549d73e829e1768de90fc1abf1", [:mix], [{:castore, "~> 0.1.0 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:hpax, "~> 0.1.1 or ~> 0.2.0 or ~> 1.0", [hex: :hpax, repo: "hexpm", optional: false]}], "hexpm", "fceba0a4d0f24301ddee3024ae116df1c3f4bb7a563a731f45fdfeb9d39a231b"},
"nimble_options": {:hex, :nimble_options, "1.1.1", "e3a492d54d85fc3fd7c5baf411d9d2852922f66e69476317787a7b2bb000a61b", [:mix], [], "hexpm", "821b2470ca9442c4b6984882fe9bb0389371b8ddec4d45a9504f00a66f650b44"},
"nimble_pool": {:hex, :nimble_pool, "1.1.0", "bf9c29fbdcba3564a8b800d1eeb5a3c58f36e1e11d7b7fb2e084a643f645f06b", [:mix], [], "hexpm", "af2e4e6b34197db81f7aad230c1118eac993acc0dae6bc83bac0126d4ae0813a"},
"req": {:hex, :req, "0.5.16", "99ba6a36b014458e52a8b9a0543bfa752cb0344b2a9d756651db1281d4ba4450", [:mix], [{:brotli, "~> 0.3.1", [hex: :brotli, repo: "hexpm", optional: true]}, {:ezstd, "~> 1.0", [hex: :ezstd, repo: "hexpm", optional: true]}, {:finch, "~> 0.17", [hex: :finch, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:mime, "~> 2.0.6 or ~> 2.1", [hex: :mime, repo: "hexpm", optional: false]}, {:nimble_csv, "~> 1.0", [hex: :nimble_csv, repo: "hexpm", optional: true]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "974a7a27982b9b791df84e8f6687d21483795882a7840e8309abdbe08bb06f09"},
"telemetry": {:hex, :telemetry, "1.3.0", "fedebbae410d715cf8e7062c96a1ef32ec22e764197f70cda73d82778d61e7a2", [:rebar3], [], "hexpm", "7015fc8919dbe63764f4b4b87a95b7c0996bd539e0d499be6ec9d7f3875b79e6"},
}

View file

View file

@ -0,0 +1 @@
ExUnit.start()

View file

@ -16,6 +16,7 @@
| [2022] | **14/50** 🌟 | Elixir, Haskell |
| [2023] | **19/50** 🌟 | Elixir, Haskell |
| [2024] | **30/50** 🌟 | Elixir |
| [2025] | **0/24** 🌟 | Elixir |
| **Total** | **186** 🌟| |
[2015]: ./2015
@ -25,3 +26,4 @@
[2022]: ./2022
[2023]: ./2023
[2024]: ./2024
[2025]: ./2025