Skip to content

Instantly share code, notes, and snippets.

View jtbr's full-sized avatar

Justin Briggs jtbr

View GitHub Profile
@jtbr
jtbr / balance.md
Last active June 16, 2026 10:58
Bank Balance Viewer

Bank Balance Viewer

A self-contained, offline tool for tracking account balances across banks and currencies

What it does

Bank Balance Viewer reads CSV exports from your bank accounts and plots your balances over time, across multiple accounts and currencies. You can view accounts individually or summed together. Exchange rates are fetched automatically from the European Central Bank so balances in different currencies can be compared on a single chart.

Everything runs locally in your browser. No data is uploaded or shared with any server.

@jtbr
jtbr / is_writable.py
Created February 26, 2026 00:06
Find whether you can write to a path without actually doing so (in python)
import os
from pathlib import Path
def is_writable(path: Path) -> tuple[bool,str]:
"""Determines if path is writeable without actually writing to it.
Return True if the process can write to path, and False otherwise, along with a useful error message."""
if path.exists():
if not os.access(path, os.W_OK):
return False, f"Cannot write to {path}: permission denied"
else:
@jtbr
jtbr / cors-proxy.js
Last active April 23, 2026 13:11
CORS proxy for local use, akin to corsproxy.io
'use strict';
const { log } = require('console');
// CORS proxy intended for local use to call 3rd-party APIs;
// redirects requests to the target URL to avoid CORS issues with strict origin.
//
// To run: `node cors-proxy.js`
// Then request http://localhost:8888/?q=https://example.com/api to proxy a request to example.com/api
//
// "localhost" and "8888" can be configured with environment variables HOST and PORT.
// The target URL can also be passed with encodeURIComponent(url) as the q parameter.
@jtbr
jtbr / claude-code-statusline-guide.md
Last active June 15, 2026 17:38 — forked from patyearone/claude-code-statusline-guide.md
Claude Code Status Line: Usage Limits, Pacing Targets, and Context Window - Complete guide with all the gotchas

Claude Code Status Line: Usage Limits, Pacing Targets, and Context Window

A complete Claude Code status line that shows your 5-hour and weekly usage limits with color-coded progress bars, pacing markers, reset times, and context window usage.

What you get (but in color):

yearone-3 main* │ $3.45/Opus 4.6 │ ctx ▓▓░░░░░░ 24% │ 5hr➞17:23 ▓▓▓│░░░░ 45% │ wk➞Thu:5p ▓▓░│░░░░ 14%
@jtbr
jtbr / exe_dir.h
Created June 1, 2018 11:22
Find the path to (directory containing) the currently running executable (cross-platform C++ function)
#ifndef __EXE_DIR_H__
#define __EXE_DIR_H__
#include <string>
#include <boost/predef/os.h>
#if (BOOST_OS_WINDOWS)
# include <stdlib.h>
#elif (BOOST_OS_SOLARIS)
# include <stdlib.h>
@jtbr
jtbr / endianness.h
Last active October 14, 2025 08:31
cross-platform / cross-compiler standalone endianness conversion
/**
* @file endianness.h
* @brief Convert Endianness of shorts, longs, long longs, regardless of architecture/OS
*
* Defines (without pulling in platform-specific network include headers):
* bswap16, bswap32, bswap64, ntoh16, hton16, ntoh32 hton32, ntoh64, hton64
*
* Should support linux / macos / solaris / windows.
* Supports GCC (on any platform, including embedded), MSVC2015, and clang,
* and should support intel, solaris, and ibm compilers as well.