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
  • 06:44 (UTC -06:00)
View GitHub Profile
@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):
; -*- 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 / gist:5060406
Last active December 14, 2015 08:48
DelayedFutureTask
package org.robotninjas.audio;
import com.google.common.base.Ticker;
import com.google.common.primitives.Longs;
import java.util.concurrent.Callable;
import java.util.concurrent.Delayed;
import java.util.concurrent.FutureTask;
import java.util.concurrent.TimeUnit;
package org.robotninjas.audio;
import com.google.common.util.concurrent.*;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import static com.google.common.util.concurrent.MoreExecutors.listeningDecorator;
/**
* Copyright 2013 David Rusek <dave.rusek@gmail.com>
*
* 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
import com.google.common.util.concurrent.*;
import org.apache.commons.dbcp.cpdsadapter.DriverAdapterCPDS;
import org.apache.commons.dbcp.datasources.SharedPoolDataSource;
import org.apache.commons.dbutils.AsyncQueryRunner;
import org.apache.commons.dbutils.ResultSetHandler;
import javax.sql.DataSource;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.concurrent.ThreadPoolExecutor;
import org.junit.Test;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import static org.junit.Assert.assertFalse;
/**
@mgodave
mgodave / logging.h
Created March 1, 2012 18:30
Logging to j.u.Logger from JNI
#ifndef __LOGGING_H__
#define __LOGGING_H__
#include <jni.h>
typedef enum {
SEVERE = 0,
WARNING,
INFO,
FINE,
@mgodave
mgodave / gist:1806160
Created February 12, 2012 04:06
portaudio paex_record.c java jna port
/**
* Created by IntelliJ IDEA.
* User: drusek
* Date: 2/10/12
* Time: 12:40 PM
* To change this template use File | Settings | File Templates.
*/
import com.sun.jna.*;
import com.sun.jna.ptr.PointerByReference;
@mgodave
mgodave / gist:876561
Created March 18, 2011 18:19
Create flows from a stream of packets
;;WARNING: UNTESTED
(ns flows
(:import jpcap.JpcapCaptor))
(defrecord flow-tuple :src-ip :dst-ip :src-port :dst-port :protocol)
(defrecord flow :flow-tuple :octets :first-update :last-update)
(comment
(defprotocol CaptureProtocol