Skip to content

Instantly share code, notes, and snippets.

View mostlyobvious's full-sized avatar

Paweł Pacana mostlyobvious

View GitHub Profile
@searls
searls / auto_commit.sh
Last active February 23, 2026 08:54
I got sick of trying to figure out the best time to commit code between me and Claude. I simultaneously found bugs in Claude's checkpoint and rewind system. So now I just auto-commit on every turn with the title being whatever claude just said and the body being whatever my prompt was. (I also often want to go back and replay my prompts when Cla…
#!/bin/bash
# Auto commits after each Claude turn if:
# - A STOP hook is configured that runs this script
# - A <repo_root>.claude/auto_commit.json file has key "enabled" set to `true`
set -euo pipefail
INPUT=$(cat)
# Find git root; bail if not a repo
GIT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null) || exit 0
"""
The most atomic way to train and run inference for a GPT in pure, dependency-free Python.
This file is the complete algorithm.
Everything else is just efficiency.
@karpathy
"""
import os # os.path.exists
import math # math.log, math.exp
@dvf
dvf / change-codec.md
Last active March 4, 2026 11:57
Enable High Quality mode on your headphones (Updated for macOS Catalina)

If you're using a high-end bluetooth headset on your Macbook Pro it's likely your mac is using an audio codec which favors battery efficiency over high quality. This results in a drastic degradation of sound, the SBC codec is the likely culprit, read more about it here.

Find out what codec you're using

  1. Play a song on your headphones
  2. Option (⌥) click the Bluetooth button at the top of your screen Inspect the Bluetooth Coded
  3. If you're using AAC or aptX, you can stop here—those are the highest quality codecs.

Change your codec to AAC or aptX

// Y Combinator
const Y = a => (b => b (b)) (b => a (c => b (b) (c)))
// isomorphic Church encoding/decoding
const Church = {
to: n => f => x => Array.from (Array (n)).reduce (f, x),
from: f => f (x => x + 1) (0)
}
const True = a => b => a
@thbar
thbar / _readme.md
Last active July 17, 2024 18:54
Using minitest to regression test your Jekyll static site

Using minitest to regression-test your Jekyll static site

I recently had to upgrade my blog, which involved changes such as:

  • Replacing a sitemap plugin
  • Upgrading from jekyll 2.5.3 to 3.8.4
  • Upgrading from jekyll-assets 0.7.8 to 3.0.11
  • (etc)

The upgrading process was not trivial, and some parts (e.g. RSS, sitemap, or twitter cards tags) are not immediately visible, so I decided to add unit tests on the generated content.

gem 'rails_event_store'
generate 'rails_event_store_active_record:migration'
rails_command 'db:migrate'
initializer 'rails_event_store.rb', <<-CODE
Rails.configuration.to_prepare do
Rails.configuration.event_store = RailsEventStore::Client.new
end
CODE
@mohanpedala
mohanpedala / bash_strict_mode.md
Last active March 9, 2026 07:55
set -e, -u, -o, -x pipefail explanation
@marcocitus
marcocitus / example.sql
Last active February 24, 2024 13:17
Safe incremental rollups on Postgres and Citus
-- Create the raw events table
CREATE TABLE page_views (
site_id int,
path text,
client_ip inet,
view_time timestamptz default now(),
view_id bigserial
);
-- Allow fast lookups of ranges of sequence IDs
@andrzejsliwa
andrzejsliwa / .mutant_ignored_subjects
Last active March 7, 2018 09:13
ugly proof of concept for Mutant rake task for Rails application with configuration files
Some#method
@lencioni
lencioni / AsyncComponent.jsx
Created January 8, 2017 17:09
<AsyncComponent> at Airbnb used for Webpack code splitting
// Usage:
//
// function loader() {
// return new Promise((resolve) => {
// if (process.env.LAZY_LOAD) {
// require.ensure([], (require) => {
// resolve(require('./SomeComponent').default);
// });
// }
// });