Add script to download input automatically and do not commit inputs.

This commit is contained in:
felixm 2023-12-09 13:30:00 -05:00
parent acbbbd329d
commit 8ba8eaa55f
3 changed files with 56 additions and 0 deletions

2
.gitignore vendored
View File

@ -1 +1,3 @@
__pycache__
*.txt
*.md

37
d16.py Normal file
View File

@ -0,0 +1,37 @@
import lib
EXAMPLE = """
"""
def solve(lines: list[str]):
res = 0
for (i, line) in enumerate(lines):
print(i, line)
# digits = lib.str_to_int_list(line)
# digit = lib.str_to_single_int(line)
return res
def solve2(lines: list[str]):
res = 0
for (i, line) in enumerate(lines):
print(i, line)
return res
def main():
lines = lib.str_to_lines_no_empty(EXAMPLE)
print("Example 1:", solve(lines))
return
lines = lib.str_to_lines_no_empty(open("ix.txt").read())
print("Solution 1:", solve(lines))
return
lines = lib.str_to_lines_no_empty(EXAMPLE)
print("Example 2:", solve2(lines))
return
lines = lib.str_to_lines_no_empty(open("ix.txt").read())
print("Solution 2:", solve2(lines))
if __name__ == "__main__":
main()

17
get.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/bash
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <day>"
exit 1
fi
DAY=$1
SESSION_COOKIE=$(keyring get aoc-session-cookie felixm)
echo $SESSION_COOKIE
curl "https://adventofcode.com/2022/day/$DAY/input" --cookie "session=$SESSION_COOKIE" > "i$DAY.txt"
# Get instructions as markdown file.
# curl "https://adventofcode.com/2022/day/$DAY" --cookie "session=$SESSION_COOKIE" > "day$DAY.html"
# pandoc -f html -t markdown "day$DAY.html" -o "d$DAY.md"
# rm "day$DAY.html"