Skip to content

Instantly share code, notes, and snippets.

@waschmittel
waschmittel / secure-enclave-ssh-setup.mjs
Last active October 3, 2026 04:53
script to setup git/ssh auth and git signing based on https://gist.github.com/arianvp/5f59f1783e3eaf1a2d4cd8e952bb4acf -- git-ssh (push/pull/...) needs fingerprint, commit-signing does not, but both keys are in the secure enclave. Requires zx --> https://google.github.io/zx/setup
#!/usr/bin/env zx
//
// resolveIdentity() falls back from exact-label match to "the sole identity
// with this touch policy" so a key created by hand before this script existed
// gets adopted rather than duplicated; ambiguous cases die rather than guess.
// --cleanup deletes by resolved identity one at a time, never via
// `sc_auth delete-all-ctk-identities`, so unrelated FileVault/PIV/login
// smartcard identities are never touched.
import os from 'node:os';
@richardbasile
richardbasile / uncommittedTxns.sql
Created May 24, 2019 12:40
Find uncommitted transactions in PostgreSQL
select *
from pg_stat_activity
where (state = 'idle in transaction')
and xact_start is not null ;
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active October 2, 2026 07:01
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@rgreenjr
rgreenjr / Git Cheat Sheet.md
Last active July 1, 2025 23:27
Git Cheat Sheet

Git Cheat Sheet

Common Commands

# stage all modified files being tracked
git add -u