20adfed935dd4f4ee9a9ce37575862d9220deb9b
Tooling
A collection of useful command-line tools.
OCR Screenshot Tool
A CLI tool that takes region screenshots on macOS, performs OCR using Tesseract, and copies the result to clipboard.
Prerequisites
- macOS (uses built-in
screencapturecommand) - Tesseract OCR (install with
brew install tesseract)
Usage
Basic usage (takes screenshot, performs OCR, copies to clipboard):
uv run ocr-screenshot
With verbose output:
uv run ocr-screenshot --verbose
Save the screenshot image:
uv run ocr-screenshot --save-image
Specify OCR language (e.g., for Chinese):
uv run ocr-screenshot --lang chi_sim
How it works
- Screenshot: Click and drag to select a region, or press Space to capture an entire window
- OCR: The selected region is processed with Tesseract OCR
- Clipboard: The extracted text is automatically copied to your clipboard
Development Guide
How to Add New Packages
To add a new production dependency (e.g., 'requests'):
uv add requests
To add a new development dependency (e.g., 'ipdb'):
uv add --dev ipdb
After adding dependencies, always re-generate requirements.txt:
uv pip compile pyproject.toml -o requirements.txt
How to Build Packages
To build your project's distributable packages (.whl, .tar.gz):
python -m build
Or using the virtual environment directly:
./venv/bin/python -m build
Offline Build
To build offline packages for deployment:
./dev_scripts/build_offline.sh
This will create offline_packages/ with all dependencies and install.sh
Description
Languages
Python
99.4%
Shell
0.6%