Skip to content

Commit c37d56b

Browse files
committed
add source file and input file generation
1 parent f85f52d commit c37d56b

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

gen_day.sh

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/bin/bash
2+
23
days=($(ls "src/"))
34
let last=0
45
for i in "${days[@]}"
@@ -9,10 +10,10 @@ do
910
fi
1011
done
1112

12-
echo "The last day was $last"
13-
1413
next_day=$((last + 1))
15-
echo "Create files for the day $next_day"
1614

17-
echo > "src/day$next_day.py"
18-
echo > "input/day$next_day.txt"
15+
echo " - create src/day$next_day.py"
16+
sed "s/{placeholder}/day$next_day.txt/g" "template.txt" > "src/day$next_day.py"
17+
18+
echo " - create input/day$next_day.txt"
19+
touch "input/day$next_day.txt"

template.txt

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import time
2+
3+
def part_1():
4+
pass
5+
6+
def part_2():
7+
pass
8+
9+
with open("../input/{placeholder}") as istream:
10+
for line in istream:
11+
pass
12+
13+
begin = time.time()
14+
print('Part_1: {}, takes {}s'.format(part_1(), time.time() - begin))
15+
begin = time.time()
16+
print('Part_2: {}, takes {}s'.format(part_2(), time.time() - begin))

0 commit comments

Comments
 (0)