Skip to content

Instantly share code, notes, and snippets.

@j4rs
j4rs / hardening-autonomous-coding-agents.md
Created October 18, 2026 17:45
Hardening a host for autonomous coding agents

Hardening a host for autonomous coding agents

A runbook from moving an unattended coding-agent setup (an orchestrator that picks issues from a tracker and runs a coding agent on each, opening PRs) from "agents run as a user on a VM" to "each agent works in its own disposable dev machine and holds no secrets". It is written from a real migration of one VM: an orchestrator (Symphony-style), the Codex CLI as the agent, a Rails + React monorepo, GitHub, and a Linear tracker. The names are ours; the shape applies to any agent that runs shell commands.

Everything below was done in small, reviewed steps, each one tried on a throwaway workspace before it went live, and each change to a trust boundary got an adversarial review and a re-review of its fixes. The order matters more than any single setting.

1. Threat model

Treat the agent as untrusted code that runs with whatever you give it. It reads issue text, PR comments, web pages and repo files, any of which can car

@nateberkopec
nateberkopec / gem_mfa_audit.rb
Created June 9, 2026 03:47
Audit Gemfile.lock gems for human MFA enforcement and Trusted Publishing
#!/usr/bin/env ruby
# frozen_string_literal: true
require "bundler"
require "cgi"
require "json"
require "net/http"
require "optparse"
require "thread"
require "uri"
@jjb
jjb / file.md
Last active September 10, 2026 18:28
Using Jemalloc 5 with Ruby.md

For years, people have been using jemalloc with ruby. There were various benchmarks and discussions. Legend had it that Jemalloc 5 didn't work as well as Jemalloc 3.

Then, one day, hope appeared on the horizon. @wjordan offered a config for Jemalloc 5.

Ubuntu/Debian

FROM ruby:3.1.2-bullseye
RUN apt-get update ; \
@DmitryTsepelev
DmitryTsepelev / change_column_type.rb
Created August 27, 2020 08:46
How to change column type (e.g., int -> bigint) without downtime
ActiveRecord::Migration.remove_foreign_key(:current_table, :foreign_table) # no lock
ActiveRecord::Migration.add_column(:current_table, :column_bigint, :bigint) # no lock
copy_data = lambda do
CurrentTable.where(column_bigint: nil).where.not(column: nil).in_batches do |batch|
batch.update_all("column_bigint = column")
end
end
@zwolf
zwolf / pre-commit
Last active December 15, 2016 10:27
A pre-commit hook for git to alert if ":focus" (or similar) is found in a + line of a diff
#!/usr/bin/env ruby
if `git diff HEAD spec` =~ /^\+.*,\s?(:focus|focus:\s?true|:focus\s?=>\s?true)/
puts "\e[31mPlease focus and remove your :focus tags before committing :)"
exit 1
end
@parrish
parrish / pg_locks.sql
Created June 30, 2016 14:33
Show info on postgres locks
SELECT bl.pid AS blocked_pid,
a.usename AS blocked_user,
ka.query AS current_statement_in_blocking_process,
now() - ka.query_start AS blocking_duration,
kl.pid AS blocking_pid,
ka.usename AS blocking_user,
a.query AS blocked_statement,
now() - a.query_start AS blocked_duration
FROM pg_catalog.pg_locks bl
JOIN pg_catalog.pg_stat_activity a ON a.pid = bl.pid
@parrish
parrish / pre-commit
Last active August 29, 2015 14:03
Git whitespace pre-commit hook
#!/bin/sh
# http://stackoverflow.com/a/6262715
# .git/hooks/pre-commit
# chmod +x .git/hooks/pre-commit
# A git hook script to find and fix trailing whitespace
# in your commits. Bypass it with the --no-verify option
# to git-commit
#