Skip to content

Instantly share code, notes, and snippets.

"""
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
#!/usr/bin/env python3
"""
Demonstrate banning the em-dash (and common variants) with logit_bias.
import os, sys, textwrap
import openai # pip install openai>=1.9.0
MODEL = "chatgpt-4o-latest"
PROMPT = ("Write a short sentence that would normally include an em dash "
"(for example between two clauses).")
@brmazzoni
brmazzoni / Dockerfile
Created July 3, 2025 02:32
gemini-cli Dockerfile
# Works with alias: `gemini='docker run -it --rm -e GEMINI_API_KEY=$GEMINI_API_KEY -v $(pwd):/app -v ~/.gemini:/root/.gemini -w /app gemini-cli'`
FROM node
RUN apt-get update && apt-get install -y --no-install-recommends \
vim python3 \
&& apt-get autoremove \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
@sidpan1
sidpan1 / README.md
Created April 8, 2025 07:23
Claude Desktop MCP Server Installer

Claude MCP Setup Script

This script automatically installs and configures MCP (Model Context Protocol) servers for Claude Desktop on macOS. It allows you to enhance Claude with various capabilities like web search, file access, Python execution, and more.

Installation

Run this one-liner in your Terminal:

curl -fsSL https://gist.githubusercontent.com/GITHUB_USERNAME/GIST_ID/raw/claude-mcp-setup.sh | bash

Setting Up MCP Servers on Windows

A step-by-step guide to setting up Model Context Protocol (MCP) servers for Claude Desktop on Windows.

Prerequisites

  1. Install Node.js (v18.x or later)
    • Download from: https://nodejs.org/
    • Verify installation by opening Command Prompt (CMD) and running:
      node --version
      npm --version
@deepfates
deepfates / convert_archive.py
Created November 17, 2024 19:33
Convert your twitter archive into a training dataset and markdown files
import argparse
import json
import logging
import os
import re
import shutil
from concurrent.futures import ProcessPoolExecutor, as_completed
from dataclasses import dataclass
from datetime import datetime
from typing import Any, Callable, Dict, List, Literal, Optional, Tuple
@donmccurdy
donmccurdy / delete_tweets.js
Last active February 7, 2026 22:32
Delete Tweets
// To delete tweets, navigate to your Twitter/X profile, open your browser's JavaScript console, and paste the script below.
async function sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms))
}
async function deleteTweets() {
const tweetsRemaining = document.querySelectorAll('[role="heading"]+div')[1].textContent;
console.log('Remaining: ', tweetsRemaining);
window.scrollBy(0, 10000);
@dupontgu
dupontgu / landscape_to_blurred_portrait.sh
Created September 30, 2024 21:45
Shell script to embed a landscape video inside a blurred, portrait version of itself.
#!/bin/bash
if [ -z "$1" ]; then
echo "Usage: $0 <input_video>"
exit 1
fi
input_file="$1"
if [ -z "$2" ]; then
@stong
stong / cups-browsed.md
Last active November 17, 2025 00:24
CUPS disclosure leaked online. Not my report. The original author is @evilsocket

Original report

  • Affected Vendor: OpenPrinting
  • Affected Product: Several components of the CUPS printing system: cups-browsed, libppd, libcupsfilters and cups-filters.
  • Affected Version: All versions <= 2.0.1 (latest release) and master.
  • Significant ICS/OT impact? no
  • Reporter: Simone Margaritelli [evilsocket@gmail.com]
  • Vendor contacted? yes The vendor has been notified trough Github Advisories and all bugs have been confirmed:
@duyixian1234
duyixian1234 / agent.py
Last active July 11, 2025 07:53
Ai Agent
import json
from collections.abc import Callable
import sys
from typing import Annotated
from function_schema import get_function_schema
from openai import OpenAI
from openai.types.chat import ChatCompletionMessageParam