Skip to content

Instantly share code, notes, and snippets.

sudo packer -S chruby
sudo packer -S ruby-build-git
sudo ruby-build 1.9.3-p374 /opt/rubies/ruby-1.9.3-p374
require 'rubygems'
require 'benchmark/ips'
class ExampleClass
def foo; 42; end
end
module ExampleMixin
def foo; 43; end
end
$ gnuplot
G N U P L O T
Version 4.6 patchlevel 0 last modified 2012-03-04
Build System: Linux x86_64
Copyright (C) 1986-1993, 1998, 2004, 2007-2012
Thomas Williams, Colin Kelley and many others
gnuplot home: http://www.gnuplot.info
# encoding: UTF-8
require 'logging'
log = Logging.logger['read_rate']
log.add_appenders(
Logging.appenders.file(
"1.log",
:layout => Logging.layouts.pattern(:pattern => '%m\n'),
:auto_flushing => 100
)

The next morning Rollins came out wearing only a tiny pair of athletic shorts – tattoos and muscles on full display. Freda and Juliana ogled him shamelessly as he made fun of my canvas sneakers and pressured me to come lift weights in his garage. I politely declined. He asked me to make a pot of coffee and, assuming Rollins drank a strong brew, I heavy-handed it to the tune of approximately double-strength. I handed him a cup and he took a sip and immediately spat it in the sink. “You call this COFFEE??” he bellowed. “Pour that shit out and I’ll show you how to brew a MAN’S pot of coffee!!!” His brew was about three times as strong as mine, and it kept me in a manic state of agitation for the entire visit.

require 'atomic'
class RateLimit
def initialize(ops_per_second, max_bucket_size = ops_per_second)
@ops_per_second = ops_per_second
@max_bucket_size = max_bucket_size
@sec_per_op = 1.0 / @ops_per_second
@bucket = Atomic.new(0)
@incr_lock = Atomic.new(0)
--- source/ext/dl/depend.old 2011-07-25 23:32:16.000000000 +0000
+++ source/ext/dl/depend 2011-07-25 23:32:34.000000000 +0000
@@ -32,15 +32,15 @@
call.func: $(srcdir)/mkcall.rb ./dlconfig.rb
@echo "Generating call.func"
- @$(RUBY) $(srcdir)/mkcall.rb > $@
+ @$(RUBY) $(srcdir)/mkcall.rb | tee $@
callback.func: $(srcdir)/mkcallback.rb ./dlconfig.rb
# /etc/conf.d/ttserver: config file for /etc/init.d/ttserver
# TCP port TokyoTyrant server should listen on
TYRANT_PORT="1978"
# Location of the TokyoTyrant server database
# Also put addional options here, eg, #bnum
# See 'ttserver' man page
TYRANT_DB="/var/lib/tokyotyrant/tokyotyrant.tcb"
begin
# try to call SSL::SSLSocket#io.
@sock.io.shutdown
rescue NoMethodError
# @sock is not an SSL::SSLSocket.
@sock.shutdown
end
class SkinnyJeanDb < ActiveRecord::Base
self.abstract_class = true
end
SkinnyJeanDb.establish_connection(:adapter => 'sqlite3', :database => @sqlite_db_path)
class Pageview < SkinnyJeanDb; end
Pageview.count