npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@jakzo/aoc

v1.3.1

Published

Advent of Code CLI for reading, running and submitting.

Downloads

73

Readme

Advent of Code CLI

Full Advent of Code dev loop in a CLI which:

  • Prints challenge description in the terminal
  • Downloads input to a file
  • Creates a source file for your favourite language and runs it on change
  • Submits answers

aoc demo

Recommended Usage

Install from binary below or (preferably) with Node like so:

npm i -g @jakzo/aoc

A few minutes before the challenge starts, open two terminals and run these commands:

# Terminal 1
aoc

# Terminal 2
aoc start js

This will prompt you for your session token if you haven't provided it before and save it in your operating system's credential manager.

From here the first terminal will:

  • Count down until the challenge starts
  • Print the description in the terminal once the challenge starts
  • Download the input to a local file called input.txt
  • Prompt for an answer to submit
  • When a correct answer is submitted, repeats these steps for part 2

And the second terminal will:

  • Create a new source file for your chosen language (JavaScript in the example)
  • Run the created source file and rerun when any changes are saved

Installation

If you have Node.js installed the easiest way is with:

npm i -g @jakzo/aoc

Or if you prefer you can install the binary for your platform:

Linux

  1. Download aoc-linux-x64 from the releases page
  2. chmod +x aoc-linux-x64
  3. mv aoc-linux-x64 /usr/local/bin/aoc

MacOS

  1. Download aoc-macos-x64 from the releases page
  2. Give execute permission: chmod +x aoc-macos-x64 && xattr -d com.apple.quarantine aoc-macos-x64
  3. Add to path: mv aoc-macos-x64 /usr/local/bin/aoc

Windows

  1. Download aoc-win-x64.exe from the releases page
  2. Open Command Prompt as administrator then run:
  3. mkdir aoc (feel free to swap aoc for any directory you want to install it to)
  4. move aoc-win-x64.exe aoc\aoc.exe
  5. Add to path: cd aoc && setx /M PATH "%PATH%;%CD%"

Language Templates

See ./templates for a list of possible languages. Each folder name is a valid argument you can provide to aoc start.

You can also create local templates so you can use languages not built-in to this tool. To do this:

  1. Create a folder containing your template files
  2. Make sure the source file(s) contain wip (case-insensitive) in their filename
    • This is how the tool determines which files to save after a successful submission
  3. Create an aoc.json file in this directory to specify commands
    • These commands will be rerun on changes
    • Use {{TEMP_DIR}} to insert the path of a temporary directory for saving build output
    • Example aoc.json which compiles and runs the code in wip.c:
      {
        "commands": ["clang -o '{{TEMP_DIR}}/wip' wip.c", "'{{TEMP_DIR}}/wip'"]
      }
  4. Use your local template by passing in the path to your template folder instead of the language name
    • Example: aoc start ./my-template-folder

Individual Commands

The tool also exposes individual commands in case you want to compose some functionality together with another tool. For example you can save the input for a challenge to another file with aoc input --year 2016 --day 5 > another-file.txt.

Documentation for individual commands can be found by running aoc --help:

$ aoc --help
Commands:
  aoc                    Counts down, saves input, prints
                         description and prompts for
                         answers to the upcoming challenge
                                                 [default]
  aoc start [language]   Creates and run files from a
                         template for a language (does not
                         overwrite)
  aoc login              Prompts for a new session token
  aoc template <output>  Copies a template folder (does
                         not overwrite)
  aoc countdown          Counts down until the next
                         challenge starts then exits
  aoc description        Prints the description of a
                         challenge
  aoc input              Prints the input to a challenge
  aoc submit [answer]    Submits an answer to a challenge
  aoc leaderboard <id>   Outputs a CSV of times to
                         completion for a private
                         leaderboard

Options:
  -y, --year     The year of the challenge        [number]
  -d, --day      The day of the challenge         [number]
  -h, --help     Show help                       [boolean]
  -v, --version  Show version number             [boolean]

Individual commands can also be accessed from the npm module like:

const { printDescription } = require("@jakzo/aoc");

printDescription(2020, 5);