Skip to content

Instantly share code, notes, and snippets.

@jordansissel
jordansissel / keyboardcapture.go
Created Sep 26, 2017 — forked from obonyojimmy/keyboardcapture.go
go lang keyboard capture
View keyboardcapture.go
package main
import (
"fmt"
"syscall"
//~ "time"
"unsafe"
"golang.org/x/sys/windows"
)
View Foo.java
public class Foo {
private static final int ITERATIONS = 10000000;
public static void main(String[] args) {
Foo foo = new Foo();
int i = Integer.parseInt(args[0]);
System.out.println(i);
if (args[1].equals("a")) {
System.out.println("a");
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)