aboutsummaryrefslogtreecommitdiff
path: root/aocd
blob: cab4060079f9e0c38633dad7d87f9164db206053 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/sh

# Download input from the Advent of Code website (https://adventofcode.com/).
# Requires setting an AOC_SESSION_COOKIE variable with a valid session cookie.

# usage: aocd [year n]
# If year and n are not specified, the current year and day are used.

YEAR="${1:-$(date +'%Y')}"
DAY="${2:-$(date +'%d' | sed 's/^0//')}"
URL="https://adventofcode.com/$YEAR/day/$DAY/input"

curl "$URL" -H "cookie: session=$AOC_SESSION_COOKIE" -o input.txt

Generated with cgit - Back to sebastiano.tronto.net