{"id":21564625,"url":"https://github.com/akosasante/advent-of-code-helper-elixir","last_synced_at":"2025-04-10T13:07:22.818Z","repository":{"id":45856135,"uuid":"99480973","full_name":"akosasante/Advent-Of-Code-Helper-Elixir","owner":"akosasante","description":"Access your advent of code inputs, right from elixir!","archived":false,"fork":false,"pushed_at":"2022-12-02T22:47:29.000Z","size":93,"stargazers_count":8,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-06-07T10:40:02.854Z","etag":null,"topics":["advent-of-code","elixir","hex-package"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/akosasante.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-06T11:04:14.000Z","updated_at":"2023-05-14T14:38:02.000Z","dependencies_parsed_at":"2023-01-22T20:30:32.265Z","dependency_job_id":null,"html_url":"https://github.com/akosasante/Advent-Of-Code-Helper-Elixir","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akosasante%2FAdvent-Of-Code-Helper-Elixir","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akosasante%2FAdvent-Of-Code-Helper-Elixir/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akosasante%2FAdvent-Of-Code-Helper-Elixir/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akosasante%2FAdvent-Of-Code-Helper-Elixir/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/akosasante","download_url":"https://codeload.github.com/akosasante/Advent-Of-Code-Helper-Elixir/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248224065,"owners_count":21068071,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["advent-of-code","elixir","hex-package"],"created_at":"2024-11-24T10:16:36.000Z","updated_at":"2025-04-10T13:07:22.799Z","avatar_url":"https://github.com/akosasante.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Advent of Code Helper [![Build Status](https://app.travis-ci.com/akosasante/Advent-Of-Code-Helper-Elixir.svg?branch=main)](https://app.travis-ci.com/github/akosasante/Advent-Of-Code-Helper-Elixir) [![codecov](https://codecov.io/gh/akosasante/Advent-Of-Code-Helper-Elixir/branch/main/graph/badge.svg?token=vssP39GcoL)](https://codecov.io/gh/akosasante/Advent-Of-Code-Helper-Elixir) [![Hex.pm](https://img.shields.io/hexpm/v/advent_of_code_helper.svg?style=plastic)](https://hex.pm/packages/advent_of_code_helper) [![hexdocs.pm](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/advent_of_code_helper/api-reference.html)\n\n\nThis Elixir package allows you to quickly grab inputs for Advent of ode puzzles, and not have to worry about manually pasting them in! After you've got a puzzle input for the first time, the result is stored on disk so every subsequent request bypasses the need to download it from the server again.\n\n## Usage\n\n### Via Mix Tasks\n\nThere are two mix tasks included in this library: `advent.setup_day` and `advent.run_day`.\n\nFor creating a new directory and `.ex` file for a given Advent puzzle, use the setup command:\n\n`mix advent.setup_day \u003cyear\u003e \u003cday\u003e` or `mix advent.setup_day \u003cday\u003e` \n\nwhere year is a four-digit integer (eg: 2022) and day is a number between 1 and 25. Year will be inferred as the current year if it's not passed in. A folder will be created under the `lib` directory of the mix project, and a skeleton module will be generated.\n\n\nTo run the code you've added to the generated template file, use the run command:\n\n`mix advent.run_day day=\u003cday\u003e year=\u003cyear\u003e bench=\u003cboolean\u003e split=\u003csplitOption\u003e sep=\u003csep\u003e trim=\u003cboolean\u003e`\n\nOnly `day` is a required argument. `Year` will be inferred as current year if it's not given, otherwise it should be a 4-digit number. \nIf bench is `true`, the task will run the day's puzzles through [benchee](https://github.com/bencheeorg/benchee) and return the benchmark results.\n\nBy default, (if no `split` or `sep` options are passed in), the puzzle input will be read as a string, split on newlines, and the resulting list will be passed into the puzzle module to be run.\nYou can change this behaviour by passing in either `list`, `stream`, or `false` for split. This will split the string into a List, a Stream, or leave the input as-is, respectively. The separator to use as the split boundary can be changed by passing in a `sep` argument; trimming extra newlines/whitespace can be enabled by setting `trim` to `true`.\n\n\n### Directly calling AdventOfCodeHelper\n\nThere are two main functions for fetching the puzzle input:\n\n```elixir\nAdventOfCodeHelper.get_input(year,day) # Specify year and day for puzzle\n\nAdventOfCodeHelper.get_input(day) # Automatically gets puzzle from most recent year\n\n```\n\nBoth of these functions will simply return a tuple `{:ok, value}` if they succeed, where `value` is the puzzle input in the form of a `String`, or `{:fail, message}` if there was something wrong.\n\n\nYou can also use the provided helpers for splitting the string input into a List or Stream: `split_to_list/2` and `split_to_stream/2`.\n\n\n### Configuration\n\nThere are two configuration directives that are also needed to make this package work correctly. Simply add the following to your `config/config.exs`\n\n```elixir\nconfig :advent_of_code_helper,\nsession: \"\u003csession string\u003e\",\ncache_dir: \".cache/\" # this is a sensible default, but feel free to put it wherever you have write access\n```\n\nThe session string will need to be taken from [adventofcode.com](https://adventofcode.com), it will be under cookies as `session`. You can extract the value using the inspector/devTools in your browser of choice.\n\n\n## Installation\n\nThis package can be installed by adding `advent_of_code_helper` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:advent_of_code_helper, \"~\u003e 0.3.1\"}\n  ]\nend\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakosasante%2Fadvent-of-code-helper-elixir","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakosasante%2Fadvent-of-code-helper-elixir","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakosasante%2Fadvent-of-code-helper-elixir/lists"}