Add script to download input automatically and do not commit inputs.
This commit is contained in:
parent
acbbbd329d
commit
8ba8eaa55f
2
.gitignore
vendored
2
.gitignore
vendored
@ -1 +1,3 @@
|
||||
__pycache__
|
||||
*.txt
|
||||
*.md
|
||||
|
37
d16.py
Normal file
37
d16.py
Normal 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
17
get.sh
Executable 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"
|
Reference in New Issue
Block a user