Skip to content

Instantly share code, notes, and snippets.

Avatar

Jordan Sissel jordansissel

View GitHub Profile
View perf.rb
# encoding: utf-8
require "benchmark/ips"
require "logstash/codecs/base"
require "logstash/filters/date"
require "logstash/filter_delegator"
require "logstash/filters/date-old"
# `gradlew build` makes this
require "build/libs/logstash-filter-date.jar"
View Foo.java
import java.io.FileReader;
import java.io.File;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.FileNotFoundException;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.Queue;
public class Foo {
public static void main(String args[]) throws FileNotFoundException {
@jordansissel
jordansissel / 00-Sample run.txt
Last active Aug 4, 2016 — forked from reyjrar/logstash-config-broken.conf - Starting Point
Massive Parse Tree Failure in Logstash 5.0.0-alpha3
View 00-Sample run.txt
# Example packet:
% echo -n '<123>Aug 4 07:54:35 foo bar: { "hello": "world" }' | nc -vu 127.0.0.1 9514
% bin/logstash --version
logstash 5.0.0-alpha4
% bin/logstash -f logstash-config-broken.conf
Pipeline main started
{
View gist:e7d236baf516d40353cea1404567006c
PS C:\Users\jls.FRIENDSHIP> get-vm | where notes -eq origin
Name State CPUUsage(%) MemoryAssigned(M) Uptime Status Version
---- ----- ----------- ----------------- ------ ------ -------
CentOS 6.7 Off 0 0 00:00:00 Operating normally 7.0
CentOS 7 Off 0 0 00:00:00 Operating normally 7.0
Debian 8.4 Off 0 0 00:00:00 Operating normally 7.0
Fedora 23 Off 0 0 00:00:00 Operating normally 7.0
FreeBSD 10.3 Off 0 0 00:00:00 Operating normally 7.0
openSUSE 42.1 Off 0 0 00:00:00 Operating normally 7.0
View gist:1427b9523cada667a33e
#!/usr/bin/env ruby
#
require "cabin"
require "benchmark"
c = Cabin::Channel.get
iterations = 100_000
msg = "ok"
View handler.rb
route /^slowcmd/, :slowcmd, :command => true
# ...
def slowcmd(msg)
Thread.new do
sleep 2
msg.reply("OK")
end
end
View body.rs
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)
View gist:9e13f2072d2f57e6ec5f
% 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
View rusage.rb
require "ffi"
class RUsage < FFI::Struct
module LibC
extend FFI::Library
ffi_lib ["libc.so.6", "libc"]
attach_function :getrusage, [:int, :pointer], :int
end
You can’t perform that action at this time.