Skip to content

Instantly share code, notes, and snippets.

View pmatos's full-sized avatar

Paulo Matos pmatos

View GitHub Profile
@pmatos
pmatos / claude-usage.sh
Created February 11, 2026 09:23
Waybar custom module: Claude Code session and weekly API usage
#!/bin/bash
TOKEN=$(jq -r '.claudeAiOauth.accessToken' ~/.claude/.credentials.json 2>/dev/null)
if [ -z "$TOKEN" ] || [ "$TOKEN" = "null" ]; then
echo '{"text": "CC: --", "tooltip": "Claude Code: no credentials", "class": "claude-error"}'
exit 0
fi
USAGE=$(curl -sf \
-H "Accept: application/json" \
-H "Authorization: Bearer $TOKEN" \
@pmatos
pmatos / demo.c
Created February 13, 2026 13:47
Demo C program with subtle bugs for ESBMC Claude Code plugin verification
#include <stdlib.h>
// Bug 1: off-by-one in the loop bound — writes past the end of buf[]
// Bug 2: missing NULL check after malloc — dereferences a potentially NULL pointer
int main() {
int buf[10];
for (int i = 0; i <= 10; i++)
buf[i] = i * 2;
@pmatos
pmatos / patch-claude-worktree.sh
Created February 23, 2026 13:08
Patch issue with worktrees
#!/usr/bin/env bash
set -euo pipefail
EXPECTED_SHA="74042739197c58a4791c1f67414c0d8956639ec2f2e935280872b83d4317be78"
PATCHED_SHA="f098915988a2ac5a5747334147e4893bbca94eacd02bb36ee4c0e7d8f6df1c74"
TARGET="${1:-$(readlink -f "$(which claude)")}"
if [[ ! -f "$TARGET" ]]; then
echo "Error: file not found: $TARGET" >&2
exit 1
@pmatos
pmatos / patch-claude-worktree-arm64.sh
Created February 23, 2026 13:18
ARM64 patch to enable worktrees in cc 2.1.50
#!/usr/bin/env bash
set -euo pipefail
EXPECTED_SHA="4e2b23dbf2f97918d5edc95ae1de03d230a66b94d5fa31a57cc673742ec6ae22"
PATCHED_SHA="fcf070c6e28f5649578f5359b4d3d9dce27eaf6768bb3e0300072f0b13b11169"
TARGET="${1:-$(readlink -f "$(which claude)")}"
if [[ ! -f "$TARGET" ]]; then
echo "Error: file not found: $TARGET" >&2
exit 1