aboutsummaryrefslogtreecommitdiffstats
path: root/init.sh
diff options
context:
space:
mode:
Diffstat (limited to 'init.sh')
-rwxr-xr-xinit.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/init.sh b/init.sh
new file mode 100755
index 0000000..25fb59a
--- /dev/null
+++ b/init.sh
@@ -0,0 +1,26 @@
1#!/bin/sh
2
3ADVENT_SESSION=$(cat ../cookie)
4
5if [ $# -eq 0 ]; then
6 echo "Usage: ./init.sh <#day>"
7 exit 1
8fi
9
10DAY=$1
11YEAR=2023
12DIR=$(printf "day%02d" $DAY)
13echo "Initializing day $DAY in directory $DIR"
14
15mkdir -p $DIR && curl "https://adventofcode.com/$YEAR/day/$DAY/input" -H "Cookie: session=$ADVENT_SESSION" >$DIR/input.txt
16echo \
17 'const std = @import("std");
18const print = std.debug.print;
19const assert = std.debug.assert;
20const input = @embedFile("./input.txt");
21
22pub fn main() !void {
23 var gpa = std.heap.GeneralPurposeAllocator(.{}){};
24 defer _ = gpa.deinit();
25 var alloc = gpa.allocator();
26}' >$DIR/solution.zig