Skip to content

Instantly share code, notes, and snippets.

View ryansch's full-sized avatar

Ryan Schlesinger ryansch

View GitHub Profile
@ryansch
ryansch / keybase.md
Created April 4, 2014 02:51
Keybase.io Proof

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 April 17, 2014 19:47
Fixed 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 17:37
Simple http server for testing headers
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 17:14
Opsworks unicorn configuration
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 July 29, 2014 19:16
Failing parse test for dmarc gem
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 August 1, 2014 02:57
This needs metaprogramming.
class FakeRedis
new: =>
@called = {}
set_timeout: (...) =>
@called.set_timeout = ...
true
connect: (...) =>
@called.connect = ...
@ryansch
ryansch / collection.rb
Created August 12, 2014 18:21
BulkJob helpers
module BulkJob
class Collection
def with_worker(worker, &block)
begin
@orig_worker = @worker
@worker = worker
block.call
ensure
@worker = @orig_worker
end
@ryansch
ryansch / mongoid.yml
Created August 19, 2014 22:38
mongoid config
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 June 4, 2015 18:44
Chargify Webhook Feature Test
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
}}
#!/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