Skip to content

Instantly share code, notes, and snippets.

View sanmai's full-sized avatar

Alexey Kopytko sanmai

View GitHub Profile
@sanmai
sanmai / README.md
Created October 18, 2026 00:00
HMAC-SHA256 magic hash pair
<?php
$body = 'magic-hash-00000434871031216900';
$key  = 'hmac-sha256-magic-hash-key';
$want = '0e54716623902408569054496933889872294553517404006854343223678539';

$digest = hash_hmac('sha256', $body, $key);
printf("PHP digest matches found hit : %s\n", var_export($digest === $want, true));
printf("is_numeric(0e547...)         : %s\n", var_export(is_numeric($digest), true));
echo "loose comparisons (all should be true):\n";
@sanmai
sanmai / Qwen3.8-Flash-Next.sh
Last active October 8, 2026 07:30
Best settings for Qwen3.8 Flash Next @ RTX 5090
#!/bin/sh
hf download ggml-org/Qwen3.8-Flash-Next-GGUF --include '*Q4_*' --include '*.md' --include "*mmproj-*Q8*.gguf*"
exec llama-server -hf ggml-org/Qwen3.8-Flash-Next-GGUF:IQ4_NL \
--no-mmproj -ctk q8_0 -ctv q5_1 \
-t 8 --cpu-mask 0x5555 -b 2048 -ub 2048 \
-cmoe --moe-cache-mib 19000 --load-mode none "$@"
@sanmai
sanmai / gen-random-corpus.py
Created June 10, 2026 05:59
KV-quant sweep
#!/usr/bin/env python3
"""Generate a Python source file of functions with incompressible random bodies.
Real code is compressible: a noisy KV-cache retrieval still lands the right token
because the model's language prior reconstructs it. That hides KV-quant error.
This corpus removes the prior — every body line is a random identifier bound to a
random string literal, so verbatim recall MUST come from the KV cache and nowhere
else. That is the regime where q8 vs q4 K/V should finally diverge.
Output is valid Python (parses with `ast`), so the existing .py extractor and the
@sanmai
sanmai / b760m.conf
Last active June 4, 2026 12:11
ASUS TUF B760M-PLUS WIFI D4 (Nuvoton NCT6798D)
# /etc/sensors.d/b760m.conf
# ASUS TUF GAMING B760M-PLUS WIFI D4 -- Nuvoton NCT6798D (nct6798-isa-0290)
# SilverStone ALTA G1M
# Apply with: sudo sensors -s
chip "nct6798-*"
# ============ Temperatures ============
label temp1 "Motherboard" # SYSTIN
@sanmai
sanmai / README.md
Last active May 27, 2026 06:06
memtest86+ with secure boot on debian

have MOK enrolled but grub gives you shit with bad shim signature when starting memtest86+?

fear no more, this is the script that will sign your mt86 binary so that secure enabled system can load it

Corsair Link Node Documentation

USB ID 1b1c:0c04 is shared by several legacy Corsair Link devices, including at least:

  • Corsair H80i, H100i, H110i GT (AIO coolers)
  • Corsair Link Cooling Node
  • Corsair Commander Mini (fan + temperature + RGB controller)

They all present as a single "Integrated USB Bridge" HID endpoint that fronts

@sanmai
sanmai / README.md
Last active May 6, 2026 23:34
zeVirtualMemQueryPageSize probe

Probes zeVirtualMemQueryPageSize across a range of allocation sizes to see how Battlemage L0 actually scales the page size and compares that with what public API returns.

Device: Intel(R) Arc(TM) Pro B60 Graphics
request      | page size   
-------------+-------------
1 B          | 64.00 KiB   
4.00 KiB     | 64.00 KiB   
64.00 KiB    | 64.00 KiB   
1.00 MiB | 64.00 KiB 
composer.lock
vendor
@sanmai
sanmai / merge_dna_files.rb
Created August 15, 2022 02:54 — forked from plashchynski/merge_dna_files.rb
Tool to merge 23andme and Ancestory.com raw dna files
#!/usr/bin/ruby
#
# Usage:
# ruby ./merge_dna_files.rb file,file1,file2... > merged_file.txt
#
# Example:
# ruby ./merge_dna_files.rb AncestryDNA.txt genome_John_Doe_v4_Full_20170428065226.txt > merged_raw.txt
#
# Supports 23andMe, AncestryDNA, and Genes for Good 23andMe compatible file formats.
# The result will be in 23andMe file format.
# add to .profile
set-title () {
# If the length of string stored in variable `PS1_BAK` is zero...
# - See `man test` to know that `-z` means "the length of STRING is zero"
if [[ -z "$PS1_BAK" ]]; then
# Back up your current Bash Prompt String 1 (`PS1`) into a global backup variable `PS1_BAK`
PS1_BAK="$PS1"
fi