From 898b2c48903ddb0d997bf7b16bd9627094cfc956 Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Wed, 1 Dec 2021 01:00:18 -0500 Subject: [PATCH] add getday.sh --- aoc2021/.gitignore | 1 + aoc2021/getday.sh | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 aoc2021/.gitignore create mode 100644 aoc2021/getday.sh 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")"