aocgo

package module
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

README

Welcome to aocGo!

aocGo is a two part project. It is not an official Advent of Code project, merely my take on some ways to enhance the workflow.
Definitely go support the official project, especially since this project would be useless without it.

aocgo

The first encompasses the go module of the same name. This module contains a main package with some functions for obtaining input for a given day based on the file's directory structure. It also contains an aocutils sub-package, containing some helpful functions for common things you might need when solving AoC puzzles. If you want to handle all of that yourself, don't worry about importing this.

This module should be imported using go get go.dalton.dog/aocgo.

Example:

// Example file/dir structure:
// 2015/1/main.go
package main

import "go.dalton.dog/aocgo"

func main() {
    // Get your input data as a string, exactly as the input has it
    var inLine string = aocgo.GetInputAsString()

    // Get your input data as an array of strings, created by splitting input on newline characters
    var inLnArr []string = aocgo.GetInputAsLineArray()

    // Get your input data as an array of bytes, where each element is a single byte of the input
    var inByteArr []byte = aocgo.GetInputAsByteArray()
}

aocli

The second, and more expansive, is a CLI application called aocli that can be used to interact with the Advent of Code workflow without leaving your terminal.

It can currently do all of the following:

  • View puzzle data
  • Submit puzzle answers
  • View both yearly and daily leaderboards
  • View an overview of your user

Check out the directory's specific README for detailed documentation!

You should install the program via this repo's 'Releases' page. There are standalone binaries for Windows, Linux, and Mac, and the program has a built-in updating system. Just put the executable in a directory on your PATH and you're good to go.

Required Setup

All you need for this to work is the cookie session token of the user you'd like to use to interface with Advent of Code.

  1. To obtain this token, log in to Advent of Code via whichever method you prefer.
  2. Open Dev Tools (Press F12 or Right Click -> Inspect), and then open the Storage tab. Storage Tab
  3. With the Storage tab open, double click the value to select it, and copy it. Session Token
  4. Once copied, place it in one of these two places:
    • ~/.config/aocgo/session.token
    • AOC_SESSION_TOKEN environment variable

If you choose to use the environment variable method, make sure to include a line to set it in your shell's startup script.

From there, you should be good to go! If you installed the CLI program, you can run aocli health to verify that everything loaded properly. aocli health

Licensing

© 2024 Dalton Williams Check repository LICENSE file for licensing information.

Documentation

Overview

Package aocgo provides functions to get your Advent of Code puzzle inputs in a non-intrusive way.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetInputAsByteArray

func GetInputAsByteArray() []byte

GetInputAsByteArray will return the user's puzzle input, as determined by the file's working directory, as an array of bytes.

func GetInputAsLineArray

func GetInputAsLineArray() []string

GetInputAsLineArray will return the user's puzzle input, as determined by the file's working directory, as an array of strings, split on newline.

func GetInputAsString

func GetInputAsString() string

GetInputAsString will return the user's puzzle input, as determined by the file's working directory, as a single string.

Types

This section is empty.

Directories

Path Synopsis
Package aocutils is a collection of commonly used functions that might be helpful for Advent of Code solving.
Package aocutils is a collection of commonly used functions that might be helpful for Advent of Code solving.
cmd
aocli
`Aocli` allows you to interface with Advent of Code workflows without leaving your terminal.
`Aocli` allows you to interface with Advent of Code workflows without leaving your terminal.
internal
api

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL