about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBen Harris <ben@tilde.team>2021-12-01 01:00:18 -0500
committerBen Harris <ben@tilde.team>2021-12-01 01:00:18 -0500
commit898b2c48903ddb0d997bf7b16bd9627094cfc956 (patch)
treecf69c95c0cfb2e576e9980c252eafc9829313eae
parentf583401da3d067bc0a2d9389832e68db6094b3f0 (diff)
add getday.sh
-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")"