Skip to content

Instantly share code, notes, and snippets.

@anhkind
anhkind / convert.py
Created July 4, 2026 11:30 — forked from buzz/convert.py
Transplant MTP block from one GGUF file into another
#!/usr/bin/env python3
"""
Transplant extra tensors (e.g. MTP layers) from one GGUF file into another,
producing a mixed-quantization GGUF.
Note: Tested with ik_llama.cpp GGUF Python module.
Usage:
python convert.py <target.gguf> <source.gguf> <output.gguf>
@anhkind
anhkind / solution.py
Created June 16, 2026 06:54
python main template with input parsing
import sys
input = lambda: sys.stdin.readline().rstrip("\r\n")
def parse_int():
return int(input())
def parse_string():
return input()
def parse_list():
@anhkind
anhkind / .wezterm.lua
Created April 8, 2026 12:51
Wezterm config for iTerm hotkey style
-- Pull in the wezterm API
local wezterm = require 'wezterm'
-- This will hold the configuration.
local config = wezterm.config_builder()
-- This is where you actually apply your config choices.
-- For example, changing the initial geometry for new windows:
config.initial_cols = 120
@anhkind
anhkind / steps.txt
Created April 6, 2026 07:55
Switch IDE / RAID to AHCI within Windows 10 without reinstallation
# from https://www.reddit.com/r/Ubuntu/comments/iu6gf9/comment/g5j12p3/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button
1. While logged into Windows normally, click the Start Button and type cmd
2. Right-click the result and select Run as administrator
3. Type this command and press ENTER: bcdedit /set {current} safeboot minimal
4. Restart the computer and enter BIOS Setup
5. Change the SATA Operation mode to AHCI from either IDE or RAID
6. Save changes and exit Setup and Windows will automatically boot to Safe Mode.
7. While in Safe Mode, Right-click the Windows Start Menu once more. Choose Command Prompt (Admin).
8. Type this command and press ENTER: bcdedit /deletevalue {current} safeboot
@anhkind
anhkind / lzw_encoder.js
Created August 29, 2025 02:13 — forked from revolunet/lzw_encoder.js
LZW javascript compress/decompress
// LZW-compress a string
function lzw_encode(s) {
var dict = {};
var data = (s + "").split("");
var out = [];
var currChar;
var phrase = data[0];
var code = 256;
for (var i=1; i<data.length; i++) {
currChar=data[i];
@anhkind
anhkind / memorySizeOf.ts
Created August 13, 2025 03:06
Calculate Memory Size of a JS Object
function memorySizeOf(obj: any) {
const seen = new WeakSet<object>();
function sizeOf(value: any): number {
if (value === null || value === undefined) return 0;
const t = typeof value;
if (t === "number" ) return 8;
if (t === "boolean") return 4;
if (t === "bigint" ) return 8;
@anhkind
anhkind / load_dotenv.sh
Created July 6, 2025 10:26 — forked from mihow/load_dotenv.sh
Load environment variables from dotenv / .env file in Bash
# The initial version
if [ ! -f .env ]
then
export $(cat .env | xargs)
fi
# My favorite from the comments. Thanks @richarddewit & others!
set -a && source .env && set +a
@anhkind
anhkind / unix.md
Last active May 9, 2024 08:36
Unix misc
@anhkind
anhkind / wirerest_grafana_config.yml
Last active April 5, 2024 11:18
Wirerest dashboard on Grafana
# For Grafana dashboard: https://grafana.com/grafana/dashboards/19458-wireguard-wirerest-jvm/
# put these under `metrics.configs.scrape_configs`
- job_name: 'wirerest'
metrics_path: '/actuator/prometheus'
authorization:
credentials: YOUR_WIREREST_TOKEN
static_configs:
targets: ['YOUR_WIREREST_IP:8081']
@anhkind
anhkind / .profile
Last active January 22, 2024 07:18
Select git executable in WSL
# from: https://github.com/microsoft/WSL/issues/4401#issuecomment-670080585
# checks to see if we are in a windows or linux dir
function isWinDir {
case $PWD/ in
/mnt/*) return $(true);;
*) return $(false);;
esac
}
# wrap the git command to either run windows git or linux