Skip to content

Instantly share code, notes, and snippets.

View rasputnik's full-sized avatar
💭
trying out graphiQL

rasputnik rasputnik

💭
trying out graphiQL
View GitHub Profile
Gem found matching: jruby-openssl (= 0.8.7)
Gem found matching: jruby-win32ole (>= 0)
Gem found matching: jdbc-mysql (>= 0)
Gem found matching: msgpack-jruby (>= 0)
Gem found matching: cinch (>= 0)
Gem found matching: spoon (>= 0)
Gem found matching: mocha (>= 0)
Gem found, but funky: shoulda (>= 0) (Unable to activate bourne-1.1.2, because mocha-0.13.3 conflicts with mocha (= 0.10.5))
Gem found matching: rspec (>= 0)
Gem found matching: insist (= 0.0.8)
# run with "jruby --1.9 /path/to/this.rb" and wait 10 minutes
class Thing
def initialize
require 'cabin'
@logger = Cabin::Channel.new
sout = Logger.new(STDOUT)
@logger.level = :debug
@rasputnik
rasputnik / core.clj
Created December 11, 2012 11:44
this is throwing a stacktrace starting with : "Exception in thread "main" java.lang.IllegalArgumentException: Parameter declaration wrap-json-response should be a vector"
(ns tyrekick.core
(:use ring.adapter.jetty ring.util.response ring.middleware.json)
(:gen-class))
(defn handler
"dead simple to get benchmark reqs/sec"
[request]
(response {:message "hello nasty"}))
(defn app
@rasputnik
rasputnik / gist:3634727
Created September 5, 2012 10:30
4clojure #23 : reversing a sequence
(defn widdershins [coll]
(letfn [(flip [tocoll fromcoll]
(if (empty? fromcoll)
tocoll
(flip (cons (first fromcoll) tocoll) (rest fromcoll))
)
)]
(flip [] coll)
)
)
@rasputnik
rasputnik / gist:1048575
Created June 27, 2011 09:38
logstash not parsing syslog?
[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://10.1.2.3: <30>ntpd[3355]: synchronized to 1.2.3.4, stratum 2
2011-06-27T09:36:22.631000Z syslog://10.2.32.2: <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
rasputnik / gist:978645
Created May 18, 2011 14:13
jruby -S gem install arel on 1.6.1
[sisred@buckaroo graylog2-web-interface]$ jruby -S gem install arel
System.java:-2:in `arraycopy': java.lang.ArrayIndexOutOfBoundsException
from DefaultResolver.java:111:in `makeTime'
from DefaultResolver.java:277:in `create'
from DefaultResolver.java:317:in `handleScalar'
from DefaultResolver.java:435:in `orgHandler'
from DefaultResolver.java:455:in `node_import'
from DefaultResolver$s$1$0$node_import.gen:65535:in `call'
from CachingCallSite.java:137:in `call'
from RubyLoadHandler.java:40:in `handle'
cron { "logshipping.cronjob":
command => $logshippingscript,
require => File[$logshippingscript],
hour => 15,
minute => 01,
user => "apache"
}
file { $logshippingscript :
owner => apache,
class mongodb::repo {
yumrepo { "10gen repository":
enabled => 1,
descr => "10gen repository",
baseurl => case $architecture {
i686: {"http://downloads.mongodb.org/distros/centos/5.4/os/x86_64/"}
default: { "baseurl=http://downloads.mongodb.org/distros/centos/5.4/os/i386/"}
},
gpgcheck => 0
}
module.exports = function counterSetup(logcheckpoint) {
var hitcount = 0;
var logcheckpoint = logcheckpoint || 1000;
return function hitCount(req, res, next) {
hitcount++;
if (hitcount % logcheckpoint == 0 ) {
console.log(hitcount + " hits");
}
next();
@rasputnik
rasputnik / ImageSizer
Created October 12, 2009 13:33
Rack Middleware to tell you dimensions of an image
# 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
end
def call(env)