Skip to content

Instantly share code, notes, and snippets.


Adam Lassek alassek

View GitHub Profile
emilyst / 0.docker-compose.yml
Last active November 19, 2022 19:58
Current docker-compose.yml for my Mastodon instance, and associated files. CUSTOMIZE FOR YOUR PURPOSES. PROVIDED AS-IS. This is just a (probably dated) version of what I happen to use, and it's jank as hell.
View 0.docker-compose.yml
version: "3"
image: postgres:15
container_name: mastodon-postgres
restart: unless-stopped
- internal
numToStr / au.lua
Last active February 1, 2023 10:15
Neovim autocmd in lua
View au.lua
-- Move this file to your neovim lua runtime path ie. ~/.config/nvim/lua/au.lua
local cmd = vim.api.nvim_command
local function autocmd(this, event, spec)
local is_table = type(spec) == 'table'
local pattern = is_table and spec[1] or '*'
local action = is_table and spec[2] or spec
if type(action) == 'function' then
jthodge / universal-switcher
Created September 6, 2020 22:07
Show macOS app switcher across all monitors
View universal-switcher
defaults write appswitcher-all-displays -bool true
killall Dock
paul / async.rb
Created December 25, 2018 04:05
Implementations of useful step adapters for dry-transaction
View async.rb
# frozen_string_literal: true
module Tesseract
module Transaction
module Steps
# Executes the step in a background job. Argument is either an ActiveJob
# or another Transaction (or anything that implements `#perform_later`.
# If the provided transaction implements a `validate` step, then that
# validator will be called on the input before the job is enqueued. This
View rails_single_file.rb
require "bundler/inline"
rescue LoadError => e
$stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
raise e
gemfile(true) do
source ""
nuxlli / rails_postgres_enum.rb
Last active July 30, 2020 15:48 — forked from fizz/rails_postgres_enum.rb
Support for PostgreSQL enum types in Rails 5 (including schema dump)
View rails_postgres_enum.rb
module ActiveRecord
class SchemaDumper
def dump(stream)
mgoodness /
Last active October 30, 2021 17:04
Helm RBAC setup for K8s v1.6+ (tested on minikube)
kubectl -n kube-system create sa tiller
kubectl create clusterrolebinding tiller --clusterrole cluster-admin --serviceaccount=kube-system:tiller
helm init --service-account tiller
jmhobbs /
Last active December 13, 2022 17:01
Create scrolling text gifs for Slack

Makes little scrolly text jiffs in Flywheel colors.


  • imagemagick brew install imagemagick
  • gifsicle brew install gifsicle
  • Heartwell 1.2.otf font installed
  • u r on a mac



The Myers diff algorithm

The following based on Myers' original paper.

The edit graph

To use the example from the paper, say you want to calculate the difference between two strings:

View discriminable_model.rb
# Wouldn't it be great if you could have STI like functionality
# without needing to encode strings of class names in the database?
# Well today is your lucky day! Discriminable Model is here to help.
# Simply specify your models desired type column, and provide a block to
# do the discrimination. If you want the whole STI-esque shebang of properly
# typed finder methods you can supply an array of 'discriminate_types' that will
# be used to apply an appropriate type.
# class MyModel < ActiveRecord::Base