A Pen by Kara Bharat on CodePen.
Discover gists
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <nav> | |
| <a href="#" class="split" style="--font-width: 125"> | |
| TikTok | |
| </a> | |
| <a href="#" class="split"> | |
| </a> | |
| <a href="#" class="split" style="--font-width: 94.5"> | |
| </a> |
- After editing source files, use brepl to
requirethe changed namespace with:reloadand test interactively, rather than relying solely oncurlorbb test.
- Call handlers directly — Ring handlers are pure functions (request map → response map). Test them in brepl without going through HTTP or middleware:
(handlers/home-handler {}),(handlers/inspect-handler {}). Inspect response structure with(keys resp)before dumping the full body. - Verify routes with Reitit — Use
reitit.core/match-by-pathto check route matching interactively without a browser:(reitit.core/match-by-path (reitit.ring/router app-routes/routes) "/"). Useful for verifying newly added routes before integration testing. - Compose and inspect HoneySQL queries — Build queries incrementally as data and preview the generated SQL with
(honey.sql/format query {:quoted true})before sending to the database. This lets you verify correctness without executing a
NewerOlder