Skip to content

Instantly share code, notes, and snippets.

@damphyr
damphyr / canvas.erb
Created October 15, 2010 11:42
A simple extensible Sinatra application for use as an information radiator
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title><%= title %></title>
<script src="/js/drawing_methods.js"></script>
</head>
<body id="body" onload="<%= drawing_function %>">
@damphyr
damphyr / output
Created February 28, 2011 12:52
A simple test for dynamic dependencies in Rake
meisterbrau:rake-issues riva$ rake a
(in /Users/riva/Projects/mine/sandbox/rake-issues)
b
a
@damphyr
damphyr / benchmark_couchrest.rb
Created August 9, 2011 11:13
require couchrest benchmark
require "rubygems"
require "benchmark"
puts Benchmark.measure{require "couchrest"}
puts Benchmark.measure{require "couchrest_model"}
@damphyr
damphyr / environment
Created August 14, 2011 17:15
Minimal rakefile for Hoe 2.11.0 namespace bug
d:\foo>ruby -v
ruby 1.9.2p290 (2011-07-09) [i386-mingw32]
d:\foo>gem list
*** LOCAL GEMS ***
activemodel (3.0.9)
activerecord (3.0.9)
activesupport (3.0.9)
@damphyr
damphyr / environment
Created August 17, 2011 14:38
Get systemu to choke on the stdout of a program
d:\tmp\systemu>ruby -v
ruby 1.9.2p290 (2011-07-09) [i386-mingw32]
d:\tmp\systemu>gem list
*** LOCAL GEMS ***
activemodel (3.0.9)
activerecord (3.0.9)
activesupport (3.0.9)
@damphyr
damphyr / cloc_history.rb
Created August 18, 2011 10:59
Plot the LOC history for a bunch of svn revisions
#manually add the revisions or grep them out of svn log
revisions=[]
require 'psych'
require 'yaml'
require 'rubygems'
require 'fileutils'
require 'patir/command'
require 'json'
@damphyr
damphyr / gist:1405100
Created November 29, 2011 15:03
rutema minimal example output
[20111129 17:02:21] INFO: rutema v1.2.4
[20111129 17:02:21] INFO: Configuration loaded from config/minimal.rutema
[20111129 17:02:21] INFO: Run started in mode 'unattended'
[20111129 17:02:21] INFO: Running T001 - T001
[20111129 17:02:21] INFO: Scenario for T001
[20111129 17:02:21] INFO: Running step 1 - echo - echo
Hello Testing World
[20111129 17:02:21] INFO: 1 - echo - echo - success
[20111129 17:02:21] INFO: Running T002 - T002
[20111129 17:02:21] INFO: Scenario for T002
@damphyr
damphyr / jruby 1.6.7
Created May 16, 2012 14:57
Thread behaviour in Ruby (In the GIL's grip)
meisterbrau:sandbox riva$ ruby -v
jruby 1.6.7 (ruby-1.8.7-p357) (2012-02-22 3e82bc8) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_31) [darwin-x86_64-java]
meisterbrau:sandbox riva$ ruby threading.rb
No threads: 0.955 seconds
Single thread: 0.667 seconds
Two threads: 0.683 seconds
@damphyr
damphyr / backtrace
Created October 8, 2012 15:26
Reproduce the windows marshalling bug in systemu
c:/ruby/lib/ruby/gems/1.9.1/gems/systemu-2.5.2/lib/systemu.rb:89:in `rescue in block (3 levels) in s
ystemu': systemu: Error - process interrupted! (RuntimeError)
o:↕ArgumentError: mesg"∟dump format error(0x67):bt[I"kC:/Users/C11865/AppData/Local/Temp/syste
encoding"♂IBM437I"mC:/Users/C11865/AppData/Local/Temp/systemu_C11865DEV_3620_3920_0.942001098869122_
1/program:5:in `<main>'♠@
from c:/ruby/lib/ruby/gems/1.9.1/gems/systemu-2.5.2/lib/systemu.rb:82:in `block (3 levels) i
n systemu'
from c:/ruby/lib/ruby/gems/1.9.1/gems/systemu-2.5.2/lib/systemu.rb:76:in `popen'
from c:/ruby/lib/ruby/gems/1.9.1/gems/systemu-2.5.2/lib/systemu.rb:76:in `block (2 levels) i
n systemu'
@damphyr
damphyr / Vagrantfile
Last active December 18, 2015 08:49
Refactored multiple Vagrant provider configuration (alternative to https://gist.github.com/tknerr/5753319)
#
# Vagrantfile for testing
#
def configure_provider provider,config,cfg_lmbd
config.vm.provider provider do |prvdr,override|
cfg_lmbd.call(prvdr,override)
end
end
def vbox_config name,ip,memory_size=384