by Glenn Matlin / glennmatlin on all socials
- Download and copy all files in this gist to
~/.claude/ - Move the
.pyfiles to~/.claude/hooks - Restart Claude Code.
| #!/usr/bin/env python3 | |
| """ | |
| TinyAdder: 36-parameter hand-crafted transformer for 10-digit addition. | |
| Parameter counting: | |
| - Identity mappings (direct copy): 0 params | |
| - Broadcast (1 value to N outputs): 1 param | |
| - Distinct values: count each | |
| """ | |
| import torch |
| """ | |
| Dynamic NanoGPT Adder: 130 params + 0 buffers | |
| transformer.wte.A [10, 1] = 10 | |
| transformer.wte.B [1, 4] = 4 | |
| transformer.h.0.attn.c_attn.weight [12, 4] = 48 | |
| transformer.h.0.attn.c_proj.weight [4, 4] = 16 | |
| transformer.h.0.mlp.c_fc.weight [4, 4] = 16 | |
| transformer.h.0.mlp.c_fc.bias [4] = 4 | |
| transformer.h.0.mlp.c_proj.u [4, 1] = 4 |
| """ | |
| The most atomic way to train and inference 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 |
| { | |
| "agent_servers": { | |
| "OpenCode": { | |
| "command": "opencode", | |
| "args": ["acp"] | |
| } | |
| } | |
| } |
| import os | |
| from google import genai | |
| from google.genai import types | |
| client = genai.Client(api_key=os.getenv("GEMINI_API_KEY","xxx")) | |
| # Repalce with the youtube url you want to analyze | |
| youtube_url = "https://www.youtube.com/watch?v=RDOMKIw1aF4" | |
| # Prompt to analyze and summarize the Youtube Video |
This defines risk levels for actions that the ${K4} agent may take. This classification system is part of a broader safety framework and is used to determine when additional user confirmation or oversight may be needed.
Examples:
| """ | |
| A micro event loop library implementation from scratch. | |
| This library provides a minimal but feature-complete asynchronous event loop | |
| implementation for educational purposes. It demonstrates the core concepts of | |
| asynchronous programming including: | |
| - Task scheduling and management | |
| - I/O multiplexing with non-blocking sockets | |
| - Timeouts and sleep functionality |
| ######################### Preamble ########################################### | |
| SHELL := bash | |
| .ONESHELL: | |
| .SHELLFLAGS := -eu -o pipefail -c | |
| .DELETE_ON_ERROR: | |
| .SECONDEXPANSION: | |
| MAKEFLAGS += --warn-undefined-variables | |
| MAKEFLAGS += --no-builtin-rules | |
| MAKEFLAGS += -j$(shell nproc) |