From 2f31d7d84f17d1269f6c13a3807cc1beaf580a21 Mon Sep 17 00:00:00 2001 From: setop Date: Mon, 2 Dec 2024 10:29:41 +0100 Subject: [PATCH] lets try a starter --- cmd.txt | 1 + get_input.sh | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 cmd.txt create mode 100755 get_input.sh diff --git a/cmd.txt b/cmd.txt new file mode 100644 index 0000000..cc01dcb --- /dev/null +++ b/cmd.txt @@ -0,0 +1 @@ +command cd "$(./get_input.sh)" && less input diff --git a/get_input.sh b/get_input.sh new file mode 100755 index 0000000..6c63bc5 --- /dev/null +++ b/get_input.sh @@ -0,0 +1,21 @@ +#!/bin/bash -eu + +cd "$(dirname $(realpath $0))" + +. .env + +d=$(date +%d) + +mkdir -p d${d} +cd d${d} + +[ -s input ] || curl -fsS \ + -A "${UA}" \ + -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' \ + --compressed \ + -H 'Connection: close' \ + -H "Cookie: session=$SESSION" \ + -o input \ + "https://adventofcode.com/2024/day/$(( $d + 0 ))/input" + +echo $(realpath .)