Giter Site home page Giter Site logo

agsant01 / advent-of-code-python Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 1.74 MB

This is a repository of my solutions at Advent of Code (https://adventofcode.com/about) in python. Also providing helpful tooling to get rid of coding boilerplate.

License: GNU General Public License v2.0

Python 99.44% JavaScript 0.18% C 0.29% Makefile 0.09%
aoc adventofcode advent-of-code python3

advent-of-code-python's Introduction

advent-of-code

Enviroment Variables

For being able to query the input data directly from AOC website, you'll need to:

  • Create .env file
  • Find the cookie that identifies you in the request Headers made to https://adventofcode.com/<year>/day/<day>/input
    • This header can be found using DevTools in Chrome or any other similar tool.
    • It is sent in the header at the param: cookie
  • Put the cookie in the .env file with key SESSION_COOKIE

You are ready to start using this feature.

Features / Usage

The features are:

  • Run day script
  • Create templates for days
  • Create/initialize directory for AOC years
  • Get the input data directly from AdventOfCode website and save into .txt

Help

Command: python3 aocUtils.py --help|-h

Run day

Command: python3 aocUtils.py -r <day>
Optional Flag: -y <year>
DefaultValue: Current Year

Examples

$ python3 aocUtils.py -r 3
==> Running script: ./2020/day03.py


$ python3 aocUtils.py -r 3 -y 2017
==> Running script: ./2017/day03.py

Initialize Year

Command: python3 aocUtils.py -iy <year:optional>
DefaultValue: Current Year

Initialize year directory and create yearutils.py.

Examples

$ python3 aocUtils.py -iy
==> Initializing year directory: ./2020
==> Creating dependency: ./2020/yearutils.py

$ python3 aocUtils.py -iy 2021
==> Initializing year directory: ./2021
==> Creating dependency: ./2021/yearutils.py

Create template for day

Command: python3 aocUtils.py --create-day|-cd <day>
Optional Flag: -y <year>
DefaultValue: Current Year

Create template for day under ./<year>/ directory.

The year directory need to be initialized first, see Initialize Year.

This command will also query https://adventofcode.com/ for the data for the given day if the data is available.

Examples

$ python3 aocUtils.py -cd 5
==> Creating day template: ./2020/day05.py

$ python3 aocUtils.py -cd 5 -y 2017
==> Creating day template: ./2017/day05.py

Query Input Data

Command: python3 aocUtils.py -i 7
Optional Flag: -y <year>
DefaultValue: Current Year

Manual query of data. Folder of year need to exist or already be initialized. See Initialize Year.

Examples

$ python3 aocUtils.py python3 aocUtils.py -i 7
==> Get input data for year:2020 ✭ day:7
==> GET at https://adventofcode.com/2020/day/7/input
==> Success:  200
==> Creating Input files
==> Creating Input file: 2020/day07_input.txt
==> Creating Input file: 2020/day07_input_test.txt

advent-of-code-python's People

Contributors

agsant01 avatar

Stargazers

 avatar

Watchers

 avatar  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.