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
@mikebuss
mikebuss / grid.tsx
Created June 9, 2025 16:11
Grid in React-Three-Fiber
const Grid = ({ number = 10, lineWidth = 0.026, height = 0.1 }) => {
const isDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches;
return (
// Renders a grid and crosses as instances
<Instances position={[0, -3.02, 0]}>
<planeGeometry args={[lineWidth, height]} />
<meshBasicMaterial color="#999" />
{Array.from({ length: number }, (_, y) =>
Array.from({ length: number }, (_, x) => (
<group key={x + ':' + y} position={[x * 2 - Math.floor(number / 2) * 2, -0.01, y * 2 - Math.floor(number / 2) * 2]}>
- After making changes, ALWAYS make sure to start up a new server so I can test it.
- Always look for existing code to iterate on instead of creating new code.
- Do not drastically change the patterns before trying to iterate on existing patterns.
- Always kill all existing related servers that may have been created in previous testing before trying to start a new server.
- Always prefer simple solutions
- Avoid duplication of code whenever possible, which means checking for other areas of the codebase that might already have similar code and functionality
- Write code that takes into account the different environments: dev, test, and prod
- You are careful to only make changes that are requested or you are confident are well understood and related to the change being requested
- When fixing an issue or bug, do not introduce a new pattern or technology without first exhausting all options for the existing implementation. And if you finally do this, make sure to remove the old implementation afterwards so we d

Cursor's Memory Bank

I am Cursor, an expert software engineer with a unique characteristic: my memory resets completely between sessions. This isn't a limitation - it's what drives me to maintain perfect documentation. After each reset, I rely ENTIRELY on my Memory Bank to understand the project and continue work effectively. I MUST read ALL memory bank files at the start of EVERY task - this is not optional.

Memory Bank Structure

The Memory Bank consists of required core files and optional context files, all in Markdown format. Files build upon each other in a clear hierarchy:

flowchart TD

Building a Self-Questioning Reasoning Framework with DSPy, LiteLLM, and Pydantic

This comprehensive guide presents a detailed implementation of a self-questioning reasoning framework based on the arXiv paper 2502.05078v1, which emphasizes stream-of-consciousness thinking patterns. The implementation leverages DSPy for structured prompting and optimization, LiteLLM for language model integration, and Pydantic for robust data modeling. The resulting Jupyter notebook provides a flexible system that emulates human-like exploratory reasoning with complete traceability of thought processes.

Understanding the Building Blocks

DSPy: A New Paradigm for LLM Programming

DSPy represents a significant advancement in how developers interact with large language models. Unlike traditional prompting frameworks, DSPy introduces a declarative programming model that separates the specification of what a language model should do from how it accomplishes that task[2]. This separation allows developers to define high-le

A tutorial on fine-tuning DeepSeek R1 for medical applications and integrating DSPy for reinforcement learning.

This tutorial will be structured for AI/ML engineers and medical professionals, covering:

  • Introduction: Overview of DeepSeek R1 and DSPy in medical AI.
  • Features & Benefits: Key advantages of this approach.
  • Warnings & Considerations: Potential risks and limitations.
  • Installation & Setup: Environment configuration and dependencies.
  • Dataset Preparation: Selecting and formatting medical datasets.
  • Fine-tuning DeepSeek R1: Using LoRA with Unsloth for efficient training.
from manim import *
import numpy as np
class DualRingHeatTransferAnimation(Scene):
def construct(self):
# Configuration
num_blocks = 20
num_around = 39
block_size = 0.4
outer_radius = 3.3
import geopandas as gpd
import matplotlib.pyplot as plt
import pandas as pd
import matplotlib.colors as mcolors
from shapely.geometry import Polygon, MultiPolygon
import shapely.ops
import os.path
def get_text_color(fill_color):
@ruvnet
ruvnet / notebook.ipynb
Last active March 3, 2026 22:10
5cdbbd43ab3a0c728fdd3e7a2a8aedd9
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

File Summarization API

This FastAPI application provides an API endpoint for uploading files and generating summaries using LlamaIndex. It supports a wide variety of file types including documents, images, audio, and video files.

Features

  • File upload endpoint
  • Automatic file type detection
  • Document summarization using LlamaIndex
  • Support for multiple file types (PDF, Word, PowerPoint, images, audio, video, etc.)