Skip to content

Instantly share code, notes, and snippets.


First, compile the shim:

gcc -Wall -O2 -fpic -shared -ldl bind.c -o

Now, run the demo and notice that it does what it looks like it does:

$ LD_PRELOAD=./ ruby demo.rb
View 0.txt
Save this in [[roam/css]] as a toplevel block, wrapped in "```css" and "```"
View ru.nix
{ config, pkgs, lib, ... }:
{ = "shopify-pay";
rune.framework.rails.enable = true;
aspect.packages.include = with pkgs; [
geolite2 ngrok mysqlClient57 overmind watchman toxiproxy v8
rune.project.repoName = "pay";
View apfs_volume.rb
# typed: true
# frozen_string_literal: true
module Dev
module Helpers
class APFSVolume
View nix_store_safeguard.rb
# typed: false
# frozen_string_literal: true
# Note: This is loaded *ludicrously* early in the boot process: please don't
# introduce other dependencies here.
# ===
# Okay so here's the deal. When we compile a bundle of ruby code via
# `bundlerEnv`, we install all the gems individually into a bunch of separate
View ,
# usage example:
# $ , yarn --help
# This finds a derivation providing a bin/yarn, and runs it with `nix run`.
# If there are multiple candidates, the user chooses one using `fzy`.
set -euo pipefail
if [[ $# -lt 1 ]]; then
>&2 echo "usage: , <program> [arguments]"
burke /
Last active Jun 9, 2020
Code Release for NixCon 2019

The rest of these files are the code referenced in my NixCon 2019 talk which live in Shopify's non-public codebases. Everything in this gist is extracted with minimal or no change from our codebase, and thus some of it references libraries or other code not included here. cli-ui and cli-kit probably comprise a majority of these cases.

All code Copyright Shopify, 2019, released here under MIT License.

View ohno.rb
module Ohno
def self.replace_index(welp, index)
case welp
when String
welp == "$index" ? index : welp.gsub(/\$index/, index.to_s)


Replacing a space with a newline doesn't obey indentation rules:

  def foo(x)
    a = x.each { |e| puts(e) }
                  # ^ put cursor here and press `r<cr>`.
View centers.rb
#!/usr/bin/ruby --disable-gems
out, stat = Open3.capture2('qpdf', '--qdf', '--object-streams=disable', 'left-key-spacing.pdf', '-')
abort('qpdf fail') unless stat.success?
# coordinates are indexed from top-left, x is horizontal; y is vertical