Skip to content

Instantly share code, notes, and snippets.

View QuantumGhost's full-sized avatar
🎯

QuantumGhost QuantumGhost

🎯
View GitHub Profile
Complete stuff:
https://xmonader.github.io/letsbuildacompiler-pretty/
Lexers + DFAs:
https://gist.github.com/pervognsen/218ea17743e1442e59bb60d29b1aa725
Parsing:
https://eli.thegreenplace.net/2012/08/02/parsing-expressions-by-precedence-climbing
Backend:
@surma
surma / .gitignore
Created February 1, 2023 15:48
Wasm GC
*.wasm
@Kranzes
Kranzes / guide.md
Last active June 24, 2025 21:09
SSH Resident Key Guide

Initial checks

Start by checking that there aren't any previous ssh keys inside the FIDO2 authenticator of your YubiKey. You can check if they exist by running the command below:

nix shell nixpkgs#yubikey-manager -c ykman fido credentials list

If the command above outputs a string mentioning "ssh" or "openssh", then you have already got a key generated and store on your YubiKey.

Evaluating additional authentication factors

Before generating a new ssh key to store on your YubiKey you must consider which additional required authentication factors you want to use. Below you can see a table with the available factors and their corresponding command:

@LeviMarvin
LeviMarvin / table.txt
Created July 12, 2022 05:08
Xiaomi Mi 8 (dipper) full partition table included SoC partitions.
dipper:/ # ls -l /dev/block/platform/soc/1d84000.ufshc/by-name/
total 0
lrwxrwxrwx 1 root root 15 1970-01-21 06:45 ImageFv -> /dev/block/sdf4
lrwxrwxrwx 1 root root 16 1970-01-21 06:45 abl_a -> /dev/block/sde32
lrwxrwxrwx 1 root root 16 1970-01-21 06:45 abl_b -> /dev/block/sde33
lrwxrwxrwx 1 root root 16 1970-01-21 06:45 aop_a -> /dev/block/sde14
lrwxrwxrwx 1 root root 16 1970-01-21 06:45 aop_b -> /dev/block/sde15
lrwxrwxrwx 1 root root 15 1970-01-21 06:45 apdp -> /dev/block/sde6
lrwxrwxrwx 1 root root 15 1970-01-21 06:45 bk01 -> /dev/block/sda3
lrwxrwxrwx 1 root root 15 1970-01-21 06:45 bk02 -> /dev/block/sda4
@Widdershin
Widdershin / ssr.md
Last active May 1, 2024 17:36
The absurd complexity of server-side rendering

In the olden days, HTML was prepared by the server, and JavaScript was little more than a garnish, considered by some to have a soapy taste.

After a fashion, it was decided that sometimes our HTML is best rendered by JavaScript, running in a user's browser. While some would decry this new-found intimacy, the age of interactivity had begun.

But all was not right in the world. Somewhere along the way, we had slipped. Our pages went uncrawled by Bing, time to first meaningful paint grew faster than npm, and it became clear: something must be done.

And so it was decided that the applications first forged for the browser would also run on the server. We would render our HTML using the same logic on the server and the browser, and reap the advantages of both worlds. In a confusing series of events a name for this approach was agreed upon: Server-side rendering. What could go wrong?

In dark rooms, in hushed tones, we speak of colours.

From self[at]sungpae.com Mon Nov 8 16:59:48 2021
Date: Mon, 8 Nov 2021 16:59:48 -0600
From: Sung Pae <self[at]sungpae.com>
To: [email protected]
Subject: Permissive forwarding rule leads to unintentional exposure of
containers to external hosts
Message-ID: <YYmr4l1isfH9VQCn@SHANGRILA>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha256;
protocol="application/pgp-signature"; boundary="QR1yLfEBO/zgxYVA"
@moyix
moyix / killbutmakeitlooklikeanaccident.sh
Created February 5, 2022 22:51
Script to inject an exit(0) syscall into a running process. NB: only x86_64 for now!
#!/bin/bash
gdb -p "$1" -batch -ex 'set {short}$rip = 0x050f' -ex 'set $rax=231' -ex 'set $rdi=0' -ex 'cont'
"""
This is based on https://en.wikipedia.org/wiki/Ramer%E2%80%93Douglas%E2%80%93Peucker_algorithm,
with the requirement that the maximum norm is used for distance calculations.
The algorithm is as follows, described for R^2, but it is easily extensible to
arbitrary dimensions >2:
- given points p_1, ..., p_n, we start by constructing our funnel
by calculating
dp_1 = (p_2 - p_1)
x_1_top = (dp_1_y + epsilon) / dp_1_x
let
pkgs = import <nixpkgs> {};
inherit (pkgs) lib;
src = pkgs.fetchgit {
url = "https://gitlab.com/NickCao/RAIT";
rev = "e84e803641ec3a2dce5670275ea8d5497608f483";
fetchSubmodules = false;
deepClone = false;
leaveDotGit = false;
sha256 = "sha256-vaRPmHrom4GEOuAdILzFpttc4vwcRVQWhLNalCco2qE=";
from bcc import BPF
import ctypes
bpf_text ="""
#include <linux/ptrace.h>
#include <linux/sched.h> /* For TASK_COMM_LEN */
#include <linux/icmp.h>
#include <linux/ip.h>
#include <linux/netdevice.h>