Skip to content

Instantly share code, notes, and snippets.

View chefgs's full-sized avatar
💻
Building Products

Saravanan Gnanaguru chefgs

💻
Building Products
View GitHub Profile
@chefgs
chefgs / print-claude-code-token-usage.md
Last active October 6, 2026 08:56
Claude Code token usage: status line + per-request Stop hook (local scripts, zero model tokens)

Claude Code token usage: status line + per-request report

A personal setup that shows token usage in Claude Code without spending any model tokens. Both pieces are local shell scripts that read the session transcript.

  • statusline.sh is an always-visible status line: Sonnet 5.5 | ctx 146.5k | out 7.3k | calls 15 | $1.01
  • token-report.sh is a Stop hook that prints a one-line breakdown after each response: tokens this request: in 6 | out 1742 | cache-read 190957 | cache-write 88736 | api-calls 2 | context now ~140871

Install

@chefgs
chefgs / gist:724098b11ec55188c31da2fee04317db
Created July 14, 2026 05:29
claude-code-cheatsheet.md
# Claude Code — Quick Cheatsheet
> Commands ranked most → least useful as on Jul-14-2026. Run in the Claude Code terminal prompt.
---
## Built-in Slash Commands
### Tier 1 — Daily Drivers
@chefgs
chefgs / ansible_var_precedence.md
Last active June 26, 2019 12:57
Ansible variable precedence (order of priority) from least to greatest -

Ansible Var Precedence

Quite often, Ansible playbook developers finding it diffcult on, where to place the 'vars'. Because Ansible supports variable declaration at various levels.

Here is the order of precedence from least to greatest (the last listed variables winning prioritization):

  • command line values (eg “-u user”)
  • role defaults
  • inventory file or script group vars
  • inventory group_vars/all
  • playbook group_vars/all
@chefgs
chefgs / create_es_domain.py
Created February 7, 2019 12:01
Python Boto3 code for creating AWS Elastic Search Domain
# Script creates the 'n' number of ES doamins
# Arg 1: AWS account profile name
# Arg 2: No of es domain to be created
import boto3
import random
import sys
import json
# Fetch the account ID associated with the profile name passed as input arg