Skip to content

Instantly share code, notes, and snippets.

View nickman's full-sized avatar

Nicholas Whitehead nickman

View GitHub Profile
15:34:48,474 |-INFO in ch.qos.logback.classic.jmx.JMXConfigurator(default) - Resetting context: default
15:34:48,477 |-INFO in ch.qos.logback.classic.jmx.JMXConfigurator(default) - onReset() method called JMXActivator [ch.qos.logback.classic:Name=default,Type=ch.qos.logback.classic.jmx.JMXConfigurator]
15:34:48,493 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set
15:34:48,494 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
15:34:48,494 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]
15:34:48,497 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
15:34:48,499 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender]
15:34:48,505 |-INFO in
@nickman
nickman / BosunOSMonitor.groovy
Created November 25, 2014 10:35
Groovy Script Collecting Local OS Stats and HTTP Posting to Bosun or OpenTSDB
import org.helios.nativex.sigar.HeliosSigar;
import org.hyperic.sigar.*;
import java.util.concurrent.atomic.*;
import org.hyperic.sigar.ptql.*;
import org.json.*;
import com.ning.http.client.*;
sigar = HeliosSigar.getInstance();
@nickman
nickman / ironjacamar.xml
Created September 10, 2014 16:24
Iron Jacamar XML Descriptor Example for WMQ Deployment into JBoss 7
<ironjacamar>
<config-property name="logWriterEnabled">true</config-property>
<config-property name="maxConnections">10</config-property>
<config-property name="reconnectionRetryCount">5</config-property>
<config-property name="traceEnabled">true</config-property>
<config-property name="traceLevel">3</config-property>
<config-property name="reconnectionRetryInterval">300000</config-property>
<config-property name="connectionConcurrency">5</config-property>
<transaction-support>XATransaction</transaction-support>
<connection-definitions>
SELECT
*
FROM
(
SELECT
DISTINCT X.*
FROM TSD_TSMETA X,
TSD_METRIC M,
TSD_FQN_TAGPAIR T,
TSD_TAGPAIR P,
public class AgentInstaller {
/** The created agent jar file name */
protected static final AtomicReference<String> agentJar = new AtomicReference<String>(null);
/**
* Self installs the agent, then runs a person sayHello in a loop
* @param args None
*/
public static void main(String[] args) {
public class AgentInstaller {
/** The created agent jar file name */
protected static final AtomicReference<String> agentJar = new AtomicReference<String>(null);
/**
* Self installs the agent, then runs a person sayHello in a loop
* @param args None
*/
public static void main(String[] args) {
@nickman
nickman / ByteSequenceIndexFinderTestCase.java
Created May 2, 2013 14:34
Test case for ByteSequenceIndexFinder using random byte sequences.
import java.util.Arrays;
import java.util.Random;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
/**
* <p>Title: ByteSequenceIndexFinderTestCase</p>
* <p>Description: </p>
* <p>Company: Helios Development Group LLC</p>
@nickman
nickman / ByteSequenceIndexFinder.java
Last active December 16, 2015 21:49
A Netty ChannelBufferIndexFinder that finds byte arrays withing a channel buffer. Still working on some odd bugs. Not thread safe either.
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBufferIndexFinder;
/**
* <p>Title: ByteSequenceIndexFinder</p>
* <p>Description: A {@link ChannelBufferIndexFinder} implementation for finding a sequence of bytes within a {@link ChannelBuffer}</p>
* <p>This class is <b><i>not</i></b> thread-safe and use by multiple threads will almost certainly cause it to explode.</p>
* @author Whitehead (nwhitehead AT heliosdev DOT org)
* <p><code>org.helios.apmrouter.util.ByteSequenceIndexFinder</code></p>
*/
@nickman
nickman / WebSocketInvoker.js
Created April 27, 2013 21:22
Signature & Options for Generalized WebSocket Service Invoker
/**
* Generalized websocket service invoker
* @param command A (mandatory) JSON subscription request
* @param options:<ul>
* <li><b>timeout</b>: The timeout in ms. on the request invocation confirm. (i.e. not a subscriber timeout) Default is 2000 ms.</li>
* <li><b>onresponse</b>: A callback invoked when the immediate response of the command invocation is received.</li>
* <li><b>ontimeout</b>: A callback invoked when the request times out</li>
* <li><b>onevent</b>: A callback invoked when an asynchronous event is received associated to the original invocation.</li>
* <li><b>oncancel</b>: A callback invoked the asynchronous event subscription associated to the original invocation is cancelled</li>
* </ul>
@nickman
nickman / MyPipelineFactory.java
Created June 12, 2012 13:54
MyPipelineFactory
public class MyPipelineFactory implements ChannelPipelineFactory {
public ChannelPipeline getPipeline() throws Exception {
// Create and configure a new pipeline for a new channel.
ChannelPipeline p = Channels.pipeline();
p.addLast("encoder", new EncodingHandler());
p.addLast("decoder", new DecodingHandler());
p.addLast("logic", new LogicHandler());
return p;
}
}