diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2025-11-28 15:55:51 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2025-11-28 15:55:51 +0100 |
| commit | 3fe83c0f2f7e6e3d87ede77607cca5922fa02a60 (patch) | |
| tree | 771ce484661e3bff7e237bf47412cf9288d334da | |
| parent | 90d1382761b9bf4b7e43517e40baa64a801f3b1a (diff) | |
| download | scripts-3fe83c0f2f7e6e3d87ede77607cca5922fa02a60.tar.gz scripts-3fe83c0f2f7e6e3d87ede77607cca5922fa02a60.zip | |
Added script to download advent of code input files
Diffstat (limited to '')
| -rw-r--r-- | Makefile | 1 | ||||
| -rwxr-xr-x | aocd | 13 |
2 files changed, 14 insertions, 0 deletions
| @@ -1,6 +1,7 @@ | |||
| 1 | PREFIX = /usr/local | 1 | PREFIX = /usr/local |
| 2 | 2 | ||
| 3 | SCRIPTS = 2fa \ | 3 | SCRIPTS = 2fa \ |
| 4 | aocd \ | ||
| 4 | battery-checknow \ | 5 | battery-checknow \ |
| 5 | battery-status \ | 6 | battery-status \ |
| 6 | clip \ | 7 | clip \ |
| @@ -0,0 +1,13 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | # Download input from the Advent of Code website (https://adventofcode.com/). | ||
| 4 | # Requires setting an AOC_SESSION_COOKIE variable with a valid session cookie. | ||
| 5 | |||
| 6 | # usage: aocd [year n] | ||
| 7 | # If year and n are not specified, the current year and day are used. | ||
| 8 | |||
| 9 | YEAR="${1:-$(date +'%Y')}" | ||
| 10 | DAY="${2:-$(date +'%d' | sed 's/^0//')}" | ||
| 11 | URL="https://adventofcode.com/$YEAR/day/$DAY/input" | ||
| 12 | |||
| 13 | curl "$URL" -H "cookie: session=$AOC_SESSION_COOKIE" -o input.txt | ||
