Skip to content

Instantly share code, notes, and snippets.

@am17an
am17an / mtp-bench.py
Last active May 21, 2026 07:39
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:"},
@am17an
am17an / llama-server.ts
Created April 24, 2026 16:00
Pi extension for llama-server router — live model listing, load/unload, per-project config
// ~/.pi/agent/extensions/llama-server.ts
// Pi extension for llama-server router integration
//
// Configure per-project via .pi/llama-server.json:
// { "url": "http://10.0.0.5:9090" }
//
// Or globally via env: LLAMA_SERVER_URL=http://host:port
// Defaults to http://127.0.0.1:8080
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
@am17an
am17an / gist:6833d30230b877c93abf33ca12a07937
Created November 30, 2025 10:42
SoL calculation for gpt-oss for 5090
Model stats:
- Total parameters: 21B
- Active parameters per token: 3.6B
- Experts: 32 total, 4 active per layer
- Layers: 24
- Expert precision: 4-bit (0.5 bytes per parameter)
- Dense precision: BF16 (2 bytes per parameter)
1. Expert size:
@am17an
am17an / bench.cpp
Last active June 30, 2025 14:30
Vibe coded performance bench for ggml conv2d
#include "ggml.h"
#include "ggml-cpu.h"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <algorithm>
#include <vector>
// Function to print a tensor in readable format
@am17an
am17an / check.py
Created May 16, 2021 14:26
CheckSlots.py - check COWIN slots for 18+ and send email
import os,json
import subprocess
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
import smtplib
import sys
from datetime import datetime,timedelta
import time
#change this your email/password or any random email password. You have to enable less secure apps for this to work (i.e. send emails from your email)
@am17an
am17an / gist:37196eb0d582d387718f79912ee2156f
Created May 16, 2021 13:43
Cowin District-ID mapping
#kindly stolen from getjab.in
582 Adilabad
320 Agar
622 Agra
154 Ahmedabad
770 Ahmedabad Corporation
391 Ahmednagar
425 Aizawl East
426 Aizawl West
507 Ajmer
PVector[] stars;
float[] phase;
void setup() {
size(600, 600, P3D);
stars = new PVector[1000];
phase = new float[1000];
for(int i = 0 ; i < 1000; ++i) {
stars[i] = new PVector(random(width), random(height));
void setup() {
size(600, 600, P3D);
smooth(8);
hint(ENABLE_STROKE_PURE);
}
ArrayList<Ripple> ripples = new ArrayList<Ripple>();
// R is total radius of the thing
do {
standInLine();
} while(!She.hasTime());
SpendEvening();
function SpendEvening(){
if(goingToDance) {
var chance = Math.random();
if(chance < LEAVE_WITHOUT_ME) {
import peasy.*;
PeasyCam cam;
void setup() {
size(600, 600, P3D);
smooth(8);
cam = new PeasyCam(this, 400);
}