Skip to content

Instantly share code, notes, and snippets.

View razhangwei's full-sized avatar

Wei Zhang razhangwei

  • Facebook
  • Bay Area
View GitHub Profile
@razhangwei
razhangwei / uv.md
Last active March 17, 2025 05:16
#python UV

Key Features

  • 10-20x faster than pip
  • Written in Rust for high performance
  • Single static binary (no Python dependency)
  • Compatible with pip command interface
  • Can replace pip, pip-tools, and virtualenv
  • Efficient dependency resolution

UV Python Package Manager Cheatsheet

@razhangwei
razhangwei / cuda.md
Created February 26, 2025 05:59
#CUDA cheatsheet

CUDA Cheatsheet for DeepGEMM

CUDA Fundamentals

Term Description
SM (Streaming Multiprocessor) Computational unit in NVIDIA GPUs; Hopper has up to 132 SMs
Warp Group of 32 threads that execute in lockstep
Thread Block Group of threads that execute on the same SM and can synchronize
Grid Collection of thread blocks that execute the same kernel
@razhangwei
razhangwei / code-server.md
Created February 17, 2025 23:47
#OMV #vscode code-server
  1. Create Dockerfile via UI and build.
FROM codercom/code-server:latest

USER root

# Install system dependencies
RUN apt-get update && apt-get install -y \
    python3-pip \
    python3-venv \
@razhangwei
razhangwei / LangGraph.md
Created February 10, 2025 03:16
LangGraph cheatsheet

This is an excellent LangGraph cheat sheet! It provides a comprehensive and practical overview of LangGraph's key features and usage. Here's a slightly refined version with added clarity and formatting for better readability:


LangGraph Cheat Sheet

1. Import Necessary Modules

from typing import TypedDict, Dict, Any, Callable
from langchain_core.runnables import Runnable
@razhangwei
razhangwei / How to read TS package.md
Last active August 6, 2025 12:57
TypeScript Cheatsheet
File / Folder Purpose
src/ Source TypeScript code (.ts, .tsx)
dist/ or lib/ Compiled output (.js, .d.ts)
index.ts, main.ts Package entry point or main logic file
package.json Project metadata, scripts, dependencies
package-lock.json Dependency version lock file (auto-generated by npm)
tsconfig.json TypeScript compiler configuration (target, paths, output, etc.)
vitest.config.ts Vitest test runner configuration
test-setup.ts Global
@razhangwei
razhangwei / llm_libraries.md
Created February 2, 2025 21:36
Popular Libraries for LLM/GenAI
  • pydantic
  • langgrah

Instructions for Aider and other LLM tools: Keep it simple!

  1. Embrace Simplicity Over Cleverness
  • Write code that's immediately understandable to others
  • If a solution feels complex, it probably needs simplification
  • Optimize for readability first, performance second unless proven otherwise
  • Avoid premature optimization
@razhangwei
razhangwei / rq-vae.py
Last active January 30, 2025 19:47
RQ-VAE pseudo code
from typing import List, Dict, Tuple
import torch
import torch.nn as nn
import torch.nn.functional as F
class RQVAE:
def __init__(self,
input_dim: int, # Shape: scalar (e.g., 768 for BERT embeddings)
hidden_dims: List[int], # Shape: [dim1, dim2, ..., latent_dim]
num_codebooks: int, # Shape: scalar (e.g., 3 for 3-level quantization)
@razhangwei
razhangwei / caddyfile.md
Created January 21, 2025 05:02
Caddy config cheatsheet

Caddy Configuration Cheat Sheet

Basic Site Configuration

# Simple static site
example.com {
    root * /var/www/html
    file_server
}
@razhangwei
razhangwei / omv_usb.md
Last active December 15, 2024 23:47
#OMV USB Backup
  • the external hardware needs to be EXT4.

  • relative path: usually the same as the shared forder so that it's identifiable.

  • extra options:

    • --update
    • --exclude dir1 --exclude dir2
  • View Logs: Check Diagnostics -> System Logs -> Logs -> Rsync - Jobs to see backup details.

  • Manual Backup: Select a job in the grid panel and click "Run" to start a backup manually.

  • Email Notifications: Configure email settings to receive backup status updates.

  • Mounting After Backup: To check files after backup, manually mount the drive without triggering another backup.