Skip to content

Instantly share code, notes, and snippets.

Dylan Thacker-Smith dylanahsmith

Block or report user

Report or block dylanahsmith

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@dylanahsmith
dylanahsmith / test2.rb
Last active Jan 15, 2019
mysql2 EINTR on connect prolonged timeout reproduction
View test2.rb
#!/usr/bin/env ruby
require 'mysql2'
require 'rbconfig'
CONNECT_TIMEOUT = ARGV.empty? ? nil : ARGV.shift.to_i
trap("USR2") {}
HOST = case RbConfig::CONFIG["host_os"]
@dylanahsmith
dylanahsmith / test.rb
Last active Jan 15, 2019
mysql2 EINTR on connect error reproduction
View test.rb
#!/usr/bin/env ruby
require 'mysql2'
trap("USR2") {}
pid = fork do
loop do
client = Mysql2::Client.new
client.close
@dylanahsmith
dylanahsmith / 2.1.0-github
Created Jan 30, 2014
ruby-build definition for github's patched ruby 2.1
View 2.1.0-github
install_package "openssl-1.0.1e" "https://www.openssl.org/source/openssl-1.0.1e.tar.gz#66bf6f10f060d561929de96f9dfe5b8c" mac_openssl --if has_broken_mac_openssl
install_git "ruby-2.1.0-github" git@github.com:github/ruby.git 2.1 ldflags_dirs standard verify_openssl
@dylanahsmith
dylanahsmith / rpoplpushn-benchmark.rb
Created Jan 14, 2014
Batch redis atomic pop push benchmark
View rpoplpushn-benchmark.rb
#!/usr/bin/env ruby
require 'benchmark'
require 'redis'
require 'wolverine'
ITERATIONS = 200
BATCH_SIZE = 200
PROCESS_COUNT = 8
redis = Redis.new(:host => 'localhost')
@dylanahsmith
dylanahsmith / tcp-no-delay-benchmark.rb
Created Jan 9, 2014
Benchmarking Net::HTTP with and without keep-alive and TCP_NODELAY
View tcp-no-delay-benchmark.rb
#!/usr/bin/env ruby
require 'net/http'
require 'net/http/persistent'
require 'benchmark'
class HttpNoTcpDelay < Net::HTTP
def on_connect
@socket.io.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)
nil
@dylanahsmith
dylanahsmith / marshal-print.rb
Last active Jan 18, 2019
Print contents of marshal dump for inspection and debugging
View marshal-print.rb
#!/usr/bin/env ruby
# frozen_string_literal: true
filename = ARGV.shift
class MarshalPrinter
TYPE_NIL = '0'
TYPE_TRUE = 'T'
TYPE_FALSE = 'F'
TYPE_FIXNUM = 'i'
@dylanahsmith
dylanahsmith / boost_ignored_on_prefix_search.sh
Created Aug 19, 2012
elasticsearch ignores boost on prefix search
View boost_ignored_on_prefix_search.sh
#!/bin/sh
curl -XDELETE 'http://localhost:9200/foo'
curl -XPUT 'http://localhost:9200/foo/?pretty=true' -d '
{
"mappings" : {
"bar" : {
"properties" : {
"title" : {
@dylanahsmith
dylanahsmith / qs-analyzed-wildcard-and-op-bug.sh
Created Aug 17, 2012
elasticsearch query_string with analyze_wildcard default operator bug
View qs-analyzed-wildcard-and-op-bug.sh
#!/bin/sh
curl -XDELETE localhost:9200/test
curl -XPUT 'http://localhost:9200/test/doc/1' -d '{
"message" : "apples oranges"
}'
curl -XPUT 'http://localhost:9200/test/doc/2' -d '{
"message" : "apples"
@dylanahsmith
dylanahsmith / rubytest
Last active Oct 3, 2015
Wrapper script for running ruby tests
View rubytest
#!/usr/bin/env ruby
require 'pathname'
require 'optparse'
USAGE = "Usage: rubytest [OPTIONS] FILE..."
debug = true
args = []
@dylanahsmith
dylanahsmith / ctags.sh
Created Apr 20, 2012 — forked from burke/ctags.sh
bundle-ctags
View ctags.sh
#!/bin/sh
gem_home=`gem environment gemdir`
ruby_stdlib="$(rbenv prefix)/lib/ruby/$(basename "$gem_home")"
gem_sources=`bundle list --paths`
if [ $? -ne 0 ]; then
echo "$gem_sources"
exit 1
fi
You can’t perform that action at this time.