Skip to content

Instantly share code, notes, and snippets.

View nicobrevin's full-sized avatar

Nick Griffiths nicobrevin

  • Catalyst NZ
  • Wellington, New Zealand
View GitHub Profile
def MyClass
module Transactional
def delete_them
db.delete
end
end
# this looks for a transaction module, introspects the methods,
# adds new methods to MyClass which create transactions and then calls
@nicobrevin
nicobrevin / gist:460263
Created July 1, 2010 17:26
jsvc-daemon
#! /bin/sh
# Generic script for running ruby scripts as daemons using
# jsvc and a java class to control the daemon.
#
# Contains common parameters and start/stop
# Things you'll need to set on a per script/daemon basis:
# SCRIPT_NAME
#
# Things you can set:
public class JRubyDaemon implements Daemon {
private Ruby runtime;
private Thread thread;
private RubyModule appModule;
private boolean debug;
private RubyModule daemon;
public void init(DaemonContext arguments) throws Exception {
@nicobrevin
nicobrevin / gist:473960
Created July 13, 2010 14:38
benchmarking with jruby
include java
def benchmark(warmups, loops, &block)
(0...warmups).map do
start_time = java.lang.System.currentTimeMillis
(0...loops).each { yield }
time = java.lang.System.currentTimeMillis - start_time
$stdout.write("#{time},")
time
end
profile = 'lc'
bitrates = [96, 128, 160]
files = Dir['*.wav']
prog = '~/lib/nero/linux/neroAacEnc'
bitrate_control = ['br', 'cbr']
files.each do |fname|
bitrates.each do |rate|
bitrate_control.each do |bc|
@nicobrevin
nicobrevin / load_profile.xml
Created July 27, 2010 17:35
load_profile.xml
<?xml version="1.0"?><tsung loglevel="info">
<clients>
<client host="localhost" use_controller_vm="true" maxusers="10000"/>
</clients>
<servers>
<server port="80" type="tcp" host="staging.playlouder.com"/>
</servers>
<load>
<arrivalphase phase="1" unit="minute" duration="3">
<users unit="second" arrivalrate="200"/>
@nicobrevin
nicobrevin / gist:886697
Created March 25, 2011 11:14
Java implementation of process_result_set for improving performance of creating row hashes from a ResultSet
package com.msp;
import java.math.BigDecimal;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Time;
import java.sql.Timestamp;
import org.jruby.Ruby;
diff --git a/modules/jenkins/manifests/cli.pp b/modules/jenkins/manifests/cli.pp
index ca44571..e4d1233 100644
--- a/modules/jenkins/manifests/cli.pp
+++ b/modules/jenkins/manifests/cli.pp
@@ -8,17 +8,26 @@ class jenkins::cli {
fail("Use of private class ${name} by ${caller_module_name}")
}
- $jar = '/usr/lib/jenkins/jenkins-cli.jar'
- $extract_jar = 'unzip /usr/lib/jenkins/jenkins.war WEB-INF/jenkins-cli.jar'
{"test":"json","has":"purpose"}
bridge name bridge id STP enabled interfaces
pactbr1 8000.3e04027bdac7 no veth1pl10020
veth1pl12905
veth1pl3761
veth1pl5487