Skip to content

Instantly share code, notes, and snippets.

View Dinip's full-sized avatar

Dinis Pimpão Dinip

View GitHub Profile
@t3dotgg
t3dotgg / try-catch.ts
Last active October 14, 2025 15:56
Theo's preferred way of handling try/catch in TypeScript
// Types for the result object with discriminated union
type Success<T> = {
data: T;
error: null;
};
type Failure<E> = {
data: null;
error: E;
};
@ayufan
ayufan / taskset.sh
Last active January 4, 2024 10:56
KVM CPU pinning for Proxmox VE
#!/bin/bash
set -eo pipefail
VMID=200
cpu_tasks() {
expect <<EOF | sed -n 's/^.* CPU .*thread_id=\(.*\)$/\1/p' | tr -d '\r' || true
spawn qm monitor $VMID
expect ">"