Skip to content

Instantly share code, notes, and snippets.

View calebpower's full-sized avatar

C. Power calebpower

View GitHub Profile
@calebpower
calebpower / claude_usage.sh
Created September 20, 2026 17:38
Claude Usage Oracle
#!/usr/local/bin/bash
TOKEN=$(jq -r '.claudeAiOauth.accessToken' ~/.claude/.credentials.json)
curl -s https://api.anthropic.com/api/oauth/usage \
-H "Authorization: Bearer $TOKEN" -H "anthropic-beta: oauth-2025-04-20" \
| jq -rc '.limits[] | select(.kind != "session") | {model: .scope.model.display_name // "all", percent: .percent, resets_at: .resets_at}'
@calebpower
calebpower / mkbase.sh
Created August 9, 2026 00:33
FreeBSD PKGBASE World Builder + Publisher
#!/bin/sh
# =============================================================================
# mkbase.sh — FreeBSD base (pkgbase) build/publish/sign pipeline
# =============================================================================
# Copyright (c) [year], [fullname]
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
@calebpower
calebpower / sample_files.py
Created June 23, 2026 05:02
file sampler
#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.8"
# dependencies = []
# ///
"""
Scan a directory (non-recursively) for text files. For each text file, print
its full path followed by either all of its lines (when the file has <= MAX
lines) or a random, in-order sample of MAX lines (when it has more).
"""
@calebpower
calebpower / .emacs
Last active June 23, 2026 05:01
.emacs config
;;; .emacs --- init -*- lexical-binding: t; -*-
;; ---------------------------------------------------------------------------
;; UI
;; ---------------------------------------------------------------------------
(scroll-bar-mode -1)
(tool-bar-mode -1)
(tooltip-mode -1)
(menu-bar-mode -1)
(set-fringe-mode 10)
@calebpower
calebpower / .gitignore
Created August 8, 2025 03:07
gitignore for Dagster projects
### Emacs ###
# -*- mode: gitignore; -*-
*~
\#*\#
/.emacs.desktop
/.emacs.desktop.lock
*.elc
auto-save-list
tramp
.\#*
@calebpower
calebpower / port_tags_dir2git.sh
Created January 4, 2025 21:01
Port tags arranged in SVN directories to annotated tags in GIT
#!/usr/local/bin/bash
# Prerequisites:
# 1. Clone two instances of the same repo into primary_repo and backup_repo
# 2. On primary_repo, rebase where necessary (or git filter-repo)
if [ "$#" -ne 2 ]; then
printf 'Usage: %s <primary_repo> <tags_path>\n' "$0"
printf 'Example: %s /freshports/primary_repo /freshports/backup_repo/path/to/tags\n' "$0"
exit 1
@calebpower
calebpower / port_tags_svn2git.sh
Last active December 23, 2024 00:50
Port SVN tags over to GIT
#!/usr/local/bin/bash
# Assumes you've already got a SVN server up and running.
# Also assumes that you've converted your commits over already.
if [ "$#" -ne 3 ]; then
printf 'Usage: %s <svn_url> <svn_repo> <git_dir>\n' "$0"
printf 'Example: %s svn://127.0.0.1/freshports-1 periodics /freshports/periodics\n' "$0"
exit 1
fi
@calebpower
calebpower / getsup.sh
Created December 15, 2024 05:02
Parse FreeBSD Supported Releases
#!/usr/local/bin/bash
# Ports needed:
# - ftp/curl
# - shells/bash
# - textproc/htmlq
# - textproc/jq
SUP_HTML=https://www.freebsd.org/security/#sup
@calebpower
calebpower / osmoval-kicker.sh
Last active January 20, 2022 17:40
A quick script that kicks a validator back online by reconnecting it to its peers after i.e. an epoch or some other event that make sentries stall out for an extended period of time.
#!/bin/bash
# Overview
# ========
#
# This is a hack-and-slash script to re-peer the validator without rebooting it
# once sentries come back online. The following assumptions are made:
#
# - This script is used in conjunction with the validator.
# - The validator has PEX disabled and is peering only with sentries.
### Keybase proof
I hereby claim:
* I am calebpower on github.
* I am calebpower (https://keybase.io/calebpower) on keybase.
* I have a public key ASCBywwyf9HB6pW-YG6ZDgClghb4fBrVp3jBWBPk7pgluQo
To claim this, I am signing this object: