Files
AdventOfCode2025/today.sh

24 lines
695 B
Bash
Executable File

#!/bin/bash
__year=2025
__day="${1}"
if [ "${__day}" == "" ]; then
__day=$(date '+%d')
fi
padded=$(printf "%02g" ${__day})
__resourceDir=src/resources/inputs/${padded}
mkdir -p ${__resourceDir}
touch ${__resourceDir}/testinput
if [ ! -f "${__resourceDir}/input" ]; then
curl -s \
-A "https://git.yetaga.in/alazyreader/AdventOfCode${__year}/" \
-H "Cookie: session=`cat .cookie`" https://adventofcode.com/${__year}/day/${__day##0}/input > "${__resourceDir}/input"
fi
if [ ! -f "src/Day${padded}.java" ]; then
cp main.java.tmpl src/Day${padded}.java
sed -i '' "s/00/${padded}/g" src/Day${padded}.java
fi
open "https://adventofcode.com/${__year}/day/${__day##0}"