aboutsummaryrefslogtreecommitdiffstats
path: root/init.sh
blob: 25fb59ab765ee7cf4808b0658877da0546f4878d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/sh

ADVENT_SESSION=$(cat ../cookie)

if [ $# -eq 0 ]; then
	echo "Usage: ./init.sh <#day>"
	exit 1
fi

DAY=$1
YEAR=2023
DIR=$(printf "day%02d" $DAY)
echo "Initializing day $DAY in directory $DIR"

mkdir -p $DIR && curl "https://adventofcode.com/$YEAR/day/$DAY/input" -H "Cookie: session=$ADVENT_SESSION" >$DIR/input.txt
echo \
	'const std = @import("std");
const print = std.debug.print;
const assert = std.debug.assert;
const input = @embedFile("./input.txt");

pub fn main() !void {
    var gpa = std.heap.GeneralPurposeAllocator(.{}){};
    defer _ = gpa.deinit();
    var alloc = gpa.allocator();
}' >$DIR/solution.zig