Skip to content

Instantly share code, notes, and snippets.

View magistau's full-sized avatar
☮️
pls no war

Tau magistau

☮️
pls no war
View GitHub Profile
@magistau
magistau / main.rs
Last active September 21, 2024 07:21
Simple command line parser with clap
use clap::Parser;
use regex::Regex;
use std::{
fmt::{self, Debug, Display},
str::FromStr,
};
use thiserror::Error;
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
enum Browser {
#[macro_export]
macro_rules! opt_metavar {
(; $default:tt) => {
$default
};
($opt:tt; $default:tt) => {
$opt
};
}
@magistau
magistau / astar.typ
Created September 17, 2025 20:09
A* algorithm implemented in Typst
#let astar(edges, start: "S", heur: auto, target: none) = {
if heur == auto {
heur = _ => 0;
} else {
assert.ne(target, none, message: "A* requires a target node to be set");
}
if type(heur) == dictionary {
heur = x => heur.at(x);
}
if type(edges) == dictionary {