Skip to content

Instantly share code, notes, and snippets.

@lumpsoid
lumpsoid / microgpt.py
Created March 2, 2026 20:31 — forked from karpathy/microgpt.py
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
@lumpsoid
lumpsoid / devshell_keep.sh
Created August 17, 2024 15:43
Script to create gcroot directory for a devshell on nixos to make its packages persistent.
#!/usr/bin/env bash
# Define variables
store_dir="/nix/store"
gcroots_dir="/nix/var/nix/gcroots"
action="$1"
flake_dir="$2"
flake_path="$flake_dir/flake.nix"