advent-of-code

advent of code (partial solutions)
Log | Files | Refs | README

commit 44bcd4c3447509a94a6ba2b8272220d956bbab3d
parent a6339400f1ca4c3ebe68ec7dd137e55ec6026242
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Mon, 29 Nov 2021 18:54:06 -0800

Set up template for rust 2021

Diffstat:
A2021/.gitignore | 2++
A2021/README | 10++++++++++
A2021/_tmpl.rs | 12++++++++++++
A2021/dl.sh | 6++++++
4 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/2021/.gitignore b/2021/.gitignore @@ -0,0 +1,2 @@ +a.out +input diff --git a/2021/README b/2021/README @@ -0,0 +1,10 @@ +alexandria ocasio-cortez 2021 + +rust + +each solution in a single file, no external dependencies + +each solution contains both days and reads the input from stdin and outputs: + +part 1: (answer) +part 2: (answer) diff --git a/2021/_tmpl.rs b/2021/_tmpl.rs @@ -0,0 +1,12 @@ +use std::fs::File; +use std::io::{self, BufRead}; +use std::path::Path; + +fn main() { + let stdin = io::stdin(); + for line in stdin.lock().lines() { + println!("{}", line.unwrap()); + } + println!("part 1:"); + println!("part 2:"); +} diff --git a/2021/dl.sh b/2021/dl.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +YEAR=2021 +DAY=$1 + +curl -b session=$(cat ${HOME}/.aocrc) https://adventofcode.com/${YEAR}/day/${DAY}/input > input