From 0e8d6bbf3e55e7506e1e92b5292833b1f3907d06 Mon Sep 17 00:00:00 2001 From: JJ Date: Thu, 30 Nov 2023 23:31:34 -0800 Subject: update scripts etc; we're adventing --- util/get | 17 ++++++----------- util/main.ml | 4 ++++ util/run | 2 +- util/watch | 2 +- 4 files changed, 12 insertions(+), 13 deletions(-) create mode 100644 util/main.ml (limited to 'util') diff --git a/util/get b/util/get index 423dfca..8d9d43f 100755 --- a/util/get +++ b/util/get @@ -3,15 +3,10 @@ source "vars" INPUT_URL="https://adventofcode.com/${YEAR}/day/$((10#${DAY}))/input" -mkdir "nim/day${DAY}" -mkdir "nim/day${DAY}/src" -cp "main.nim" "nim/day${DAY}/src/main.nim" -curl $INPUT_URL --cookie "session=${TOKEN}" > "nim/day${DAY}/input.txt" +cp "main.nim" "nim/day${DAY}.nim" +cp "main.ml" "ocaml/day${DAY}.ml" +curl $INPUT_URL --cookie "session=${TOKEN}" > "input/day${DAY}.txt" -cargo new "rust/day${DAY}" -cp "main.rs" "rust/day${DAY}/src/main.rs" -cp "nim/day${DAY}/input.txt" "rust/day${DAY}/input.txt" - -subl -a "nim/day${DAY}/input.txt" -subl -a "nim/day${DAY}/src/main.nim" -# chromium "https://adventofcode.com/${YEAR}/day/$((10#${DAY}))" +subl -a "input/day${DAY}.txt" +subl -a "nim/day${DAY}.nim" +xdg-open "https://adventofcode.com/${YEAR}/day/$((10#${DAY}))" diff --git a/util/main.ml b/util/main.ml new file mode 100644 index 0000000..d50e352 --- /dev/null +++ b/util/main.ml @@ -0,0 +1,4 @@ +let input = + CCIO.(with_in filename read_lines_l) + |> List.map parse_line + |> Array.of_list diff --git a/util/run b/util/run index 3d068e1..ae7bb51 100755 --- a/util/run +++ b/util/run @@ -2,4 +2,4 @@ source "vars" -nim c --warnings:off --hints:off -r "nim/day${DAY}/src/main.nim" "nim/day${DAY}/input.txt" +nim c --warnings:off --hints:off -r "nim/day${DAY}.nim" "input/day${DAY}.txt" diff --git a/util/watch b/util/watch index 9c79c6e..143b9b7 100755 --- a/util/watch +++ b/util/watch @@ -2,6 +2,6 @@ source "vars" -while inotifywait --quiet --event modify "nim/day${DAY}/src/main.nim" +while inotifywait --quiet --event modify "nim/day${DAY}.nim" do ./run done -- cgit v1.2.3-70-g09d2