get all set up
This commit is contained in:
		
							
								
								
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,2 @@
 | 
			
		||||
*/inputs
 | 
			
		||||
.cookie
 | 
			
		||||
							
								
								
									
										50
									
								
								main.go.tmpl
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								main.go.tmpl
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,50 @@
 | 
			
		||||
package main
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"bufio"
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"os"
 | 
			
		||||
	"strconv"
 | 
			
		||||
	"time"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func mustAtoi(line string) int {
 | 
			
		||||
	i, _ := strconv.Atoi(line)
 | 
			
		||||
	return i
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func main() {
 | 
			
		||||
	start := time.Now()
 | 
			
		||||
	partOne()
 | 
			
		||||
	duration := time.Since(start)
 | 
			
		||||
	partTwo()
 | 
			
		||||
	duration2 := time.Since(start)
 | 
			
		||||
	fmt.Printf("p1: %s, p2: %s\n", duration, duration2-duration)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func makeScanner(test bool) *bufio.Scanner {
 | 
			
		||||
	var f *os.File
 | 
			
		||||
	if test {
 | 
			
		||||
		f, _ = os.Open("inputs/testinput")
 | 
			
		||||
	} else {
 | 
			
		||||
		f, _ = os.Open("inputs/input")
 | 
			
		||||
	}
 | 
			
		||||
	reader := bufio.NewReader(f)
 | 
			
		||||
	return bufio.NewScanner(reader)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func partOne() {
 | 
			
		||||
	scanner := makeScanner(false)
 | 
			
		||||
 | 
			
		||||
	for scanner.Scan() {
 | 
			
		||||
		// line := scanner.Text()
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func partTwo() {
 | 
			
		||||
	scanner := makeScanner(false)
 | 
			
		||||
 | 
			
		||||
	for scanner.Scan() {
 | 
			
		||||
		// line := scanner.Text()
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										18
									
								
								new.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								new.sh
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,18 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
__year=2023
 | 
			
		||||
 | 
			
		||||
if [ "${1}" != "" ]; then
 | 
			
		||||
    padded=$(printf "%02g" ${1})
 | 
			
		||||
    mkdir -p ${padded}/inputs
 | 
			
		||||
    touch ${padded}/inputs/testinput
 | 
			
		||||
    if [ ! -f "${padded}/inputs/input" ]; then
 | 
			
		||||
        curl -s \
 | 
			
		||||
            -A "https://git.yetaga.in/alazyreader/AdventOfCode${__year}/" \
 | 
			
		||||
            -H "Cookie: session=`cat .cookie`" https://adventofcode.com/${__year}/day/${1##0}/input > "${padded}/inputs/input"
 | 
			
		||||
    fi
 | 
			
		||||
    if [ ! -f "${padded}/main.go" ]; then
 | 
			
		||||
        cp -n main.go.tmpl ${padded}/main.go
 | 
			
		||||
    fi
 | 
			
		||||
    echo "https://adventofcode.com/${__year}/day/${1}"
 | 
			
		||||
fi
 | 
			
		||||
							
								
								
									
										5
									
								
								readme.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								readme.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
			
		||||
# AOC 2023
 | 
			
		||||
 | 
			
		||||
In Chez Scheme? Perhaps. Go as a fallback.
 | 
			
		||||
 | 
			
		||||
<https://adventofcode.com/2023/>
 | 
			
		||||
		Reference in New Issue
	
	Block a user