Skip to content

Instantly share code, notes, and snippets.

@dlobue
dlobue / rtest.clj
Created October 22, 2014 18:55
leiningen subcommand to run riemann tests
(ns leiningen.rtest
(:use [leiningen.core.eval :only [eval-in eval-in-project]]))
(defn rtest [project test-file]
(eval-in
project
`(do
(require 'riemann.bin)
(riemann.bin/-main "test" ~test-file))))
loading bin
INFO [2014-09-25 11:46:21,192] main - riemann.bin - PID 19634
INFO [2014-09-25 11:46:21,273] clojure-agent-send-off-pool-2 - riemann.transport.tcp - TCP server 127.0.0.1 5555 online
INFO [2014-09-25 11:46:21,274] main - riemann.core - Hyperspace core online
^[[D#riemann.codec.Event{:host "localhost", :service "my test service", :state nil, :description nil, :metric 59.0, :tags nil, :time 1411671015, :ttl nil}
missing from index
#riemann.codec.Event{:host "localhost", :service "my test service", :state nil, :description nil, :metric 63.0, :tags nil, :time 1411671016, :ttl nil}
present in index
#riemann.codec.Event{:host "localhost", :service "my test service", :state nil, :description nil, :metric 82.0, :tags nil, :time 1411671017, :ttl nil}
present in index
(defn node-ast [^BaseTree node]
"The AST for a given parse node"
(let [n (.getText node)
kids (remove (fn [x] (= x :useless))
(map node-ast (.getChildren node)))]
(case n
"or" (apply list 'or kids)
"and" (apply list 'and kids)
"not" (apply list 'not kids)
"=" (apply list '= kids)
(ns riemann-config-test
(:use
midje.sweet
riemann.streams
riemann.client
riemann.email
riemann.sns
[riemann.time :only [unix-time linear-time once! every!]])
(:require
riemann.streams
@dlobue
dlobue / gist:6454501
Created September 5, 2013 18:55
ssh client config
Host *
TCPKeepAlive yes
ServerAliveInterval 15
ServerAliveCountMax 3
HashKnownHosts no
ForwardAgent yes
ForwardX11 yes
@dlobue
dlobue / attribute.rb
Last active December 20, 2015 17:39
diff of example adding support for transparently executing Procs to Chef::Node::Attribute. original source code of Chef::Node::Attribute included for reference.
#
# Author:: Adam Jacob (<adam@opscode.com>)
# Author:: AJ Christensen (<aj@opscode.com>)
# Copyright:: Copyright (c) 2008 Opscode, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
@dlobue
dlobue / patch
Created November 14, 2012 18:14 — forked from anonymous/patch
diff --git a/src/libwaitress/waitress.c b/src/libwaitress/waitress.c
index ce2a254..88c309e 100644
--- a/src/libwaitress/waitress.c
+++ b/src/libwaitress/waitress.c
@@ -537,6 +537,10 @@ static WaitressReturn_t WaitressGnutlsRead (void *data, char *buf,
ssize_t ret = gnutls_record_recv (waith->request.tlsSession, buf, size);
if (ret < 0) {
+ if (ret == -9 || ret == GNUTLS_E_PREMATURE_TERMINATION) {
+ *retSize = 0;
Exception `NameError' at /usr/local/lib/site_ruby/1.8/rubygems/command_manager.rb:164 - uninitialized constant Gem::Commands::InstallCommand
Exception `Gem::LoadError' at /usr/local/lib/site_ruby/1.8/rubygems.rb:779 - Could not find RubyGem test-unit (>= 0)
Exception `Errno::EEXIST' at /usr/lib/ruby/1.8/fileutils.rb:243 - File exists - /root/.gem/specs/ec2-us-east-mirror.rightscale.com%80/rubygems/archive/latest
Exception `Errno::EEXIST' at /usr/lib/ruby/1.8/fileutils.rb:243 - File exists - /root/.gem/specs/ec2-us-east-mirror1.rightscale.com%80/rubygems/archive/latest
Exception `Errno::EEXIST' at /usr/lib/ruby/1.8/fileutils.rb:243 - File exists - /root/.gem/specs/ec2-us-east-mirror2.rightscale.com%80/rubygems/archive/latest
Exception `Errno::EEXIST' at /usr/lib/ruby/1.8/fileutils.rb:243 - File exists - /root/.gem/specs/ec2-us-east-mirror3.rightscale.com%80/rubygems/archive/latest
Exception `EOFError' at /usr/lib/ruby/1.8/net/protocol.rb:135 - end of file reached
Exception `EOFError' at /usr/lib/ruby/1.8/net/
invTypeMaterials
typeID invTypes.typeID
materialTypeID invTypes.typeID
invContrabandTypes
factionID chrFactions.factionID
typeID invTypes.typeID
invControlTowerResources
controlTowerTypeID invTypes.typeID
from elixir import *
metadata.bind = 'sqlite:///ccp_dump.db'
metadata.bind.echo = True
class agtAgentTypes(Entity):
#primary keys
agentTypeID = Field(SmallInteger(3), primary_key=True)
#misc columns