summary refs log tree commit diff
path: root/prep.sh
blob: 33a99d8d8e22b115a9fb60c98ea45a6c2a6036ae (plain)
1
2
3
4
5
6
7
8
9
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 :)"