Skip to content

Instantly share code, notes, and snippets.

@camallen
camallen / payaus-move-to-mise.md
Last active October 22, 2026 07:12
payaus: move from rbenv/nvm to mise

Already set up with rbenv / nvm? Move to mise

bin/setup in payaus is idempotent and does the whole install side (Homebrew, Xcode CLT, Brewfile, mise, Ruby, Node, Yarn). The only thing it won't do is rip rbenv and nvm out of your shell. Both of those prepend shims to PATH after .zshrc runs, so if they stay, which ruby / which node keeps resolving to rbenv / nvm even with mise activated. Corepack shims in nvm's node bin dir shadow mise's yarn too. So: unwind first, then run bin/setup.

1. Remove the old version managers from your shell

Open ~/.zshrc and delete any lines like:

export PATH="$HOME/.rbenv/bin:$PATH"
@camallen
camallen / emudhra_mac_check.sh
Last active October 21, 2026 04:06
Check and fix your macOS ruby for the eMudhra CA compromise
#!/usr/bin/env bash
# emudhra_mac_check.sh - does the Ruby in this shell still trust the roots behind the
# leaked eMudhra intermediates (https://emudhra.we-have-a-problem.com/)?
#
# ./emudhra_mac_check.sh test the Ruby on your PATH
# ./emudhra_mac_check.sh --fix also add SSL_CERT_FILE to ~/.zshrc and re-test
#
# Why: mise/rbenv/asdf Rubies on macOS read Apple's /etc/ssl/cert.pem, which still has
# the bad roots. Homebrew's ca-certificates bundle has had them removed. Pointing
# OpenSSL at the brew bundle via SSL_CERT_FILE is the fix until Apple ships an update.
@camallen
camallen / gem_mfa_audit.rb
Created June 10, 2026 04:30 — forked from nateberkopec/gem_mfa_audit.rb
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"
@camallen
camallen / file.md
Created February 5, 2026 04:31 — forked from jjb/file.md
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 ; \
@camallen
camallen / config_boot.rb
Created July 13, 2025 22:50 — forked from moofkit/config_application.rb
Rails track boot time
# config/boot.rb
# frozen_string_literal: true
# Measure boot time
require_relative "../lib/boot_time"
BootTime.instance.store_start_timestamp
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
require "bundler/setup" # Set up gems listed in the Gemfile.
@camallen
camallen / edit-s3-remote-file.sh
Created February 20, 2025 06:29
Edit S3 remote file and upload
#!/usr/bin/env bash
SUM=$(which sha512sum || which sha || which md5sum || which md5 || true)
# modify the following to match the s3 setup you desire
path="s3://bucket_name/path/$1"
tempfile=$(mktemp ~/.tmpXXXXXX)
trap "rm -f $tempfile" INT TERM HUP EXIT
You are an expert in Ruby on Rails, Sorbet, PostgreSQL, Hotwire (Turbo and Stimulus) and Tailwind CSS.
Code Style and Structure
- Write concise, idiomatic Ruby code with accurate examples.
- Follow Rails conventions and best practices.
- Use object-oriented and functional programming patterns as appropriate.
- Prefer iteration and modularization over code duplication.
- Use descriptive variable and method names (e.g., user_signed_in?, calculate_total).
- Structure files according to Rails conventions (MVC, concerns, helpers, etc.).
@camallen
camallen / docker_run_cmd_as_root_user.sh
Last active August 9, 2024 04:45
How to run a cmd in docker as a different or root user
# docker
docker exec -it -u0 containerid bash
# compose
docker compose run --rm -u0 serviceid bash
@camallen
camallen / ebmp_known_bird_taxa.json
Last active July 29, 2022 09:34
Allowed birds in ebmp system
[
{ "common_name": "blue tit", "genus": "cyanistes", "species": "caeruleus", "bto_species_code": "bluti" },
{ "common_name": "great tit", "genus": "parus", "species": "major", "bto_species_code": "greti" },
{ "common_name": "coal tit", "genus": "periparus", "species": "ater", "bto_species_code": "coati" },
{ "common_name": "marsh tit", "genus": "poecile", "species": "palustris", "bto_species_code": "marti" },
{ "common_name": "nuthatch", "genus": "sitta", "species": "europaeus", "bto_species_code": "nutha" },
{ "common_name": "great spotted woodpecker", "genus": "dendrocopos", "species": "major", "bto_species_code": "grswo" },
{ "common_name": "goldcrest", "genus": "regulus", "species": "regulus", "bto_species_code": "goldc" },
{ "common_name": "goldfinch", "genus": "carduelis", "species": "carduelis", "bto_species_code": "goldf" },
{ "common_name": "blackbird", "genus": "turdus", "species": "merula", "bto_species_code": "blabi" },
@camallen
camallen / Dockerfile
Last active May 25, 2021 16:50
rails app multi stage docker builds
# Start from a small, trusted base image with the version pinned down
FROM ruby:2.5-slim-stretch AS base
# Install system dependencies required both at runtime and build time
# The image uses Postgres but you can swap it with mariadb-dev (for MySQL) or sqlite-dev
RUN apt-get update && \
apt-get install --no-install-recommends -y \
build-essential \
# git is required for installing gems from git repos
git \