This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns netflow.packet | |
(:import jpcap.JpcapCaptor) | |
(:import jpcap.packet.Packet)) | |
(def captor (JpcapCaptor/openFile "mytrace.pcap")) | |
(defn packet-seq [captor] | |
(let [packet (.getPacket captor)] | |
(when-not (= (Packet/EOF) packet) | |
(lazy-seq (cons packet (packet-seq captor)))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Problem: I have a raw file descriptor, from a parent process and I need to read from it: | |
(import java.io.FileDescriptor) | |
(import java.io.FileInputStream) | |
(def fdfield (.getDeclaredField (Class/forName "java.io.FileDescriptor") "fd")) | |
(def fd (FileDescriptor.)) | |
(.setInt fdfield fd 10) | |
(FileInputStream. fd) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef __LOGGING_H__ | |
#define __LOGGING_H__ | |
#include <jni.h> | |
typedef enum { | |
SEVERE = 0, | |
WARNING, | |
INFO, | |
FINE, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
OlderNewer