updated open script
This commit is contained in:
36
module.py
Normal file
36
module.py
Normal 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')
|
||||
|
||||
|
||||
7
open.sh
7
open.sh
@@ -15,12 +15,13 @@ if [ $time -gt 6 ]; then
|
||||
fi
|
||||
target_epoch=$(date -j "12${day0}06002020.00" +%s)
|
||||
|
||||
echo "Sleep for $target_epoch - $current_epoch "
|
||||
sleep_seconds=$(( $target_epoch - $current_epoch ))
|
||||
sleep_seconds=$(( $target_epoch - $current_epoch +1))
|
||||
echo "Sleep for $sleep_seconds"
|
||||
sleep $sleep_seconds
|
||||
|
||||
day=$(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 -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
|
||||
|
||||
Reference in New Issue
Block a user