Coder Social home page Coder Social logo

janetschel / advent-of-go-2020 Goto Github PK

View Code? Open in Web Editor NEW
13.0 5.0 6.0 178 KB

Advent of Code 2020 in golang

Home Page: https://adventofcode.com/

License: MIT License

Go 98.48% Makefile 1.52%
aoc aoc2020 aoc-2020 golang advent-of-code advent-of-code-2020

advent-of-go-2020's Introduction

advent-of-go-2020

Advent of Code 2020 in golang

These are by no means good or fast solutions, just my personal repo to keep tracks of this years progress
Please no Intcode..... (doesn't look like it yet :)))))))) Update: well kinda... but it's okay so far.

For python solutions check Logxn/Advent-of-Code-2020

Makefile

Use make new in the terminal to automatically create a new folder with the important files for the day.
These files are copied from the static-template folder. If you want to make any changes to the blueprint, do it there.

Usage for fetch utils

Keep in mind that these fetch utils do not request the input again if the input file already exists.
It will just use the existing file without making any HTTP requests, so we don't spam the API of https://adventofcode.com/

If you want to make another request to AOC in order to refresh your input file (for whatever reason you want to do so), you need to delete the already existing puzzle-input.in file so the fetch-utils make a new request.

Setup

In order for the fetch utils to work properly:

  • create a folder /secrets in the src/advent-of-go-2020
  • place session.go inside this newly created folder
  • place your session-key inside session.go. You can find your session key in your session cookie when visiting the website

Your project structure should look likes this:
advent-of-go-2020/
├── calendar/
│   ├── day-01/
│   │   ├── day01.go
│   │   ├── day01_pt02.go
│   │   └── puzzle-input.in  // <-- this is created by fetch utils
│   └── ...
├── utils/
│   ├── conv/
│   ├── files/
│   ├── req/
│   ├── slices/
│   └── str/
├── secrets/
│   └── session.go
├── Makefile 
└── template    // <-- change this if you wish to modify your blueprint

session.go file:

package secrets

const (
	Session = "session=<your-session-key>"
)

Usage

package main

import "advent-of-go-2020/utils"

func main() {
	input := utils.ReadFile(1, "\n")
	//		        ^    ^
	//	       	        |    |
	//                     day   |
	//                           |
	//                       delimiter
	
	// more code...
}

advent-of-go-2020's People

Contributors

janetschel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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