Skip to content

Instantly share code, notes, and snippets.

@kerray
kerray / fetch-usage.ps1
Last active April 23, 2026 10:44
Claude Code statusline for Windows/PowerShell - shows model, folder, git branch, API usage limits, and context window. Adapted from https://gist.github.com/kerray/a65a95a0d4931e19bf83cf19ab040e64
# fetch-usage.ps1
# Fetches Claude API usage stats and writes them to a cache file.
# Line 1: five_hour.utilization (integer %)
# Line 2: seven_day.utilization (integer %)
# Line 3: five_hour.resets_at (raw ISO string)
# Line 4: seven_day.resets_at (raw ISO string)
#
# Windows PowerShell version.
# Based on: https://gist.github.com/kerray/a65a95a0d4931e19bf83cf19ab040e64
# Original bash version by kerray, inspired by:
@kerray
kerray / README.md
Last active April 14, 2026 13:56
Claude Code statusline — model, git branch, API usage (5h/7d), context window. Cross-platform (macOS + Linux). Based on https://www.reddit.com/r/ClaudeCode/comments/1rg3nmt/

Claude Code Statusline

Minimal two-line statusline for Claude Code showing model, project, git branch, API usage, and context window.

Claude Opus 4.6 | my-project • main
5h 16% (2h 43m) • 7d 20% (6d 9h) | ctx 12% (11k/200k)

Based on this Reddit post by u/xleddyl — adapted to work cross-platform (macOS + Linux/WSL).

@kerray
kerray / Signatures.Microsoft.Xrm.Data.PowerShell.psm1
Created July 26, 2024 09:07
Microsoft.Xrm.Data.PowerShell method signatures
# Microsoft.Xrm.Data.PowerShell.psm1 method signatures for better generated code
function Connect-CrmOnlineDiscovery{
[CmdletBinding()]
PARAM(
[parameter(Mandatory=$false)]
[PSCredential]$Credential,
[Parameter(Mandatory=$false)]
[switch]$InteractiveMode
)
@kerray
kerray / subtitles.ps1
Last active April 9, 2023 19:35
Script that copies and renames subtitle files from the 'Subs' folder to the folder containing the media file
<#
This script copies and renames subtitle files from the 'Subs' folder to the folder containing the media files.
It works recursively through all child folders.
The user can configure the languages, video formats, and subtitle formats to process.
Larger subtitle files are prioritized when multiple files are found for the same language.
#>
# Configuration
$languageMap = @{
"English" = "en"
@kerray
kerray / vimeo-downloader.js
Created October 13, 2021 18:28 — forked from alexdrean/vimeo-downloader.js
Download video from Vimeo (chopped m4s files)
// 1. Open the browser developper console on the network tab
// 2. Start the video
// 3. In the dev tab, locate the load of the "master.json" file, copy its full URL
// 4. Run: node vimeo-downloader.js "<URL>"
// (done automatically now) 5. Combine the m4v and m4a files with mkvmerge
const fs = require('fs');
const url = require('url');
const https = require('https');
const { exec } = require('child_process');