#!/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