Skip to content

Instantly share code, notes, and snippets.

View dexhunter's full-sized avatar
🏠
Working from home

Dex dexhunter

🏠
Working from home
View GitHub Profile
@dexhunter
dexhunter / llm-wiki.md
Created April 6, 2026 13:19 — forked from karpathy/llm-wiki.md
llm-wiki

LLM Wiki

A pattern for building personal knowledge bases using LLMs.

This is an idea file, it is designed to be copy pasted to your own LLM Agent (e.g. OpenAI Codex, Claude Code, OpenCode / Pi, or etc.). Its goal is to communicate the high level idea, but your agent will build out the specifics in collaboration with you.

The core idea

Most people's experience with LLMs and documents looks like RAG: you upload a collection of files, the LLM retrieves relevant chunks at query time, and generates an answer. This works, but the LLM is rediscovering knowledge from scratch on every question. There's no accumulation. Ask a subtle question that requires synthesizing five documents, and the LLM has to find and piece together the relevant fragments every time. Nothing is built up. NotebookLM, ChatGPT file uploads, and most RAG systems work this way.

@dexhunter
dexhunter / vibe-clock-data.json
Last active April 27, 2026 16:00
vibe-clock stats — AI coding agent usage
{
"generated_at": "2026-04-27T16:00:01.607713Z",
"days_covered": 30,
"total_sessions": 11,
"total_messages": 590,
"total_minutes": 6836.4,
"total_tokens": {
"input_tokens": 41216250,
"output_tokens": 508456,
"cache_read_tokens": 70234334,
test
@dexhunter
dexhunter / check.py
Created June 15, 2025 08:43
ai domain available check (alab -> zlab)
#!/usr/bin/env python3
"""
Check alab.ai … zlab.ai using RDAP (https over 443, no WHOIS needed)
"""
import string, time, requests
RDAP = "https://rdap.identitydigital.services/rdap/domain/{}"
def is_available(domain: str) -> bool | None:
r = requests.get(RDAP.format(domain), timeout=10)
import os
from openai import OpenAI, APIError, APITimeoutError
import copy
import json
# Ensure the OPENAI_API_KEY environment variable is set
api_key = os.environ.get("OPENAI_API_KEY")
if not api_key:
print("Error: OPENAI_API_KEY environment variable not set.")
exit(1)
@dexhunter
dexhunter / simple-server.py
Last active March 19, 2025 04:22
Full example for fastapi integration with mcp
"""
Simple example of using MCP to add an MCP server to a FastAPI app.
"""
import inspect
import json
import re
from typing import List, Optional
import click
@dexhunter
dexhunter / rng.js
Last active March 12, 2025 12:25
idleon hack
Math.originalRandom = Math.random;
Math.lowRandom = function() {
return Math.originalRandom() / 100000000000;}
Math.highRandom = function() {
return 1 - Math.lowRandom();}
let breakCycle = false;function luckyCycle() {
return setTimeout(function() {
if (breakCycle) return;
@dexhunter
dexhunter / bulk-remove-youtube-subscription.js
Last active December 1, 2024 10:54
do it at chrome console
/**
* YouTube bulk unsubscribe fn.
* Wrapping this in an IIFE for browser compatibility.
*/
(async function iife() {
// This is the time delay after which the "unsubscribe" button is "clicked"; Change it as per your need!
var UNSUBSCRIBE_DELAY_TIME = 2000
/**
@dexhunter
dexhunter / 10g-nccl-fast.json
Last active July 1, 2021 07:42
horovod timeline json
[
{"name": "process_name", "ph": "M", "pid": 0, "args": {"start_time_since_epoch_in_micros":1624937181806323}},
{"name": "process_sort_index", "ph": "M", "pid": 0, "args": {"sort_index": 0}},
{"name": "process_name", "ph": "M", "pid": 1, "args": {"name": "allreduce.noname.1"}},
{"name": "process_sort_index", "ph": "M", "pid": 1, "args": {"sort_index": 1}},
{"ph": "B", "name": "NEGOTIATE_ALLREDUCE", "ts": 3399382, "pid": 1},{"ph": "X", "name": "8", "ts": 3399384, "pid": 1, "dur": 0},{"ph": "X", "name": "9", "ts": 3399390, "pid": 1, "dur": 0},{"ph": "X", "name": "10", "ts": 3399392, "pid": 1, "dur": 0},{"ph": "X", "name": "11", "ts": 3399393, "pid": 1, "dur": 0},{"ph": "X", "name": "5", "ts": 7133998, "pid": 1, "dur": 0},{"ph": "X", "name": "4", "ts": 7207126, "pid": 1, "dur": 0},{"ph": "X", "name": "15", "ts": 7239969, "pid": 1, "dur": 0},{"ph": "X", "name": "7", "ts": 7248450, "pid": 1, "dur": 0},{"ph": "X", "name": "6", "ts": 7255862, "pid": 1, "dur": 0},{"ph": "X", "name": "13", "ts": 7283415, "pid": 1, "du
@dexhunter
dexhunter / 2dmesh.cc
Last active June 14, 2021 15:17
2d mesh algorithm in horovod (based on NCCLHierarchicalAllreduce)
#if HAVE_MPI
Status
NCCL2DMesh::Execute(std::vector<TensorTableEntry>& entries,
const Response& response) {
auto& first_entry = entries[0];
// Determine GPU IDs of the devices participating in this communicator.
std::vector<int32_t> nccl_device_map;
nccl_device_map.reserve(
global_state_->controller->GetLocalCommRanks().size());