File tree 3 files changed +23
-7
lines changed
3 files changed +23
-7
lines changed Original file line number Diff line number Diff line change
1
+ export AOC_SESSION=""
Original file line number Diff line number Diff line change 1
1
.idea /
2
+ .envrc
Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
2
3
- COOKIE_TOKEN=" $1 "
4
- YEAR=" $2 "
5
- DAY=" $3 "
3
+ YEAR=" $1 "
4
+ DAY=" $2 "
6
5
7
6
# create dir
8
7
mkdir -p " $YEAR /$DAY "
8
+ cd " $YEAR /$DAY " || exit
9
+
10
+ touch output1 output2
11
+
12
+ GO_TEMPLATE=" package main\n\nfunc main() {\n \n}\n"
13
+ echo -en " $GO_TEMPLATE " | tee main1.go main2.go > /dev/null
14
+
15
+
16
+ cat > Makefile << EOF
17
+ 1:
18
+ go run main1.go <input
19
+
20
+ 2:
21
+ go run main2.go <input
22
+ EOF
9
23
10
24
# download input files
11
- http " https://adventofcode.com/$YEAR /day/$DAY /input" " Cookie:session=$COOKIE_TOKEN ;" > " $YEAR / $DAY / input"
25
+ http " https://adventofcode.com/$YEAR /day/$DAY /input" " Cookie:session=$AOC_SESSION ;" > input
12
26
13
27
# download assignment
14
- http " https://adventofcode.com/$YEAR /day/$DAY " " Cookie:session=$COOKIE_TOKEN ;" | pup ' article.day-desc' > " $YEAR / $DAY / tmp.html"
15
- lynx -dump " $YEAR / $DAY / tmp.html" -width 80 > " $YEAR / $DAY / assignment"
16
- rm -f " $YEAR / $DAY / tmp.html"
28
+ http " https://adventofcode.com/$YEAR /day/$DAY " " Cookie:session=$AOC_SESSION ;" | pup ' article.day-desc' > tmp.html
29
+ lynx -dump tmp.html -width 80 > assignment
30
+ rm -f tmp.html
You can’t perform that action at this time.
0 commit comments