Skip to content

Instantly share code, notes, and snippets.

View aquarhead's full-sized avatar
🦀
a Rusty programmer

LOU Xun aquarhead

🦀
a Rusty programmer
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
@aquarhead
aquarhead / terminal.ahk
Last active November 3, 2016 17:45
AutoHotkey config for Babun on Windows simulating my config on OS X for iTerm
WinGetActiveTitle, LastActiveWindowTitle
Run, babun
!`::
IfWinActive, Yukinoshita
{
WinHide, Yukinoshita
WinActivate, %LastActiveWindowTitle%
}
else