Skip to content

pyrmont/sled

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sled

Latest Release Test Status

Sled is the Seasonal Linear Enigma Device, a command-line utility for Advent of Code.

Usage: sled [--session <file>] <subcommand> [<args>]

Seasonal Linear Enigma Device, a command-line utility for Advent of Code.

Options:

 -s, --session <file>    A file that contains the session ID for the user's
                         logged in session. (Default: session.txt)
 -h, --help              Show this help message.

Subcommands:

 a, answer       Submit an answer.
 c, calendar     Display the calendar.
 p, puzzle       Download a puzzle.

For more information on each subcommand, type 'sled help <subcommand>'.

Requirements

Sled uses the curl command-line utility to communicate with the Advent of Code servers. It must be on the PATH of the user that runs sled.

Installing

Homebrew

The latest release of sled is available via Homebrew for macOS (Apple Silicon) and Linux (x86-64 and aarch64):

$ brew tap pyrmont/sled https://github.com/pyrmont/sled
$ brew install sled

Jeep

If you use Janet, you can install sled using Jeep:

$ jeep install https://github.com/pyrmont/sled

Pre-Built

Pre-built binaries of sled are available as tarballs via the Releases section on GitHub for:

  • FreeBSD 14 (x86-64 and aarch64)
  • Linux (x86-64 and aarch64)
  • macOS (aarch64)
$ curl -LO https://github.com/pyrmont/sled/releases/latest/download/sled-v<version>-<platform>-<arch>.tar.gz
$ tar -xzf sled-v<version>-<platform>-<arch>.tar.gz
$ cd sled-v<version>
# use sudo or doas depending on the permissions of the target directories
$ sudo cp sled /usr/local/bin/ # or somewhere else on your PATH
$ sudo cp sled.1 /usr/local/share/man/man1/ # or somewhere else on your MANPATH

From Source

To build the sled binary from source, you need Janet installed on your system. Then run:

$ git clone https://github.com/pyrmont/sled
$ cd sled
$ git tag --sort=creatordate
$ git checkout <version> # check out the latest tagged version
$ janet --install .

Configuring

Sled requires your Advent of Code session cookie to authenticate with the Advent of Code servers. To get your session cookie:

  1. log in to Advent of Code
  2. open your browser's developer tools
  3. go to the Storage tab
  4. find the cookie named session
  5. copy its value to a file (such as session.txt)

Using

Run sled --help for usage information. The command-line arguments are explained in more detail in the man page.

Downloading Puzzles

Download a puzzle for a specific year and day:

$ sled puzzle --year 2025 --day 1

This downloads both the puzzle explanation and your puzzle input. The puzzle explanation is converted from HTML to a text-friendly format.

By default, Sled puts the files for each day into a subdirectory with a name that matches that day (e.g. ./day01/puzzle.txt and ./day01/input.txt). To save files without creating any subdirectories, use the --no-subdirs option.

Submitting Answers

Submit an answer for a specific part:

$ sled answer --year 2025 --day 1 --part 1 <answer>

Viewing the Calendar

Display your Advent of Code calendar with ASCII art and completion status:

$ sled calendar --year 2025

The calendar displays:

  • the ASCII art calendar for that year
  • gold stars (**) for puzzles you've completed
  • ANSI 256 colours

To disable colours:

$ sled calendar --year 2025 --no-color

Bugs

Found a bug? I'd love to know about it. The best way is to report your bug in the Issues section on GitHub.

Licence

Sled is licensed under the MIT Licence. See LICENSE for more details.

About

A command-line utility for Advent of Code

Resources

License

Stars

Watchers

Forks

Packages

No packages published