This repository contains my solutions for Advent of Code 2020 in whatever languages I feel like. Every solution is a single file which you can just run like this ./d2/d2.hs
or ./d2/d2.lua
. The code always starts with a shebang line that runs the code in a Nix shell. That means you don't need to install anything, it's all temporary and self-contained.
The Clojure is to be run by opening the file in your favorite editor and interactively evaluating things. No shebang here.
There are also a few other tools installed for you in the base Nix shell, such as ormolu
for formatting Haskell and hlint
for linting, and so on.
Start cat
and wait for input
$ mkdir d2
$ cat > d2/input.txt
Reload and run
$ echo "d2/d2.hs" | entr -sc "cat d2/input.txt | ./d2/d2.hs"
Haskell | Lua | Clojure | |
---|---|---|---|
1 | 🔔 | 🔔 | 💤 |
2 | 🔔 | 🔔 | 💤 |
3 | 🔔 | 🔔 | 💤 |
4 | 🔔 | 🔔 | 💤 |
5 | 🔔 | 💤 | 💤 |
6 | 🔔 | 💤 | 💤 |
7 | 🔔 | 💤 | 💤 |
8 | 🔔 | 💤 | 💤 |
9 | 💤 | 🔔 | 💤 |
10 | 🔔 | 💤 | 💤 |
11 | 🔔 | 💤 | 💤 |
12 | 🔔 | 💤 | 💤 |
13 | 💤 | 💤 | 🔔 |
14 | 💤 | 💤 | 🔔 |
15 | 💤 | 💤 | 🔔 |
16 | 💤 | 💤 | 🔔 |
17 | 💤 | 💤 | 🔔 |
18 | 🔔 | 💤 | 💤 |
19 | 🔔 | 💤 | 💤 |
20 | 🔔 | 💤 | 💤 |
21 | 🔔 | 💤 | 💤 |
22 | 🔔 | 💤 | 💤 |
23 | 🔔 | 💤 | 💤 |
24 | 🔔 | 💤 | 💤 |
25 | 🔔 | 💤 | 💤 |
Post code on reddit (use pbcopy
on MacOS)
$ cat code | sed 's/^/ /' | xsel -b`