Skip to content

Instantly share code, notes, and snippets.


Ryan Schlesinger ryansch

  • Instance Consulting Inc.
  • British Columbia, Canada
View GitHub Profile
ryansch /
Created Apr 4, 2014 Proof

Keybase proof

I hereby claim:

  • I am ryansch on github.
  • I am ryansch ( on keybase.
  • I have a public key whose fingerprint is 898F 7948 9D45 345B 4197 AFCC 76D9 CDFF 3C8E BFC3

To claim this, I am signing this object:

ryansch / ImageMagick.spec
Created Apr 17, 2014
Fixed ImageMagick.spec
View ImageMagick.spec
%global VERSION 6.8.9
%global Patchlevel 0
Name: ImageMagick
Version: %{VERSION}
Release: %{Patchlevel}.1%{?dist}
Summary: Use ImageMagick to convert, edit, or compose bitmap images in a variety of formats. In addition resize, rotate, shear, distort and transform images.
Group: Applications/Multimedia
ryansch / test-server.rb
Created May 21, 2014
Simple http server for testing headers
View test-server.rb
require 'webrick'
puts "Starting server"
server = Port: 8000
server.mount_proc '/' do |req, res|
req.each do |header, val|
puts "#{header} = #{val}"
res.body = "Hello World"
ryansch / unicorn.conf.erb
Created May 27, 2014
Opsworks unicorn configuration
View unicorn.conf.erb
worker_processes <%= node[:unicorn][:worker_processes] %>
user "<%= @deploy[:user]%>"
working_directory "<%= @deploy[:deploy_to]%>/current"
listen "<%= @deploy[:deploy_to]%>/shared/sockets/unicorn.sock", :backlog => <%= node[:unicorn][:backlog] %>, :tcp_nodelay => <%= node[:unicorn][:tcp_nodelay] %>, :tcp_nopush => <%= node[:unicorn][:tcp_nopush] %>, :tries => <%= node[:unicorn][:tries] %>, :delay => <%= node[:unicorn][:delay] %>, :accept_filter => <%= node[:unicorn][:accept_filter].inspect %>
timeout <%= node[:unicorn][:timeout] %>
ryansch / Output
Created Jul 29, 2014
Failing parse test for dmarc gem
View Output
1) DMARC::Parser#dmarc_record parses version, policy, and rua
Failure/Error: expect(subject.parse record).to eq([
expected: [{:v=>"DMARC1"}, {:p=>"quarantine"}, {:rua=>""}, {:rua=>""}]
got: [{:v=>"DMARC1"@2}, {:p=>"quarantine"@11}]
(compared using ==)
ryansch / fake_redis.moon
Created Aug 1, 2014
This needs metaprogramming.
View fake_redis.moon
class FakeRedis
new: =>
@called = {}
set_timeout: (...) =>
@called.set_timeout = ...
connect: (...) =>
@called.connect = ...
View collection.rb
module BulkJob
class Collection
def with_worker(worker, &block)
@orig_worker = @worker
@worker = worker
@worker = @orig_worker
View mongoid.yml
global_options: &global_options
# Configuration for whether or not to allow access to fields that do
# not have a field definition on the model. (default: true)
allow_dynamic_fields: false
# Enable the identity map, needed for eager loading. (default: false)
identity_map_enabled: false
# Includes the root model name in json serialization. (default: false)
# include_root_in_json: false
ryansch / foo_spec.rb
Created Jun 4, 2015
Chargify Webhook Feature Test
View foo_spec.rb
require 'feature/feature_helper'
feature 'Something involving chargify webhooks', :vcr, driver: :mechanize do
def chargify_webhook(from:, to:, subscription_id:)
payload = {subscription: {
id: subscription_id,
previous_state: from,
state: to
# Any other needed subscription info should go here
View setup_pair.rb
# create an account alias
#sudo dscl . -append /Users/$USER RecordName Pair pair
# configure sshd to only allow public-key authentication
#sudo sed -E -i.bak 's/^#?(PasswordAuthentication|ChallengeResponseAuthentication).*$/\1 no/' /etc/sshd_config
# add pair user public key(s)