Skip to content

Instantly share code, notes, and snippets.

Michael Nitschinger daschl

Block or report user

Report or block daschl

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View main.rs
src/main.rs:76:14: 76:21 error: expected a literal
src/main.rs:76 writeln!(t, message).unwrap();
View gist:8934949
addNode().mapMany(new Function<Boolean, Composable<Boolean>>() {
@Override
public Composable<Boolean> apply(Boolean success) {
return addService();
}
}).mapMany(new Function<Boolean, Composable<String>>() {
@Override
public Composable<String> apply(Boolean success) {
return loadRawConfig();
}
@daschl
daschl / gist:8934453
Last active Aug 29, 2015
any idea how I can make this nicer?
View gist:8934453
public Promise<String> load() {
final Deferred<String,Promise<String>> deferred = Promises.defer(env.reactorEnv());
addNode().consume(new Consumer<Boolean>() {
@Override
public void accept(Boolean success) {
if(success) {
addService().consume(new Consumer<Boolean>() {
@Override
public void accept(Boolean success) {
View gist:9130306
/Library/Java/JavaVirtualMachines/jdk1.7.0_17.jdk/Contents/Home/bin/java -ea -DperfReportDir=/Users/michael/netty/microbench/target/reports/performance/ -Didea.launcher.port=7535 "-Didea.launcher.bin.path=/Applications/IntelliJ IDEA 13.app/bin" -Dfile.encoding=UTF-8 -classpath "/Applications/IntelliJ IDEA 13.app/lib/idea_rt.jar:/Applications/IntelliJ IDEA 13.app/plugins/junit/lib/junit-rt.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_17.jdk/Contents/Home/lib/ant-javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_17.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_17.jdk/Contents/Home/lib/javafx-doclet.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_17.jdk/Contents/Home/lib/javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_17.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_17.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_17.jdk/Contents/Home/lib/tools.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_17.jdk/Contents/Home/
View inside.java
private final Queue<Event<CouchbaseRequest>> queue = new ArrayDeque<Event<CouchbaseRequest>>();
final class EventResponseDecoder extends MessageToMessageDecoder<CouchbaseResponse> {
@Override
protected void decode(ChannelHandlerContext ctx, CouchbaseResponse in, List<Object> out) throws Exception {
Event<CouchbaseRequest> event = queue.poll();
((Deferred) event.getReplyTo()).accept(in);
}
@daschl
daschl / flush.java
Last active Aug 29, 2015
Flush me maybe!
View flush.java
/**
* Helper method to flush the pipeline if possible.
*
* Hey, I just connected you,
* And this is crazy,
* But here's my data,
* So flush me maybe!
* It's hard to read right,
* From your channel,
* But here's my data,
View gist:9320766
/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/bin/java -Didea.launcher.port=7545 "-Didea.launcher.bin.path=/Applications/IntelliJ IDEA 13.app/bin" -Dfile.encoding=UTF-8 -classpath "/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/lib/ant-javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/lib/javafx-doclet.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/lib/javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/lib/tools.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/jre/lib/htmlconverter.jar:/Li
@daschl
daschl / match.java
Created Mar 3, 2014
ohne das array zu touchen
View match.java
int start = 8192;
int toFind = 32768;
int data[] = new int[] {start, 16384, toFind, 65536}; // 2^13, ^14, ^15, ^16
for (int i = 0; i < 4; i++) {
if (start << i == toFind) {
System.out.println(i);
}
}
View fastquery.java
package bench;
import java.net.URLEncoder;
/**
* A new Query implementation trimmed for performance.
*/
public class FastQuery {
private static final int PARAM_REDUCE_OFFSET = 0;
View java.rb
require 'java'
java_import com.couchbase.client.CouchbaseClient
java_import java.util.Arrays
java_import java.net.URI
java_import java.util.concurrent.TimeUnit
hosts = Arrays::as_list(URI::create('http://127.0.0.1:8091/pools'))
client = CouchbaseClient.new(hosts, 'default', '')
You can’t perform that action at this time.