Skip to content

Instantly share code, notes, and snippets.

@timClicks
timClicks / bfs.rs
Created February 15, 2022 03:19
Breadth-first search in Rust
// watch the video if you would like an explanation of this code
// https://youtu.be/FoNJ5zhL6bQ
use std::collections::{HashSet, VecDeque};
use std::hash::Hash;
trait Graph {
type Node: Hash + Eq + Clone + std::fmt::Debug;
fn neighbours(&self, node: &Self::Node) -> Vec<Self::Node>;
@forresto
forresto / tiptap-lite-youtube.ts
Last active May 5, 2025 11:02
tiptap-lite-youtube node type
// Registers the lite-youtube custom element
import "@justinribeiro/lite-youtube";
import { Node, mergeAttributes } from "@tiptap/core";
import { Plugin, PluginKey } from "prosemirror-state";
// Captures the YouTube ID as the first matching group.
// Vendored 2021-10-07 from https://github.com/micnews/youtube-url/blob/master/index.js
const youtubeRegExp =
/^(?:(?:https?:)?\/\/)?(?:www\.)?(?:m\.)?(?:youtu(?:be)?\.com\/(?:v\/|embed\/|watch(?:\/|\?v=))|youtu\.be\/)((?:\w|-){11})(?:\S+)?$/;
@bitonic
bitonic / configuration.nix
Last active April 24, 2025 10:07
NixOS configuration for a remote ZFS server on Hetzner
# Full NixOS configuration for a ZFS server with full disk encryption hosted on Hetzner.
# See <https://mazzo.li/posts/hetzner-zfs.html> for more information.
{ config, pkgs, ... }:
let
# Deployment-specific parameters -- you need to fill these in where the ... are
hostName = "...";
publicKey = "...";
# From `ls -lh /dev/disk/by-id`
@munrocket
munrocket / wgsl_3d_sdf.md
Last active March 2, 2025 22:13
WGSL 3D SDF Primitives

WGSL 3D SDF Primitives

Revision: 06.08.2023, https://compute.toys/view/407

Sphere - exact

fn sdSphere(p: vec3f, r: f32) -> f32 {
  return length(p) - r;
}

PWM fan control in Linux with a Gigabyte Aorus motherboard

  • install lm-sensors with your package manager

sensors

If it won't show any fan/speed, continue

sensor-detect

@Zenithar
Zenithar / Archlinux-EFI-LUKS2-LVM2-BTRFS-Systemd.md
Last active November 16, 2022 12:52
Tutorial d'installation Archlinux sur un SSD (NVMe) avec EFI / LUKS2 / LVM2 / BTRFS et systemd-boot comme chargeur de démarrage.

section: post date: "2020-04-12" title: "Archlinux sur un SSD avec EFI / LUKS2 / LVM2 / BTRFS" description: "Procédure d'installation d'Archlinux mise à jour et modernisée" slug: archlinux-efi-ssd-luks2-lvm2-btrfs tags:

  • linux
  • devops
  • luks2
@gbrow004
gbrow004 / ubuntu-MBP-16.md
Last active March 11, 2025 06:50
Ubuntu on Apple Macbook Pro 16-inch (2019)

Update!

This gist is out of date and I can no longer help much, as I got rid of my Mac.

Please visit T2 Linux website for more and better information:

https://t2linux.org/

Acknowledgements

This gist is just a compilation of the hard work that others have put in. I'm not a software developer, so if there are any mistakes or better ways of doing things, I'd appreciate any suggestions. Here's a list of the real heroes who made this possible:

@rickmark
rickmark / clean_t2_restore.sh
Last active March 15, 2024 20:18
Perform a FOSS restore of an Apple T2 processor
#!/bin/bash
WORKING_DIRECTORY=`pwd`
repo_list=(libimobiledevice idevicerestore libplist libusbmuxd usbmuxd libirecovery)
for repo in ${repo_list[@]}; do
directory="$WORKING_DIRECTORY/$repo"
if [ -d "$directory" ]; then
rm -rf "$directory"
fi
@emptyflask
emptyflask / config.nix
Created October 29, 2019 20:34
ruby nix shell
import ( builtins.fetchGit {
name = "nixpkgs-2019-08-25";
url = https://github.com/nixos/nixpkgs/;
rev = "8d1510abfb592339e13ce8f6db6f29c1f8b72924";
}) {
config = {
allowUnfree = true;
};
}
@Neo23x0
Neo23x0 / Base64_CheatSheet.md
Last active March 31, 2025 08:27
Learning Aid - Top Base64 Encodings Table

Base64 Patterns - Learning Aid

Base64 Code Mnemonic Aid Decoded* Description
JAB 🗣 Jabber $. Variable declaration (UTF-16), e.g. JABlAG4AdgA for $env:
TVq 📺 Television MZ MZ header
SUVY 🚙 SUV IEX PowerShell Invoke Expression
SQBFAF 🐣 Squab favorite I.E. PowerShell Invoke Expression (UTF-16)
SQBuAH 🐣 Squab uahhh I.n. PowerShell Invoke string (UTF-16) e.g. Invoke-Mimikatz
PAA 💪 "Pah!" &lt;. Often used by Emotet (UTF-16)