Skip to content

Instantly share code, notes, and snippets.

% echo '{ "array": [ { "one": 1 }, { "two": 2 }, { "three": 3 } ] }' | bin/logstash -f test.conf
{
"one" => 1,
"@version" => "1",
"@timestamp" => "2015-01-29T01:09:02.813Z"
}
{
"two" => 2,
"@version" => "1",
"@timestamp" => "2015-01-29T01:09:02.814Z"

Computing it -

% curl -s 'localhost:9200/logstash-*/_search?pretty' -d @req.json | jq '[ .aggregations["2"].buckets[] | { key: (.key_as_string), value: (.["3"].buckets[]["4"].buckets | .[1]["doc_count"] / .[0]["doc_count"]) } ] | [ .[].value ] | length as $count | add / $count'

0.005472730173337497

% rspec examples/socket_analyze_spec.rb
F
Failures:
[4/1946]
1) TCPServer on a random port should bind successfully
Failure/Error: raise Analysis.new(results)
32.31% tests successful of 2315 tests
Failure analysis:
48.64% -> [1126] SocketError
% rvm ruby-1.9.3-p484,ruby-2.1.5,jruby-1.7.19 do ruby -rstringio -e 'p StringIO.ancestors'
[StringIO, IO::writable, IO::readable, Enumerable, Data, Object, Kernel, BasicObject]
[StringIO, IO::generic_writable, IO::generic_readable, Enumerable, Data, Object, Kernel, BasicObject]
[StringIO, Enumerable, Data, Object, Kernel, BasicObject]
This file has been truncated, but you can view the full file.
logstash-1.5.0.rc1.1/bin/
logstash-1.5.0.rc1.1/bin/logstash
logstash-1.5.0.rc1.1/bin/logstash.bat
logstash-1.5.0.rc1.1/bin/logstash.lib.sh
logstash-1.5.0.rc1.1/bin/logstash-test
logstash-1.5.0.rc1.1/bin/plugin
logstash-1.5.0.rc1.1/bin/plugin.bat
logstash-1.5.0.rc1.1/bin/setup.bat
logstash-1.5.0.rc1.1/CHANGELOG
require "ffi"
class RUsage < FFI::Struct
module LibC
extend FFI::Library
ffi_lib ["libc.so.6", "libc"]
attach_function :getrusage, [:int, :pointer], :int
end
% bundle exec ruby prstyle.rb --debug https://github.com/jordansissel/fpm/pull/947
Cloning into '/var/folders/4r/4fpyt_2d1qvfrgb2fnngrqm40000gn/T/studtmp-9eeb66f7dc8cf5aeabe08598b0dec47d1e652126ccf53d56d888045949dd'...
...
From https://github.com/jordansissel/fpm
* [new ref] refs/pull/947/head -> origin/pull/947
Branch pull-request set up to track remote branch pull/947 from origin.
...
=> Running rubocop
Showing rubocop complaints about new code in this PR:
Offense at b/lib/fpm/package/virtualenv.rb:19
use rustc_serialize::json::{Json,Decoder};
use rustc_serialize::Decodable;
use std::io::Read;
pub fn parse<T: Read, R: Decodable, E>(mut r: T) -> Result<R, E> {
let item = try!(Json::from_reader(&mut r));
let mut decoder = Decoder::new(item);
let result: R = try!(Decodable::decode(&mut decoder));
Ok(result)
% sudo ruby ruby-supervisorctl.rb
[
[0] [
[0] {
:state => 30,
:stdout_logfile => "/tmp/falsetest-stdout---supervisor-bqdUwO.log",
:now => 1286783537,
:start => 1286783530,
:group => "falsetest",
@jordansissel
jordansissel / Running it
Created October 14, 2010 23:32
set an exported resource
# The first run fails because there is no 'importantserver' placeholder resource.
frontend1(~) % puppet apply --storeconfigs --config ./puppet.conf pull.pp
Could not find dependency Placeholder[importantserver] for File[/tmp/y] at /home/jordan/pull.pp:12
# Have another server export this resource
ops(~/pp) % puppet apply --storeconfigs --config ./puppet.conf push.pp
# Try again, which works because the exported resource is found.
frontend1(~) !1! % puppet apply --storeconfigs --config ./puppet.conf pull.pp
notice: /Stage[main]/Bar/File[/tmp/y]/content: content changed '{md5}5a2f711ba4198f0db5e6b9e38a8f2d64' to '{md5}53cadf1c93f077aae3747e6507d7aa8e'