Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tomfran/advent-of-code-setup
Automate input downloads and solution creation for Advent of Code
https://github.com/tomfran/advent-of-code-setup
advent-of-code
Last synced: 3 months ago
JSON representation
Automate input downloads and solution creation for Advent of Code
- Host: GitHub
- URL: https://github.com/tomfran/advent-of-code-setup
- Owner: tomfran
- License: gpl-3.0
- Created: 2022-12-01T11:27:35.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2022-12-01T18:14:10.000Z (almost 2 years ago)
- Last Synced: 2024-06-30T04:13:38.702Z (4 months ago)
- Topics: advent-of-code
- Language: Python
- Homepage:
- Size: 20.5 KB
- Stars: 19
- Watchers: 1
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-advent-of-code - tomfran/advent-of-code-setup
README
# Advent of code setup
Jumpstart your Advent of Code experience. Automate input downloads and easily create templates for your solutions, so you can focus on solving the challenges.
## Setup
Run `make setup`, this will create the `inputs` directory and the `session.cookie` file, please remember to fill the latter with your session cookie to auto-download inputs, and add a newline after it, just in case.
To find it on Chrome: right-click, inspect, Application tab, Storage, Cookies, session.If you plan on making a fork public, you might want to add this file to `.gitignore`.
## Creating a new solution
```make new``` creates a new file for today, it checks for the files in `src/` and creates the "next int" one. On the first run it will create `01.py`, later `02.py`, and so on.
A new solution is initialized as follows:
```
from utils.api import get_inputinput_str = get_input(1)
# WRITE YOUR SOLUTION HERE
```
The `get_input` function takes a day and returns the content of the input for that day, this internally makes a request to obtain the input if it is not found on disk.## Running a new solution
From the main directory, run `python src/.py`.
## Pretty README
`make readme` creates a cool `README.md` file with a list of the solutions in the source directory, with working links. Note that this original readme will be overwritten.
If you want to use this, please edit `src/utils/build_md.py` with the correct repository link.
Also, the `parse` method could be extended to display what you want for each solution. For instance, by uncommenting line 8, and renaming your files like `DAY_Cool_Problem_name.py`, you will get a list entry like `DAY. Cool Problem name`.## Solving other years
This repo can be used to setup past years aswell, the only downside is that you need to change the `YEAR = 2022` variable on `src/utils/api.py`.---
If you found this useful please leave a star, or even better get in touch! Happy coding :christmas_tree: