Skip to content

Instantly share code, notes, and snippets.

@busfahrer
busfahrer / microgpt-moe.py
Created March 10, 2026 15:36
MoE hack of microgpt
"""
The most atomic way to train and run inference for a GPT in pure, dependency-free Python.
This file is the complete algorithm.
Everything else is just efficiency.
@karpathy
"""
import os # os.path.exists
import math # math.log, math.exp
@logan-robbins
logan-robbins / microgpt_dnb.py
Created March 5, 2026 19:45 — forked from karpathy/microgpt.py
microgpt_dnb — Karpathy's microgpt + Dynamic Notes Bus for parallel decoding
"""
microgpt_dnb.py — Fork of Karpathy's microgpt with Dynamic Notes Bus
Original: https://gist.github.com/karpathy/8627fe009c40f57531cb18360106ce95
Paper: https://arxiv.org/abs/2512.10054
Code: https://github.com/logan-robbins/parallel-decoder-transformer
Karpathy's microgpt is the complete GPT algorithm in ~200 lines of pure Python.
This fork adds ~100 lines to show where the Dynamic Notes Bus (DNB), Shared
Notes Cross-Attention (SNC), and Planner Head fit inside the transformer to
@olveirap
olveirap / microgpt.py
Last active March 4, 2026 16:00 — forked from karpathy/microgpt.py
fadam-microgpt
"""
The most atomic way to train and run inference for a GPT in pure, dependency-free Python.
This file is the complete algorithm.
Everything else is just efficiency.
@karpathy
"""
import os # os.path.exists
import math # math.log, math.exp
@mplekh
mplekh / tapegpt.py
Last active March 12, 2026 00:43
Karpathy's microgpt modified to use Wengert Tape architecture (Flat Array of Values instead of Graph of Objects)
import math
import random
random.seed(42)
# -----------------------------------------------------------------------------
# Tape-based Autograd Engine
# -----------------------------------------------------------------------------
class Tape:
"""
The most atomic way to train and run inference for a GPT in pure, dependency-free Python.
This file is the complete algorithm.
Everything else is just efficiency.
@karpathy
"""
import os # os.path.exists
import math # math.log, math.exp
@jet10000
jet10000 / https-during-dev.macos.sh
Created October 3, 2022 13:52 — forked from disintegrator/https-during-dev.macos.sh
Use Caddy, mkcert and dnsmasq to expose your development server over HTTPS
brew install caddy mkcert nss dnsmasq
mkcert -install
mkcert '*.app.test' '*.cdn.test'
# rename the certs and move them under /usr/local/etc/caddy/certs
cat <<EOF > /usr/local/etc/caddy/Caddyfile
*.app.test:443, *.cdn.test:443 {
@0187773933
0187773933 / ClipboardImageToB64String.py
Last active October 29, 2022 05:57
Converts Clipboard Image to HTML Base64 String Image
#!/usr/bin/env python3
import os
import time
import subprocess
from PIL import ImageGrab , Image
from pathlib import Path
import io
import codecs
import tempfile
import pyperclip
@HeinrichWizardKreuser
HeinrichWizardKreuser / fileresponseutils.py
Created August 2, 2021 09:51
Django FIleResponse helpers
from django.http import FileResponse
from io import BufferedReader, BytesIO
def file_response_from_str(content: str, filename: str) -> FileResponse:
""" Serves a file response from the given string
Args:
content: str
@hadanischal
hadanischal / charles-proxy-android.md
Created July 14, 2021 05:38 — forked from twaddington/charles-proxy-android.md
How to set up Charles Proxy for the Android Emulator.

Charles Proxy Android

Steps

1. Add the Network Security Configuration to your app

<network-security-config>
   <debug-overrides>
 
@lbatteau
lbatteau / sse-fastapi-redis.py
Last active February 21, 2025 05:19
Server-Sent Events in FastAPI with async Redis Pub/Sub
from aioredis import Channel, Redis
from fastapi import FastAPI
from fastapi.params import Depends
from fastapi_plugins import depends_redis, redis_plugin
from sse_starlette.sse import EventSourceResponse
from starlette.responses import HTMLResponse
html = """
<!DOCTYPE html>
<html>