updated open script

This commit is contained in:
2020-12-18 09:21:16 +01:00
parent 0af6bb9594
commit e1df2a6d5a
2 changed files with 40 additions and 3 deletions

36
module.py Normal file
View File

@@ -0,0 +1,36 @@
from aoc.input import get_input
import copy
import itertools
import time
import collections
import re
from aoc.partselector import part_one, part_two
import functools
def pw(line):
return line.strip()
def p1():
inp = get_input(pw)
for sample in inp:
print(sample)
return inp
def p2(segments):
print(len(segments))
return 0
result1 = None
if part_one():
start = time.time()
result1 = p1()
print(round(1000*(time.time() - start), 2), 'ms')
if part_two():
start = time.time()
p2(result1)
print(round(1000*(time.time() - start), 2), 'ms')

View File

@@ -15,12 +15,13 @@ if [ $time -gt 6 ]; then
fi fi
target_epoch=$(date -j "12${day0}06002020.00" +%s) target_epoch=$(date -j "12${day0}06002020.00" +%s)
echo "Sleep for $target_epoch - $current_epoch " sleep_seconds=$(( $target_epoch - $current_epoch +1))
sleep_seconds=$(( $target_epoch - $current_epoch ))
echo "Sleep for $sleep_seconds" echo "Sleep for $sleep_seconds"
sleep $sleep_seconds sleep $sleep_seconds
day=$(date +'%-d') day=$(date +'%-d')
day0=$(date +'%d') day0=$(date +'%d')
curl -b cookies.txt https://adventofcode.com/2020/day/$day/input -o day$day0/data/data.txt curl -b cookies.txt https://adventofcode.com/2020/day/$day/input -o day$day0/data/data.txt
curl -b cookies.txt https://adventofcode.com/2020/day/$day -o day$day0/index.html curl -b cookies.txt https://adventofcode.com/2020/day/$day/ -o day$day0/index.html
cat day$day0/data/data.txt