Skip to content

Instantly share code, notes, and snippets.

View .muttrc
set imap_user = ''
set imap_pass = 'pass'
set spoolfile = imaps://
set folder = imaps://
set record="imaps://[Gmail]/Sent Mail"
set postponed=”imaps://[Gmail]/Drafts”
set message_cachedir=”~/.mutt/cache/bodies”
set certificate_file=~/.mutt/certificates
set smtp_url = "smtp://"

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.

jstorimer / hilong.rb
Last active Jul 30, 2020
hilong -- A simply utility to show character counts for each line of input and highlight lines longer than 80 characters.
View hilong.rb
#!/usr/bin/env ruby
# A simply utility to show character counts for each line of input and
# highlight lines longer than 80 characters.
# Written as an example for
# Examples:
# $ hilong Gemfile
jstorimer / tclient.rb
Created Jun 25, 2013
These scripts were the result of the "Faster Rails test runs...with Unix!" screencast at
View tclient.rb
#!/usr/bin/env ruby
require 'socket'
test_file = ARGV[0]
socket ='testing.sock')
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 =
jstorimer / port_scanner.rb
Created Aug 30, 2012
Simple, parallel port scanner in Ruby built with connect_nonblock and
View port_scanner.rb
require 'socket'
# Set up the parameters.
PORT_RANGE = 1..512
HOST = ''
TIME_TO_WAIT = 5 # seconds
# Create a socket for each port and initiate the nonblocking
# connect.
sockets = do |port|
jstorimer / gist:364295
Created Apr 13, 2010
Most used shell aliases from dotfiles repos
View gist:364295
alias ls='ls --color=auto' [230]
alias ll='ls -l' [226]
alias ..='cd ..' [151]
alias la='ls -A' [147]
alias grep='grep --color=auto' [144]
alias l='ls -CF' [101]
alias gb='git branch' [95]
alias ls='ls -G' [95]
alias gd='git diff' [92]
alias egrep='egrep --color=auto' [91]
jstorimer / -
Last active Dec 25, 2015
Vim plugins + vimrc
View -
git_bundles = [
View gist:6337721
require 'socket'
client ='localhost', 4481)
payload = "Lorem ipsum" * 100_000
total_bytes_written = 0
remaining_payload = payload
puts 'looping'
View gist:5314556
require 'benchmark'
require 'thread'
require 'disruptor'
require_relative 'atomic_linked_queue'
$thread_count = 50
$iterations = 10
Thread.abort_on_exception = true