Skip to content

Instantly share code, notes, and snippets.

@greenail
greenail / gist:4067095
Created November 13, 2012 17:19
celluloid actors hang
require 'rubygems'
require 'celluloid'
require 'celluloid/io'
class Look
include Celluloid
def initialize
@r = Celluloid::IO::DNSResolver.new
end
def up(a)
module TreeWalker
def children
res = []
@childs.each do |c|
res += self.send(c)
end
return res
end
end
c = Customer.create(:name => "#{rand(1000)}root")
hc = c.host_classes.create(:name => 'web_child')
h = hc.hosts.create(:name => 'server1_child')
s = h.services.create(:name => 'ssh_child')
1.9.3p286 :075 > c.children
=> []
c = Customer.create(:name => "#{rand(1000)}root")
input {
stdin {
type => "json"
format => "json"
}
}
filter {
date {
type => "json"
t => "yyyy-MM-dd HH:mm:ss"
input {
zeromq {
address => ['tcp://192.168.0.136:6667']
format => ['json']
type => 'zeromq'
debug => true
topology => "pushpull"
}
}
filter {
Valid json?
{
"to": null,
"msg": "fuck you",
"command": "console_send",
"h": {
"sequence": 1,
"ts": 1351393625,
"client_id": "cfaaa1f6-be31-40ad-ab56-fddfb47c90f4",
@greenail
greenail / gist:3814247
Created October 1, 2012 20:32 — forked from anonymous/gist:3814121
chef rvm hell, this blows up
script "RVM" do
interpreter 'bash'
flags '-l'
user 'vagrant'
code <<-EOS
whoami
if [ -f /home/vagrant/.rvm/bin/rvm ]
then
echo "RVM is installed skipping...."
else
PS C:\Users\jesss\Documents\Aptana Studio 3 Workspace\neodevise> jruby -S bundle exec g devise:install --orm=neo4j
Cannot locate Java installation, specified by JAVA_HOME:
δ
PS C:\Users\jesss\Documents\Aptana Studio 3 Workspace\neodevise> jruby -S bundle exec rails g devise:install --orm=neo4j
Unfortunately, a fatal error has occurred. Please see the Bundler
troubleshooting documentation at http://bit.ly/bundler-issues. Thanks!
SystemCallError: Unknown error - No message available
_exec_internal at org/jruby/RubyKernel.java:1658
exec at file:/C:/jruby-1.7.0.RC1/lib/jruby.jar!/jruby/kernel19/kernel.rb:23
@greenail
greenail / gist:3276839
Created August 6, 2012 17:19
celluloid
require 'celluloid'
require 'ruby-prof'
require 'prime'
class MyWorker
include Celluloid
def add_one(number)
# roflscale computation goes here
number.prime_division
@greenail
greenail / index.html
Created July 25, 2012 16:01
text box filtering
<html>
<head>
<link href="https://raw.github.com/novus/nvd3/master/src/nv.d3.css" rel="stylesheet" type="text/css">
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'></script>
<script type="text/javascript" src="https://raw.github.com/novus/nvd3/master/lib/d3.v2.js"></script>
<script type="text/javascript" src="https://raw.github.com/novus/nvd3/master/nv.d3.js"></script>
<script type="text/javascript" src="https://raw.github.com/novus/nvd3/master/src/tooltip.js"></script>
<script type="text/javascript" src="https://raw.github.com/novus/nvd3/master/src/models/stackedArea.js"></script>
<script type="text/javascript" src=""></script>