Skip to content

Instantly share code, notes, and snippets.

View mgodave's full-sized avatar
🤟
move along, nothing to see here...

Dave Rusek mgodave

🤟
move along, nothing to see here...
  • Denver, CO
  • 23:00 (UTC -06:00)
View GitHub Profile
; -*- mode: clojure; -*-
; vim: filetype=clojure
(logging/init :file "/var/log/riemann/riemann.log")
; Listen on the local interface over TCP (5555), UDP (5555), and websockets
; (5556)
(let [host "127.0.0.1"]
(tcp-server :host host)
(udp-server :host host)
@mgodave
mgodave / javadoc.py
Last active December 16, 2015 08:39
Serve javadocs from maven cache
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
from zipfile import ZipFile
from string import join
import os
import re
def getMavenCoordinates(elements):
return dict(zip(('group', 'artifact', 'version'), elements))
def getMavenArtifactName(coordinates):
package org.robotninjas.util;
import com.google.common.util.concurrent.AbstractFuture;
import com.google.common.util.concurrent.TimeLimiter;
import java.util.concurrent.Callable;
import java.util.concurrent.RunnableFuture;
import java.util.concurrent.TimeUnit;
public class TimeLimitedFutureTask<V> extends AbstractFuture<V> implements RunnableFuture<V> {
@mgodave
mgodave / AsyncCommand.java
Created April 29, 2013 21:41
AsyncCommand
package org.robotninjas.util;
import com.google.common.base.Optional;
import com.google.common.util.concurrent.*;
import java.util.concurrent.Callable;
import java.util.concurrent.Executor;
import java.util.concurrent.TimeUnit;
public class AsyncCommand<V> {
@mgodave
mgodave / FunctionCompositionBuilder.java
Last active December 16, 2015 21:29
Function Composition with Guava
package org.robotninjas.util;
import com.google.common.base.Function;
import com.google.common.util.concurrent.*;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
ListenableFuture<RowKey> rowKeyFuture = indexService.lookUp(query);
AsyncFunction<RowKey, QueryResult> queryFunction =
new AsyncFunction<RowKey, QueryResult>() {
public ListenableFuture<QueryResult> apply(RowKey rowKey) {
return dataService.read(rowKey);
}
};
ListenableFuture<QueryResult> queryFuture = transform(rowKeyFuture, queryFunction);
public class FunctionComposerExample {
private final Executor mainPool;
private final Executor ioPool;
public FunctionComposerExample(Executor mainPool, Executor ioPool) {
this.mainPool = mainPool;
this.ioPool = ioPool;
}
public class ChainingExample {
private final Executor mainPool;
private final Executor ioPool;
public ChainingExample(Executor mainPool, Executor ioPool) {
this.mainPool = mainPool;
this.ioPool = ioPool;
}
/*
* Copyright 2013 Basho Technologies 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
@mgodave
mgodave / CounterMutationBuilder.java
Created October 16, 2013 20:08
CRDT user API PoC
/*
* Copyright 2013 Basho Technologies 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