Skip to content

Instantly share code, notes, and snippets.

@mathcat4
Created December 4, 2023 04:58
Show Gist options
  • Save mathcat4/c5b2d4e01a620a89c2786f490cad51a3 to your computer and use it in GitHub Desktop.
Save mathcat4/c5b2d4e01a620a89c2786f490cad51a3 to your computer and use it in GitHub Desktop.
aoc aliases
run_aoc=yes
if [ "$run_aoc" = yes ]; then
export AOC=~/mathcat4/Programs/advent-of-code/ # Change path
export AOC_COOKIE="[COOKIE]"
function aot-run() {
cd $AOC
echo -ne "\\e[0;34m"
python "$1" < test.txt
echo -ne "\\e[0m"
}
function aos-run() {
cd $AOC
echo -ne "\\e[4;32m"
python "$1" < in.txt
echo -ne "\\e[0m"
}
alias aos="aos-run solution.py"
alias aot="aot-run solution.py"
alias aoc="aot; echo; aos"
function aoc-load() {
cd $AOC
if [ "$1" ]; then
curl --cookie "session=$AOC_COOKIE" "https://adventofcode.com/$1/day/$2/input" > in.txt
else
curl --cookie "session=$AOC_COOKIE" $(date +"https://adventofcode.com/%Y/day/%-d/input") > in.txt
fi
}
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment