about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--aoc2021/.gitignore1
-rw-r--r--aoc2021/getday.sh13
2 files changed, 14 insertions, 0 deletions
diff --git a/aoc2021/.gitignore b/aoc2021/.gitignore
new file mode 100644
index 0000000..0f4f4ed
--- /dev/null
+++ b/aoc2021/.gitignore
@@ -0,0 +1 @@
+session_cookie.txt
\ No newline at end of file
diff --git a/aoc2021/getday.sh b/aoc2021/getday.sh
new file mode 100644
index 0000000..eb7faa0
--- /dev/null
+++ b/aoc2021/getday.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+. ./session_cookie.txt
+
+if [ -z "$session" ]; then
+  printf "missing session cookie\n"
+fi
+  
+curl -s https://adventofcode.com/2021/day/"$1"/input \
+  --cookie "session=$session" \
+  -o "$(printf "input/day%02d.in" "$1")"
+
+sed "s/XX/$1/g" DayXX.cs.txt > "$(printf "Day%02d.cs" "$1")"