aboutsummaryrefslogtreecommitdiff
path: root/aoc
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xaoc16
1 files changed, 15 insertions, 1 deletions
diff --git a/aoc b/aoc
index 13b89e7..d95a245 100755
--- a/aoc
+++ b/aoc
@@ -24,11 +24,25 @@ if [ ! -e input.txt ]; then
24 curl "$url" -H "cookie: session=$AOC_SESSION_COOKIE" -o input.txt 24 curl "$url" -H "cookie: session=$AOC_SESSION_COOKIE" -o input.txt
25fi 25fi
26 26
27# Download the problem statement page and split out the code blocks
28url="https://adventofcode.com/$year/day/$daynozero"
29curl "$url" | sed -n '/<pre><code>/,/<\/code><\/pre>/ p' | (\
30 i=1
31 rm -f "code-$i.txt"
32 while read line; do
33 if [ "$line" = "</code></pre>" ]; then
34 i=$((i + 1))
35 rm -f "code-$i.txt"
36 else
37 echo "$line" | sed 's/<.*>//g' >> "code-$i.txt"
38 fi
39 done
40)
41
27# Open a tmux session with lynx in its own windows, and an editor and a 42# Open a tmux session with lynx in its own windows, and an editor and a
28# terminal in split view. 43# terminal in split view.
29printf 'adventofcode.com\tFALSE\t/\tTRUE\t2079722976\tsession\t%s' \ 44printf 'adventofcode.com\tFALSE\t/\tTRUE\t2079722976\tsession\t%s' \
30 "$AOC_SESSION_COOKIE" > "$lynx_cookie_file" 45 "$AOC_SESSION_COOKIE" > "$lynx_cookie_file"
31url="https://adventofcode.com/$year/day/$daynozero"
32tmux new-session \; \ 46tmux new-session \; \
33 send-keys "$editor" C-m \; \ 47 send-keys "$editor" C-m \; \
34 split-window -h \; \ 48 split-window -h \; \

Generated with cgit - Back to sebastiano.tronto.net