Skip to content

Instantly share code, notes, and snippets.

@burke
burke / 0-readme.md
Created Jan 27, 2012 — forked from funny-falcon/cumulative_performance.patch
ruby-1.9.3-p327 cumulative performance patch for rbenv
View 0-readme.md

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

View spooler.go
// 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
@burke
burke / genkey.rb
Created Oct 12, 2016
Create an Elliptic Curve keypair in ruby
View genkey.rb
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
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 0.txt
Save this in [[roam/css]] as a toplevel block, wrapped in "```css" and "```"
@burke
burke / remotepaste.md
Last active Sep 10, 2020
This sets up keybindings in tmux that allow you to copy/paste to/from your OS X clipboard from tmux running inside an SSH connection to a remote host. Partially borrowed from http://seancoates.com/blogs/remote-pbcopy
View remotepaste.md

Local (OS X) Side

~/Library/LaunchAgents/pbcopy.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
     <key>Label</key>
     <string>localhost.pbcopy</string>
View apfs_volume.rb
# typed: true
# frozen_string_literal: true
require('dev')
require('fileutils')
module Dev
module Helpers
class APFSVolume
extend(T::Sig)
View ru.nix
{ config, pkgs, lib, ... }:
{
rune.project.name = "shopify-pay";
rune.framework.rails.enable = true;
aspect.packages.include = with pkgs; [
geolite2 ngrok mysqlClient57 overmind watchman toxiproxy v8
];
rune.project.repoName = "pay";
@burke
burke / 0-README.md
Last active Jun 9, 2020
Code Release for NixCon 2019
View 0-README.md

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 gameoflife.rb
# -*-coding: utf-8-*-
module Enumerable def &b;each &b;end end
,,,,,,,=10,{},->*{[]=1},->*{[]},->*{=[*]
[*]?&2>&12:==3},->,{=0;[->¢,{¢|==0||[¢+,+]&&+=1}];},
->{(-1..1).{|¢|(-1..1).{||[¢,]}}},->{.downto(-).{||(-..).{||
$><<([,]??X:?.)};puts}};=->{=({}.tap{||.{|(,),_|[->¢,{
¢|==0||[[+¢,+]]=[+¢,+]}]}})};[0,0];[1,0];[2,0];[2,1];[1,2]
loop{[];[]}