Skip to content

Instantly share code, notes, and snippets.

Jesse Storimer jstorimer

Block or report user

Report or block jstorimer

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
@jstorimer
jstorimer / -
Last active Dec 25, 2015
Vim plugins + vimrc
View -
git_bundles = [
"git://github.com/ervandew/supertab.git",
"git://github.com/godlygeek/tabular.git",
"git://github.com/hallison/vim-rdoc.git",
"git://github.com/pangloss/vim-javascript.git",
"git://github.com/timcharper/textile.vim.git",
"git://github.com/tpope/vim-cucumber.git",
"git://github.com/tpope/vim-fugitive.git",
"git://github.com/tpope/vim-git.git",
"git://github.com/tpope/vim-haml.git",
View gist:6337721
require 'socket'
client = TCPSocket.new('localhost', 4481)
payload = "Lorem ipsum" * 100_000
total_bytes_written = 0
remaining_payload = payload
begin
puts 'looping'
@jstorimer
jstorimer / tclient.rb
Created Jun 25, 2013
These scripts were the result of the "Faster Rails test runs...with Unix!" screencast at https://www.youtube.com/watch?v=RSehcT4MnRM.
View tclient.rb
#!/usr/bin/env ruby
require 'socket'
test_file = ARGV[0]
socket = UNIXSocket.new('testing.sock')
socket.write(test_file)
socket.close_write
View check_then_set_with_sheep_lock.rb
class Sheep
def initialize
@shorn = false
# Here the sheep owns the mutex. But now the
# shearing logic is muddied up by synchronization
# logic. This doesn't seem like the right place for
# this.
@mutex = Mutex.new
end
View gist:5314556
require 'benchmark'
require 'thread'
require 'disruptor'
require_relative 'atomic_linked_queue'
$thread_count = 50
$iterations = 10
Thread.abort_on_exception = true
View 0-README.md

This is a proof-of-concept of a couple of concurrent data structures written in Ruby.

The implementations are heavily commented for those interested. There are benchmarks (with results) included below. The results are interesting, but, as always, take with a grain of salt.

Data structures

AtomicLinkedQueue is a lock-free queue, built on atomic CAS operations.

View gist:5051731
array = Array.new
trap(:INT) do
p array.size
exit
end
Thread.new do
loop do
array << 2
View gist:4115880
~/projects/shopify > cap staging deploy
* 2012-11-19 22:55:20 executing `staging'
* 2012-11-19 22:55:20 executing `set_staging_servers'
* 2012-11-19 22:55:20 executing `deploy'
triggering before callbacks for `deploy'
* 2012-11-19 22:55:20 executing `deploy:lock'
servers: ["app1.core.staging.ec2.shopify.com"]
** sftp upload #<StringIO:0x007fe0c24fe2f0> -> /u/apps/shopify/shared/system/lock.txt
[app1.core.staging.ec2.shopify.com] /u/apps/shopify/shared/system/lock.txt
[app1.core.staging.ec2.shopify.com] done
View module-testing.rb
class Foo
include Module.new {
def this_works
end
}
include Module.new do
def this_doesnt_work
end
end
View gist:3881331
class Foo
include Module.new {
def this_works
end
}
include Module.new do
def this_doesnt_work
end
end
You can’t perform that action at this time.