Skip to content

Instantly share code, notes, and snippets.

View nateberkopec's full-sized avatar

Nate Berkopec nateberkopec

View GitHub Profile
@nateberkopec
nateberkopec / agent-rm-rf-hooks.md
Created January 22, 2026 02:55
Protecting Against Autonomous Agent rm -rf Commands

Protecting Against Autonomous Agent rm -rf Commands

This document explains an approach to protecting against AI coding agents (like Claude Code and Opencode) accidentally running destructive rm -rf commands, implemented in nateberkopec/dotfiles.

Background

AI coding agents have the ability to execute shell commands, including potentially destructive ones like rm -rf. This is a known risk that has been discussed in the community (original tweet).

The implementation evolved through two pull requests:

@nateberkopec
nateberkopec / README.md
Created January 21, 2026 20:34
Puma JSON logging demo - response to issue #3865

Puma JSON Logging Demo

This demo shows how to achieve JSON-formatted boot messages from Puma using existing configuration options. This is in response to GitHub Issue #3865.

Summary

Puma already supports custom log formatting via two DSL options:

  1. log_formatter - A block that transforms each log message string
@nateberkopec
nateberkopec / n_plus_one_where.rb
Created January 4, 2026 22:14
Rails N+1 query that cannot be fixed with includes() - using where() in instance method
# frozen_string_literal: true
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
gem "rails", "~> 8.0"
gem "sqlite3"
end
Senior Product Engineer
Job Type: Full-time
Kaysville, UT and Remote (United States Only)
Salary Range: 180-220K DOE
Who We Are:
At Bark we’re doing something special to make the digital world a safer place for
children. Our work isn't just another job; it's a chance to make a real impact on the lives
of children and families.
Imagine using cutting-edge machine-learning to empower parents to partner with their
kids, providing them with the tools and alerts they need to ensure their child's safety and
@nateberkopec
nateberkopec / gh-ai.fish
Last active October 7, 2025 09:09
Fish function to have AI write commit messages w/rerolling
function gc-ai
# Check required dependencies
if not command -q gum
echo "Error: gum is not installed. Install it from https://github.com/charmbracelet/gum"
return 1
end
if not command -q bat
echo "Error: bat is not installed. Install it from https://github.com/sharkdp/bat"
return 1
@nateberkopec
nateberkopec / gh_watch
Created August 6, 2025 22:37
Watch GitHub PR status with audio notifications
#!/bin/bash
set -e
if [ $# -eq 0 ]; then
echo "Usage: gh_watch <github-pr-url>"
echo "Example: gh_watch https://github.com/hyfn/xpo/pull/4974"
exit 1
fi
@nateberkopec
nateberkopec / yubikey-b-signatures.txt
Created July 5, 2025 05:20
Proof of ownership of two Yubikeys
pub rsa2048 2025-07-05 [SC] [expires: 2027-07-05]
3C3E54D4F0A2218E1C1AA1A2ED9299DFE432C3A1
uid [ultimate] Nate Berkopec (Yubikey B) <nate.berkopec@gmail.com>
sig 3 ED9299DFE432C3A1 2025-07-05 [self-signature]
sig 6BF45F815F702663 2025-07-05 Nathan Berkopec (5 NFC Master) <nate.berkopec@gmail.com>
sub rsa2048 2025-07-05 [A] [expires: 2027-07-05]
sig ED9299DFE432C3A1 2025-07-05 [self-signature]
sub rsa2048 2025-07-05 [E] [expires: 2027-07-05]
sig ED9299DFE432C3A1 2025-07-05 [self-signature]
@nateberkopec
nateberkopec / 0_roadmap.md
Last active July 17, 2025 03:57
Speedshop Retainer Roadmap + Changelog

Speedshop Retainer Roadmap

This is the roadmap for the Speedshop Ruby on Rails performance retainer service. It was last updated March 28th, 2025. Items are in rough priority order.

In-Progress:

  1. Alerting, dashboards, key metrics, and ticket backlogs for all: We want everyone to be on the same footing with SLOs for queues and tracking our core set of 20 metrics, plus your app's specific key metrics (see next bullet), along with a ticket backlog for stuff to work on.

Upcoming:

@nateberkopec
nateberkopec / changelog.md
Last active March 28, 2025 03:37
Speedshop Retainer Changelog

Speedshop Retainer Changelog

This is the changelog for the Speedshop Ruby on Rails performance retainer service. For what we're doing in the future, see the roadmap. This was last updated March 28th, 2025.

March 2025

  1. Office Hours. You can now sign up for regular office hours, 30 minutes every 2 weeks.
  2. Retainer Roadmap and Changelog. We're working on more services and extensions to the retainer service. You can keep up with stuff yet to come in the Roadmap, and stuff done already in the Changelog.
  3. Free Ongoing Education/Workshops. We started a book club for The Rails Performance Apocrypha.
/nix/store/9j0c1bk7rq7fkc7bcf4q25wk6rjm1z3d-gnumake-4.3/bin/make install target_prefix=
/nix/store/1qw1shw2a163h45rhr5pay488nbzfi6y-coreutils-9.0/bin/install -c -m 0755 puma_http11.so /host/nateberkopec/Documents/Code/upstream/puma/lib/puma
cp tmp/aarch64-linux/puma_http11/3.0.2/puma_http11.so tmp/aarch64-linux/stage/lib/puma/puma_http11.so
/host/nateberkopec/Documents/Code/upstream/puma/test/test_config.rb:70: warning: assigned but unused variable - bind_configuration
/host/nateberkopec/Documents/Code/upstream/puma/test/test_config.rb:71: warning: assigned but unused variable - app
ruby 3.0.2p107 (2021-07-07) [aarch64-linux]
RUBYOPT: -r/nix/store/6jdmjqw9m3n3n76z5dsig3d4anh091fm-ruby-3.0.2/lib/ruby/3.0.0/bundler/setup
Puma::MiniSSL OpenSSL
OPENSSL_LIBRARY_VERSION: OpenSSL 1.1.1l 24 Aug 2021 OpenSSL 1.1.1l 24 Aug 2021