diff options
-rwxr-xr-x | prep.sh | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/prep.sh b/prep.sh new file mode 100755 index 0000000..33a99d8 --- /dev/null +++ b/prep.sh @@ -0,0 +1,10 @@ +#!/bin/bash +set -eu +set -o pipefail + +DAY=$1 +CURLOPTS=--no-progress-meter + +curl $CURLOPTS https://adventofcode.com/2022/day/$DAY | awk '/<pre><code>/ {sub("<pre><code>", ""); CODE=1; IDX+=1} /<\/code>/ {CODE=0;} {if (CODE) print > sprintf("ex%d.in", IDX)}' +curl $CURLOPTS -b ../cookie https://adventofcode.com/2022/day/$DAY/input > real.in +echo "done :)" |