First, compile the shim:
gcc -Wall -O2 -fpic -shared -ldl bind.c -o bind.so
Now, run the demo and notice that it does what it looks like it does:
$ LD_PRELOAD=./bind.so ruby demo.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|
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.
|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|