Skip to content

Instantly share code, notes, and snippets.

Dick Davies rasputnik

Block or report user

Report or block rasputnik

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:125874
adapter: jdbc
username: me
password: sssh
driver: oracle.jdbc.driver.OracleDriver
url: jdbc:oracle:thin:@dbhost:1521:dbname
# run with 'jruby -S sequel -e production database.yml
rasputnik / ImageSizer
Created Oct 12, 2009
Rack Middleware to tell you dimensions of an image
View ImageSizer
# JRuby version of ImageScience (other image toolkits are available)
require 'image_voodoo'
class ImageSizer
def initialize(app, mime_types=%w[image/jpeg image/png image/gif])
@app = app
@mime_types = mime_types
def call(env)
View counter.js
module.exports = function counterSetup(logcheckpoint) {
var hitcount = 0;
var logcheckpoint = logcheckpoint || 1000;
return function hitCount(req, res, next) {
if (hitcount % logcheckpoint == 0 ) {
console.log(hitcount + " hits");
View argh can't do case statements
class mongodb::repo {
yumrepo { "10gen repository":
enabled => 1,
descr => "10gen repository",
baseurl => case $architecture {
i686: {""}
default: { "baseurl="}
gpgcheck => 0
View gist:703220
cron { "logshipping.cronjob":
command => $logshippingscript,
require => File[$logshippingscript],
hour => 15,
minute => 01,
user => "apache"
file { $logshippingscript :
owner => apache,
rasputnik / gist:978645
Created May 18, 2011
jruby -S gem install arel on 1.6.1
View gist:978645
[sisred@buckaroo graylog2-web-interface]$ jruby -S gem install arel `arraycopy': java.lang.ArrayIndexOutOfBoundsException
from `makeTime'
from `create'
from `handleScalar'
from `orgHandler'
from `node_import'
from DefaultResolver$s$1$0$node_import.gen:65535:in `call'
from `call'
from `handle'
rasputnik / gist:1048575
Created Jun 27, 2011
logstash not parsing syslog?
View gist:1048575
[root@topcat logstash]# java -jar logstash-1.0.12-monolithic.jar agent -f logstash-simple.cnf
{:args=>["agent", "-f", "logstash-simple.cnf"]}
W, [2011-06-27T10:36:21.439000 #27280] WARN -- runner.class: Input #<LogStash::Inputs::Syslog:0x12297d7> shutting down
2011-06-27T09:36:21.991000Z syslog:// <30>ntpd[3355]: synchronized to, stratum 2
2011-06-27T09:36:22.631000Z syslog:// <14>ncpd: cmd=0, len=14, data: BB BB 00 1C 00 00 00 00 1C 3F 00 00 00 00
[root@topcat logstash]# cat logstash-simple.cnf
input {
syslog {
rasputnik / gist:3634727
Created Sep 5, 2012
4clojure #23 : reversing a sequence
View gist:3634727
(defn widdershins [coll]
(letfn [(flip [tocoll fromcoll]
(if (empty? fromcoll)
(flip (cons (first fromcoll) tocoll) (rest fromcoll))
(flip [] coll)
rasputnik / core.clj
Created Dec 11, 2012
this is throwing a stacktrace starting with : "Exception in thread "main" java.lang.IllegalArgumentException: Parameter declaration wrap-json-response should be a vector"
View core.clj
(ns tyrekick.core
(:use ring.adapter.jetty ring.util.response ring.middleware.json)
(defn handler
"dead simple to get benchmark reqs/sec"
(response {:message "hello nasty"}))
(defn app
View 0.9.0pre8 jruby CPU
# run with "jruby --1.9 /path/to/this.rb" and wait 10 minutes
class Thing
def initialize
require 'cabin'
@logger =
sout =
@logger.level = :debug
You can’t perform that action at this time.