Skip to content

Instantly share code, notes, and snippets.

@leogomes
leogomes / PropagationQueuingNode.java
Created November 23, 2010 23:50
PropagationQueuingNode with UpdateSinkAction
/**
* Copyright 2010 JBoss Inc
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@leogomes
leogomes / diff_right_unlinking
Created November 24, 2010 13:55
diff_right_unlinking
svn diff -r 35983:36038 .
@leogomes
leogomes / gist:1317471
Created October 26, 2011 19:14
Tesseract initialization
-(void) startTesseract {
//Adapted from http://robertcarlsen.net/2009/12/06/ocr-on-iphone-demo-1043
NSString *dataPath = [[self applicationDocumentsDirectory] stringByAppendingPathComponent:@"tessdata"];
/*
Set up the data in the docs dir
want to copy the data to the documents folder if it doesn't already exist
*/
NSFileManager *fileManager = [NSFileManager defaultManager];
// If the expected store doesn't exist, copy the default store.
@leogomes
leogomes / InstantTemplate.tpl
Created July 26, 2013 07:19
Testing class changes
{macro main()}
<div {id "main"/} class="theme2">
<div {id "title"/} class="title">
<h1>Hello Instant Aria Templates</h1>
</div>
</div>
{@aria:SelectBox {
label: "New theme: ",
package org.drools.core.reteoo.compiled;
import java.util.Map;
import org.drools.core.common.InternalFactHandle;
import org.drools.core.common.InternalWorkingMemory;
import org.drools.core.reteoo.ModifyPreviousTuples;
import org.drools.core.spi.PropagationContext;
import org.drools.core.spi.RuleComponent;
import org.kie.api.definition.rule.Rule;
@leogomes
leogomes / PersonNetwork_Compiling.java
Created October 20, 2013 19:15
New version of generated CompiledNetwork that actually compiles :)
package org.drools.core.reteoo.compiled;
public class Compiledorg_drools_compiler_PersonNetwork extends
org.drools.core.reteoo.compiled.CompiledNetwork {
private org.drools.core.rule.constraint.MvelConstraint mvelConstraint15; // [AlphaNode(15)
// constraint=age
// ==
// 32]
private org.drools.core.rule.ContextEntry contextEntry15;
private org.drools.core.reteoo.LeftInputAdapterNode leftInputAdapterNode16; // [LeftInputAdapterNode(16)]

Keybase proof

I hereby claim:

  • I am leogomes on github.
  • I am leogomes (https://keybase.io/leogomes) on keybase.
  • I have a public key whose fingerprint is 9B97 A010 A4AE 65A9 457A 5384 285A F9D1 5045 3311

To claim this, I am signing this object:

import java.util.*;
import java.io.*;
import java.math.*;
/**
* The machines are gaining ground. Time to show them what we're really made of...
**/
class Player {
public static void main(String args[]) {
@leogomes
leogomes / .readme.md
Created November 4, 2016 16:18 — forked from jeanmarc/.readme.md
Reusable connections in Gatling tests

Introduction

Gist explaining a way to add long-living connections to Gatling and create scenarios that reuse the connection(s) to put load on the target system.

I have used the gatling-kafka plugin available on GitHub as inspiration.

Note that the code snippets provided here do not complile right out of the box. You will have to add some dependencies, and code yourself to make things work.

# JMH 1.18 (released 51 days ago)
# VM version: JDK 1.8.0_131, VM 25.131-b11
# VM invoker: /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/bin/java
# VM options: -Dfile.encoding=UTF-8
# Warmup: 5 iterations, 5 s each
# Measurement: 5 iterations, 5 s each
# Timeout: 10 min per iteration
# Threads: 32 threads, will synchronize iterations
# Benchmark mode: Throughput, ops/time
# Benchmark: fr.rivieradev.jmh.MapConcurrency.concurrentMap