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
class JSONTypeClass < T::Types::Base | |
ScalarType = T.type_alias { T.any(String, Numeric, NilClass, FalseClass, TrueClass) } | |
IterType = T.type_alias { T.any(ScalarType, T::Array[T.untyped], T::Hash[String, T.untyped]) } | |
def name | |
'JSON' | |
end | |
def valid?(obj) | |
# in this particular case I don't think it makes sense to distinguish |
assert(JSONType.recursively_valid?({'a' => ['neato']})) | |
refute(JSONType.recursively_valid?({'a' => [:neato]})) |
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
// package spooler implements a disk-persistent queue. | |
// | |
// Spooler uses MDB (LMDB) to implement a queue of byteslices. Its intended usecase | |
// is to enqueue work items received by a service before later working them off. | |
// Note that Spooler only flushes to disk up to once every 25ms. As a result, | |
// if the process or machine crashes unexpectedly, the most recent 25ms of work | |
// can be lost. This decision effectively increases throughput by 10,000%, | |
// but makes spooler unsuitable for jobs that absolutely cannot be allowed to fail | |
// under any circumstances. | |
package spooler |
require 'openssl' | |
k = OpenSSL::PKey::EC.new('secp384r1').generate_key | |
p = OpenSSL::PKey::EC.new(k.public_key.group) | |
p.public_key = k.public_key | |
puts k.to_pem, p.to_pem |
# 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 |
Save this in [[roam/css]] as a toplevel block, wrapped in "```css" and "```" |
# typed: true | |
# frozen_string_literal: true | |
require('dev') | |
require('fileutils') | |
module Dev | |
module Helpers | |
class APFSVolume | |
extend(T::Sig) |
#!/bin/bash | |
# | |
# 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]" |
require('yaml') | |
module Ohno | |
def self.replace_index(welp, index) | |
case welp | |
when String | |
welp == "$index" ? index : welp.gsub(/\$index/, index.to_s) | |
else | |
welp | |
end |