summaryrefslogtreecommitdiffstats
path: root/init.sh
blob: 6e90eee1cabb05e447a5f145ccdd8be471f16eac (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh

if [ ! $# -eq 1 ]
then
    echo "Usage: $0 <day>"
    exit 1
fi

ADVENT_YEAR=2025
ADVENT_DAY=$1
ADVENT_SESSION=$(cat ../cookie)

DIR=$(printf "day%02d" $ADVENT_DAY)
echo "Initializing directory $DIR/"
rsync -av --ignore-existing skel/ ${DIR}/

echo "Downloading input ..." &&
    curl "https://adventofcode.com/$ADVENT_YEAR/day/$ADVENT_DAY/input" \
         -H "Cookie: session=$ADVENT_SESSION" > $DIR/input.txt