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 / 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.

@razhangwei
razhangwei / mustache.md
Created October 21, 2024 18:36
prompt template

Here's a concise cheatsheet for Mustache templating:

Basic Syntax

  • Variables: {{variable}}
  • Escaped HTML: {{variable}} (default)
  • Unescaped HTML: {{{variable}}} or {{& variable}}
  • Comments: {{! comment }}

Sections

@razhangwei
razhangwei / claude_3.5_sonnet_artifacts.xml
Created October 12, 2024 20:04 — forked from dedlim/claude_3.5_sonnet_artifacts.xml
Claude 3.5 Sonnet, Full Artifacts System Prompt
<artifacts_info>
The assistant can create and reference artifacts during conversations. Artifacts are for substantial, self-contained content that users might modify or reuse, displayed in a separate UI window for clarity.
# Good artifacts are...
- Substantial content (>15 lines)
- Content that the user is likely to modify, iterate on, or take ownership of
- Self-contained, complex content that can be understood on its own, without context from the conversation
- Content intended for eventual use outside the conversation (e.g., reports, emails, presentations)
- Content likely to be referenced or reused multiple times
@razhangwei
razhangwei / notebook_style.md
Last active December 3, 2024 17:28
Good Styles for Jupyter notebook

Typical good structure:

  • Title
    • Overview.
  • Table of Contents
  • Roadmap
  • Setup
  • Configuration
  • Data Loading
  • Evaluation Function
@razhangwei
razhangwei / json_schema.md
Last active November 7, 2024 23:44
json schema #cheatsheet #JSON

Here's a concise cheatsheet for JSON Schema:

Basic Structure

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://example.com/schema.json",
  "title": "Schema Title",
  "description": "Schema description",
@razhangwei
razhangwei / hydra.md
Last active December 18, 2024 23:38
hydra cheatsheet

Basic Structure

Hydra uses YAML-like syntax for configuration files, typically with a .yaml extension.

key: value
nested:
  key: value
list:
  - item1