Skip to content

Instantly share code, notes, and snippets.

@lumpsoid
lumpsoid / openrouter-current-chat-backup.js
Created April 18, 2026 17:42
openrouter current chat backup
async function backupCurrentRoom() {
// --- find db ---
const dbs = await indexedDB.databases();
const dbEntry = dbs.find(db => db.name.includes(':org_'))
?? dbs.find(db => db.name.startsWith('openrouter:playground:'));
if (!dbEntry) {
console.error('No OpenRouter database found. Make sure you are on openrouter.ai');
return;
}
@lumpsoid
lumpsoid / openrouter-full-backup.js
Created April 18, 2026 17:41
openrouter-full-backup.js
async function fullBackup() {
// --- find db ---
const dbs = await indexedDB.databases();
const dbEntry = dbs.find(db => db.name.includes(':org_'))
?? dbs.find(db => db.name.startsWith('openrouter:playground:'));
if (!dbEntry) {
console.error('No OpenRouter database found. Make sure you are on openrouter.ai');
return;
}
@lumpsoid
lumpsoid / claude-code-web-backup-chat.js
Last active April 3, 2026 08:50
claude-code-web-backup-chat.js
(async function backup(){const sanitizeFilename=s=>s.replace(/[/\\?%*:|"<>]/g,'-');const sleep=ms=>new Promise(r=>setTimeout(r,ms));const BINARY_EXTENSIONS=new Set(['png','jpg','jpeg','gif','webp','svg','ico','pdf','zip','tar','gz','wasm','ttf','woff','woff2']);function getOrgUuid(){const orgUuid=document.cookie.match(/lastActiveOrg=([^;]+)/)?.[1];if(!orgUuid){throw new Error('No orgUuid found in cookies')}return orgUuid}function getConversationFromReactFiber(){const msgEl=document.querySelector('[data-testid="user-message"]');if(!msgEl){throw new Error('No user-message element found in DOM')}const fiberKey=Object.keys(msgEl).find(k=>k.startsWith('__reactFiber'));let fiber=msgEl[fiberKey];for(let depth=0;fiber&&depth<100;fiber=fiber.return,depth+=1){if(fiber.memoizedProps?.conversation?.chat_messages){return fiber.memoizedProps.conversation}}throw new Error('conversation not found in React fiber tree')}async function fetchFileAsEmbeddable(url,filename){const ext=filename.split('.').pop().toLowerCase();const i
@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"