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 / clean_up.sh
Created April 8, 2025 03:32
Clean up common coding related cache (uv, huggingface, npm, homebrew)
#!/bin/bash
# === Cache Cleanup Script ===
# Cleans caches for Homebrew, UV, Hugging Face, and NPM
# Usage: bash cleanup.sh [options]
# Options:
# -a, --all Clean all caches
# -b, --brew Clean Homebrew cache
# -u, --uv Clean UV cache
# -h, --huggingface Clean Hugging Face cache
@razhangwei
razhangwei / huggingface.md
Last active March 31, 2025 02:49
Transformer models published on Huggingface

How can I find the model implementation for a particular model?

  • Usually it's avaiable from transformers/models/xxxx, e.g., for qwen2_5_vl
@razhangwei
razhangwei / qwen2.5-vl.py
Last active March 31, 2025 00:29
qwen2.5-vl pseudo code #window attention
from typing import List, Tuple, Optional, Union, Callable
import numpy as np
# Define a Tensor type for clarity in this pseudocode
Tensor = np.ndarray # In real implementation, this would be a framework-specific tensor type
# Qwen2.5-VL Vision Encoder Pseudocode
class Qwen25VisionEncoder:
def __init__(self,
@razhangwei
razhangwei / website_cheatsheet.md
Last active March 10, 2025 03:15
Modern Personal Website Tech Stack Cheatsheet #nextjs #react #typescript #tailwindcss

Personal Website Tech Stack Cheatsheet

Core Technologies

Technology Version Purpose
Next.js 14.2.0 React framework with file-based routing, static site generation
React 18.2.0 UI library for component-based development
TypeScript 5.3.3 Static type-checking for JavaScript
TailwindCSS 3.4.1 Utility-first CSS framework
@razhangwei
razhangwei / walrus.md
Created March 5, 2025 17:41
#Python Walrus operator

The Walrus Operator in Python: A Comprehensive Guide

The walrus operator (:=) was introduced in Python 3.8 as part of PEP 572. It's officially called the "assignment expression" operator, but it earned its nickname because := resembles a walrus with tusks when viewed sideways. This operator allows you to assign values to variables as part of an expression, rather than as a separate statement.

Basic Syntax and Purpose

The syntax is:

variable := expression
@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 / ts.md
Created February 8, 2025 23:03
TypeScript Cheatsheet

TS (TypeScript) is a strongly-typed superset of JavaScript developed by Microsoft. It adds optional static typing, modern JavaScript features, and tooling to enhance code quality and maintainability. TypeScript compiles to plain JavaScript and is widely used for large-scale applications.


TypeScript Cheatsheet

1. Basic Types

let name: string = "John";
let age: number = 30;