Skip to content

Instantly share code, notes, and snippets.

View denjell-crabnebula's full-sized avatar

Daniel denjell-crabnebula

View GitHub Profile
@CrabNejonas
CrabNejonas / pick.rs
Last active December 14, 2023 13:11
Ports the `intersection` algorithm defined between two `BTreeSet<T>`s to a `BTreeMap<K, V>` and a `BTreeSet<K>` essentially retaining only key-value pairs who's keys are part of the set.
use std::cmp::Ordering;
use std::collections::{btree_map, btree_set, BTreeMap, BTreeSet};
use std::iter::FusedIterator;
trait IntersectionExt<K, V> {
fn pick<'a>(&'a self, other: &'a BTreeSet<K>) -> Pick<'a, K, V>
where
K: Ord;
}
@mxcl
mxcl / stargazer.sh
Last active October 31, 2023 17:22
All-in-one Script to Generate your @pomber/stargazer video
#!/usr/bin/env -S pkgx +git +gum +gh +npm +jq bash
# ^^ curl https://pkgx.sh | sh
# ^^ pkgx makes all those tools (including bash!) available to the script
# no packages are installed; your system remains pristine
set -eo pipefail
if [ -d stargazer/.git ]; then
cd stargazer
elif [ ! -d .git ] && gum confirm 'clone to ./stargazer?'; then