Skip to content

Instantly share code, notes, and snippets.

View jevinskie's full-sized avatar

Jevin Sweval jevinskie

View GitHub Profile
@am17an
am17an / mtp-bench.py
Last active June 19, 2026 15:32
MTP benchmark
#!/usr/bin/env python3
import argparse, json, sys, time
from urllib import request
PROMPTS = [
{"name": "code_python", "prompt": "Write a Python function that returns the n-th Fibonacci number using memoization. Include a docstring."},
{"name": "code_cpp", "prompt": "Write a C++ template function `clamp(x, lo, hi)` that returns x clamped to [lo, hi]. No std::clamp."},
{"name": "explain_concept", "prompt": "Explain how speculative decoding works in large language model inference, in three short paragraphs."},
{"name": "summarize", "prompt": "Summarize in two sentences: The Industrial Revolution began in Britain in the late 18th century, transforming manufacturing through mechanization, steam power, and the factory system. It spread to continental Europe and North America during the 19th century."},
{"name": "qa_factual", "prompt": "Q: What are the four fundamental forces of physics?\nA:"},
@robtaylor
robtaylor / check_abc9_pipeline.py
Created March 9, 2026 18:26
Static analysis: vOrigins propagation coverage in ABC's GIA Dup functions
#!/usr/bin/env python3
"""
Cross-reference: which "missing" Dup functions are reachable from the
abc9 engine entry points?
abc9 engines: &dc2, &dch, &syn2, &synch2, &if, &jf, &lf, &nf, &mfs,
&sweep, &scorr, &read, &write
"""
import re, sys
@dhinakg
dhinakg / serial.md
Created December 15, 2025 18:27
Getting serial on modern Macs

Getting serial on modern Macs

Modern devices default to serial output over DockChannel by default, which is why macvdmtool serial doesn't work. In order to use legacy UART:

On the target device:

  1. Disable SIP
  2. Disable boot-arg filtering
  3. Set the following boot args:
  • serial=3 (or serial=7 or whatever)
#!/usr/bin/env python3
"""
Device Tree Overlay Generator - Generates DTS overlays with fragments.
Creates overlay files that can be dynamically loaded to modify existing device trees
"""
import argparse
import sys
import os
import json
@arianvp
arianvp / SSH_MACOS_SECURE_ENCLAVES.md
Last active June 27, 2026 12:16
Native Secure Enclaved backed ssh keys on MacOS

Native Secure Enclave backed ssh keys on MacOS

It turns out that MacOS Tahoe can generate and use secure-enclave backed SSH keys! This replaces projects like https://github.com/maxgoedjen/secretive

There is a shared library /usr/lib/ssh-keychain.dylib that traditionally has been used to add smartcard support to ssh by implementing PKCS11Provider interface. However since recently it also implements SecurityKeyProivder which supports loading keys directly from the secure enclave! SecurityKeyProvider is what is normally used to talk to FIDO2 devices (e.g. libfido2 can be used to talk to your Yubikey). However you can now use it to talk to your Secure Enclave instead!

#!/usr/bin/python3
# SPDX-FileCopyrightText: 2025 Alexis Engelke
# SPDX-License-Identifier: Apache-2.0
from bisect import bisect_right
from dataclasses import dataclass, replace, field
from typing import NamedTuple
import sys
from elftools.elf.elffile import ELFFile
from elftools.dwarf.callframe import FDE
@MaskRay
MaskRay / be_prefix_varint.c
Last active February 3, 2026 19:16
variants of Little Endian Base 128 where the length information is in the first byte
#include <assert.h>
#include <inttypes.h>
#include <stdbit.h>
#include <stdio.h>
#include <string.h>
/*
Big-endian prefix varint encoding for 64-bit integers.
The first byte determines the total length using most significant bits.
import HDL
import MM4
import MolecularRenderer
import OpenMM
import QuaternionModule
import Foundation
import func QuartzCore.CACurrentMediaTime // profiling on macOS
// MARK: - Compile Structure
@hoyhoy
hoyhoy / llvm_two_stage_build.sh
Last active April 19, 2026 10:35
LLVM 22.1.3 Two Stage Build Script for MacOS 15.7
#!/usr/bin/env bash
# Bash script to complile LLVM
# @hoyhoy
# 11/18/2025
# Installs to /opt/llvm-${LLVM_VERSION} i.e. /opt/llvm-21.1.6
# and then symbolically link /opt/llvm-latest to /opt/llvm-21.1.6
#!/bin/bash
# MacBook Lid Angle Sensor Diagnostic Script
# This script helps identify the lid angle sensor on different MacBook models
echo "=============================================="
echo "MacBook Lid Angle Sensor Diagnostic Tool"
echo "=============================================="
echo ""