Skip to content

Instantly share code, notes, and snippets.

@Chrisb4
Chrisb4 / token_analysis.py
Created April 8, 2026 04:30 — forked from kieranklaassen/token_analysis.py
Claude Code token usage analyzer - breaks down usage by project, session, and subagent
#!/usr/bin/env python3
"""
Claude Code token usage analyzer.
Analyzes ~/.claude/projects/ JSONL files for token usage patterns.
"""
import json
import os
import sys
from pathlib import Path
@Chrisb4
Chrisb4 / remove-woo-scripts.php
Created May 21, 2020 03:27 — forked from jan-koch/remove-woo-scripts.php
Remove WooCommerce related resources except on WooCommerce-based pages (products, cart, checkout, etc). Use on a testing environment before pasting this into your live website!
/**
* This code snippet removes JavaScript and CSS files loaded from WooCommerce if they are not necessary.
*
* Please test this on a staging copy of your website before putting this into the functions.php of your live website.
*/
add_action( 'wp_enqueue_scripts', 'my_remove_woo_assets', 99 );
function my_remove_woo_assets() {
if ( function_exists( 'is_woocommerce' ) ) { // Check if Woo is installed.
if ( ! is_woocommerce() && ! is_cart() && ! is_checkout() ) { // Only run on non-Woo pages.
// Remove unnecessary stylesheets.
@Chrisb4
Chrisb4 / gist:2ba084e7e897d0686881895e99bbf680
Created March 20, 2019 23:05
Get window width on resize
const delay = 100; // Your delay here
const originalResize = evt => {
console.log(innerWidth); // Your resize function here
};
(() => {
resizeTaskId = null;
@Chrisb4
Chrisb4 / gist:5c07bf72cd9393357ef67a33a15d00c4
Created July 2, 2018 06:16 — forked from khakimov/gist:3558086
Matrix Effect in you terminal
echo -e "\e[1;40m" ; clear ; while :; do echo $LINES $COLUMNS $(( $RANDOM % $COLUMNS)) $(( $RANDOM % 72 )) ;sleep 0.05; done|awk '{ letters="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%^&*()"; c=$4; letter=substr(letters,c,1);a[$3]=0;for (x in a) {o=a[x];a[x]=a[x]+1; printf "\033[%s;%sH\033[2;32m%s",o,x,letter; printf "\033[%s;%sH\033[1;37m%s\033[0;0H",a[x],x,letter;if (a[x] >= $1) { a[x]=0; } }}'