Skip to content

Instantly share code, notes, and snippets.

View aquarhead's full-sized avatar
💙
deep blue

LOU Xun aquarhead

💙
deep blue
View GitHub Profile
@aquarhead
aquarhead / day16.exs
Last active December 21, 2022 11:46
aoc2022day16
Mix.install([:libgraph])
{valves, graph} =
File.read!("input2.txt")
|> String.trim()
|> String.split("\n")
|> Enum.reduce({%{}, Graph.new(type: :undirected)}, fn line, {vs, g} ->
[v, e] = line |> String.split(";")
[v, f] = v |> String.split("=")
f = String.to_integer(f)
@aquarhead
aquarhead / build.rs
Last active August 15, 2023 12:35
Fully Automated Rust Code Generation for Large Protobuf/gRPC Repos
use std::{collections::HashSet, env, fmt::Write, fs, path::Path};
use walkdir::WalkDir;
type Res = Result<(), Box<dyn std::error::Error>>;
// replace:
// "ROOT DIR": root dir of proto files to generate
// "INCLUDE DIR": where all "package" specifier based on
// "REPO DIR": where to monitor change for build.rs rerun
SPECIFICATION Spec
\* Add statements after this line.
CONSTANTS
OUTDATED = "outdated"
UPDATING = "updating"
UPDATED = "updated"
INVARIANTS
SameVersion