Coder Social home page Coder Social logo

sekoiatree / eggnog Goto Github PK

View Code? Open in Web Editor NEW

This project forked from breakthatbass/eggnog

0.0 0.0 0.0 981 KB

๐ŸŽ…๐Ÿป Download inputs, puzzle directions, & submit answers to Advent of Code puzzles in your terminal

License: MIT License

Makefile 1.15% C 93.71% Shell 3.80% Python 1.35%

eggnog's Introduction

Clark Griswold

eggnog ๐ŸŽ„

Yet another Advent of Code CLI tool...

eggnog is a tool that allows you to download Advent of Code puzzle inputs, puzzle directions, and submit answers in the terminal.

It caches everything - even when a wrong answer is submitted.

Installation

eggnog works on MacOS and Linux.

Set the NOG_INSTALL_PATH environment variable.

# an installation option...
export NOG_INSTALL_PATH=/usr/local/bin

Then run

make install

Dependencies

It relies on the libcurl C library for http requests. Chances are it's already installed and you don't have to do anything. But if it doesn't work you may have to download it.

MacOS

brew install curl

Linux

sudo apt update
sudo apt-get install liburl4-gnutls-dev
# or whatever packager you use

Run Tests

make tests

Usage

nog [--day=<day> --year=<year>] [OPTION] 

Day & year are required unless Advent is happening - latest puzzle will automatically be returned.

    -y <year>, --year=<year>
	The year of the puzzle you want to do.

    -d <day>, --day=<day>
	The day of the puzzle you want to do.

Options: If no options are supplied, input is assumed.

    -i, --input
	Download puzzle input.

    -p, --directions
	Get puzzle directions.

    -s, --submit=<answer>
	submit an answer to a puzzle. If no answer is supplied, read from
	stdin. Using '-s' automatically reads from stdin.

    -l <puzzle part>, --level=<puzzle part>
	Indicate whether submitting an answer to part 1 or part 2 of a puzzle.
	If left out, part 1 is assumed. **Required for submitting part 2 answers**.

Getting the puzzle input will print it to the terminal in the same way it would with curl. The purpose of that is because many advent of code solutions read from stdin rather than a hardcoded file name in the code.

Example usage

Get input for year 2020 day 1:

  • nog -y 2020 -d 1
  • or save to a file --> nog -y 2020 -d 1 > input.txt
  • or pipe it into your program --> nog -y 2020 -d 1 | ./myprogram

Submit an answer for year 2020 day 1 part 1:

  • nog -y 2020 -d 1 --submit=1234

Or read from stdin to provide your answer:

  • ./myprogram | nog -y 2020 -d 1 -s

Submit an answer for part 2:

  • nog -y 2020 -d 1 -l 2 -s

Cache

eggnog creates a local cache in the $HOME directory called .eggnog.

Puzzle directions, inputs, and all right and wrong answer submission attempts are saved. The cache is always checked before querying Advent of Code servers.

Unless the cache is deleted, any query to the servers happens only once.

To Do

  • WHen submitting an answer, if it's wrong, record the time. Require at least a minute to pass before sending another answer attempt.

Known Bugs

  • The bug that prevented from submitting answers to part 2 has been fixed โœ”๏ธ

Contributing

If you would like to contribute, feel free to make a pull request.
Or if you find a bug, open an issue.

eggnog's People

Contributors

breakthatbass avatar byted avatar cheezmeister avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.