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
A $ ip r
default via 10.0.3.1 dev eth0
10.0.3.0/24 dev eth0 proto kernel scope link src 10.0.3.118
10.62.0.0/24 dev eth1 proto kernel scope link src 10.62.0.10
169.254.0.0/16 dev eth0 scope link metric 1013
B $ ip r
default via 10.0.3.1 dev eth0
10.0.3.0/24 dev eth0 proto kernel scope link src 10.0.3.112
169.254.0.0/16 dev eth0 scope link metric 1008
0: from all lookup local
32766: from all lookup main
32767: from all lookup default
$ diff /tmp/sysctl-*
24c24
< net.ipv4.conf..rp_filter = 1
---
> net.ipv4.conf..rp_filter = 0
44c44
< net.ipv6.conf..accept_dad = 0
---
> net.ipv6.conf..accept_dad = 1
bridge name bridge id STP enabled interfaces
pactbr1 8000.3e04027bdac7 no veth1pl10020
veth1pl12905
veth1pl3761
veth1pl5487
@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:
@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;
@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"/>
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 / 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
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 {