New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

advent-of-code

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

advent-of-code

A cli to help initialize/run JavaScript advent-of-code challenges.

  • 2.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-85.71%
Maintainers
1
Weekly downloads
 
Created
Source

advent-of-code

A cli to help initialize/run JavaScript advent-of-code challenges.

Installation

$ npm install -g advent-of-code

Usage

Display help

$ advent help

Initialize a day

$ advent init <day> [--year <year>] [--session <session>]

Options

  • <day> - The day to initialize. Will create a file in the current working directory called day{day}.js. You can run advent init <day> again and it won't do anything.
  • --year <year> - If making a request to adventofcode.com, this is the year to use when pulling down the description. The default year is the previous year, unless it is the month of December.

Run a day's code

$ advent run <day> <part> <input> [--year <year>] [--session <session>]

Options

  • <day> - The day to initialize. Will look for a file called day{day}.js in the current working directory
  • <part> - The part to run. The day file should export a property called part1 and part2.
  • <input> - The input to give the function. If - is passed, stdin will be used as the input. If + is passed, and you have a session set, then it will pull the input from adventofcode.com.
  • --session <session>,--year <year> - Works the same as advent init. A session is required if you don't already have a cached version of the input when using + as your input source.

Notes

  • No requests will be made to adventofcode.com unless you have a session set. A local cache is kept so that you only should have to make one request for input per day.

  • The config for year and session can also be provided in the package.json as config under the adventConfig key in your package.json. e.g.:

    {
      // ...
      "adventConfig": {
        "year": "2015",
        "session": "session={your session id}"
      }
    }
    

    For your session, you can also set the ADVENT_SESSION environment variable instead.

  • This module leverages the debug module. Setting DEBUG=advent will print out debug information, such as when this module is pulling from local cache, which days it's trying to run/initialize, and so forth. When reporting bugs, please have the output from this handy so that I can more quickly determine the issue.

  • One thing I liked to do with my local stuff was to store my answers locally along with example inputs (from the descriptions). The goal for this project was to make it easy for someone to upload their solutions to github, and others could pull it down and have it work with their inputs, but if there is interest in providing a "test suite" to test against example inputs and such, then I will do so.

Disclaimer

I am not affiliated with adventofcode.com or any of their sponsors, employees, pets, or anything relating to them. I am an active participant, and I wanted to make a tool to make it easier to setup and run advent of code things. Please don't abuse adventofcode.com. This tool could be used to make a lot of automated requests to their site, which is why this tool leverages caching. If you find that you're making too many requests to adventofcode.com because of this module, please let me know so I can resolve any issues. If this module is used to abuse adventofcode.com, I will unpublish it from npm and remove this code from github.

Keywords

FAQs

Package last updated on 17 Dec 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc