Skip to content

Instantly share code, notes, and snippets.

Avatar

Ryan Schlesinger ryansch

View GitHub Profile
@ryansch
ryansch / keybase.md
Created Apr 4, 2014
Keybase.io Proof
View keybase.md

Keybase proof

I hereby claim:

  • I am ryansch on github.
  • I am ryansch (https://keybase.io/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
ryansch / ImageMagick.spec
Created Apr 17, 2014
Fixed ImageMagick.spec
View ImageMagick.spec
%global VERSION 6.8.9
%global MAJOR_VERSION 6
%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
License: http://www.imagemagick.org/script/license.php
@ryansch
ryansch / test-server.rb
Created May 21, 2014
Simple http server for testing headers
View test-server.rb
require 'webrick'
puts "Starting server"
server = WEBrick::HTTPServer.new Port: 8000
server.mount_proc '/' do |req, res|
req.each do |header, val|
puts "#{header} = #{val}"
end
res.body = "Hello World"
end
@ryansch
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
ryansch / Output
Created Jul 29, 2014
Failing parse test for dmarc gem
View Output
Failures:
1) DMARC::Parser#dmarc_record parses version, policy, and rua
Failure/Error: expect(subject.parse record).to eq([
expected: [{:v=>"DMARC1"}, {:p=>"quarantine"}, {:rua=>"mailto:foo@example.com"}, {:rua=>"mailto:bar@example.com"}]
got: [{:v=>"DMARC1"@2}, {:p=>"quarantine"@11}]
(compared using ==)
@ryansch
ryansch / fake_redis.moon
Created Aug 1, 2014
This needs metaprogramming.
View fake_redis.moon
class FakeRedis
new: =>
@called = {}
set_timeout: (...) =>
@called.set_timeout = ...
true
connect: (...) =>
@called.connect = ...
View collection.rb
module BulkJob
class Collection
def with_worker(worker, &block)
begin
@orig_worker = @worker
@worker = worker
block.call
ensure
@worker = @orig_worker
end
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
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
#!/bin/sh
# 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)
GITHUBUSER=$1
You can’t perform that action at this time.