Skip to content

Instantly share code, notes, and snippets.

View ashwch's full-sized avatar
😎
Look at me!

Ashwini Chaudhary ashwch

😎
Look at me!
View GitHub Profile
@ashwch
ashwch / update_submodules.py
Last active August 7, 2025 21:28
Git Submodule Updater - Automates updating all submodules to their latest commits with branch configuration support
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.8"
# dependencies = [
# "click>=8.0",
# "rich>=13.0",
# ]
# ///
"""
@ashwch
ashwch / create_worktree.py
Last active August 7, 2025 21:28
Git Worktree Creator with Submodule Support - Automates creation of worktrees for monolith repositories
#!/usr/bin/env python3
# /// script
# requires-python = ">=3.8"
# dependencies = [
# "rich>=13.7.0",
# "questionary>=2.0.1",
# ]
# ///
"""
@ashwch
ashwch / git-worktrees-zero-to-hero.md
Last active August 8, 2025 17:07
Git Worktrees: From Zero to Hero - A comprehensive guide to using Git worktrees with submodules
@ashwch
ashwch / bruno_api_full_output.md
Created July 13, 2025 21:31
Complete output from /bruno-api command - comprehensive API documentation, TypeScript interfaces, React Query hooks, tests, and business logic notes

User Metrics API Documentation

Generated by /bruno-api bruno/analytics/user_metrics.bru

GET /api/v2/companies/{company_id}/user-metrics/

🔐 Authentication: JWT Bearer Token Required
👮 Permissions: IsAuthenticated + CompanyMember
🏢 Multi-tenant: Company-scoped data access
Rate Limit: 100 requests/minute per company

@ashwch
ashwch / user_metrics.bru
Last active July 13, 2025 21:24
Bruno API file example for User Metrics endpoint - demonstrates comprehensive .bru file structure with auth, tests, scripts, and documentation
meta {
name: User Metrics
type: http
seq: 1
}
get {
url: {{BASE_URL}}/api/v2/companies/{{COMPANY_ID}}/user-metrics/
body: none
auth: bearer
@ashwch
ashwch / validate_bruno_files.py
Last active July 13, 2025 19:23
Bruno environment file validator - Validate .bru files for correct format
#!/usr/bin/env python3
# /// script
# dependencies = []
# ///
"""
Bruno environment file validator.
Validates .bru files for correct Bruno API client format.
@ashwch
ashwch / auto_uv_env.sh
Created July 4, 2025 02:56
auto_uv_env shell function
command -v uv >/dev/null 2>&1 && {
auto_uv_env() {
# Early exit for performance - check if we're in a Python project
if [[ -f "pyproject.toml" ]]; then
local py_version=""
# Parse Python version requirement from common pyproject.toml patterns
# Supports: requires-python = ">=3.11", python_requires = ">=3.11.5", etc.
if grep -q "requires-python" pyproject.toml; then
py_version=$(grep "requires-python" pyproject.toml | sed -E 's/.*[">]=?([0-9]+\.[0-9]+(\.[0-9]+)?).*/\1/' | head -1)
@ashwch
ashwch / claude_alert.sh
Last active July 2, 2025 22:08
Claude Code notifications hook for macOS using jq
#!/bin/bash
# Claude Code notifications hook for macOS using jq
# Reads JSON from stdin, plays a sound, and displays macOS alert
#
# Environment variables:
# CLAUDE_ALERT_SOUND - Sound name (default: Glass)
# Options: Basso, Blow, Bottle, Frog, Funk, Glass,
# Hero, Morse, Ping, Pop, Purr, Sosumi,
# Submarine, Tink
@ashwch
ashwch / uv_pep_723_example.py
Created March 5, 2025 05:25
UV and PEP 723 example
# /// script
# requires-python = ">=3.11"
# dependencies = [
# "requests<3",
# "rich",
# ]
# ///
import time
import statistics
@ashwch
ashwch / airtable.py
Last active July 9, 2020 00:39
Airtable to CSV
# Download Airtable's API response retrieved from browser console as CSV
import csv
import sys
import json
file_path = sys.argv[1]
with open(file_path) as f_in, open("airtable.csv", "w") as f_out:
data = json.load(f_in)