Skip to content

Instantly share code, notes, and snippets.

@jtai
jtai / statsd_dissector.lua
Last active May 24, 2021 15:52
Wireshark dissector to decode statsd protocol
-- Usage: tshark -X lua_script:statsd_dissector.lua -r capture.pcap
-- Usage: tshark -X lua_script:statsd_dissector.lua -T fields -e statsd.metric_name -e statsd.value -e statsd.metric_type -r capture.pcap
local statsd = Proto("statsd","Statsd Protocol")
local pf_metric_name = ProtoField.new("Metric Name", "statsd.metric_name", ftypes.STRING)
local pf_value = ProtoField.new("Value", "statsd.value", ftypes.STRING)
local pf_metric_type = ProtoField.new("Metric Type", "statsd.metric_type", ftypes.STRING)
statsd.fields = { pf_metric_name, pf_value, pf_metric_type }
@jtai
jtai / compile.log
Created November 5, 2014 17:51
nokogiri-1.6.4 compile log
$ cat /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/nokogiri-1.6.4/ext/nokogiri/tmp/x86_64-unknown-linux-gnu/ports/libxml2/2.9.2/compile.log
make all-recursive
make[1]: Entering directory `/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/nokogiri-1.6.4/ext/nokogiri/tmp/x86_64-unknown-linux-gnu/ports/libxml2/2.9.2/libxml2-2.9.2'
Making all in include
make[2]: Entering directory `/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/nokogiri-1.6.4/ext/nokogiri/tmp/x86_64-unknown-linux-gnu/ports/libxml2/2.9.2/libxml2-2.9.2/include'
Making all in libxml
make[3]: Entering directory `/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/nokogiri-1.6.4/ext/nokogiri/tmp/x86_64-unknown-linux-gnu/ports/libxml2/2.9.2/libxml2-2.9.2/include/libxml'
make[3]: Nothing to be done for `all'.
make[3]: Leaving directory `/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/nokogiri-1.6.4/ext/nokogiri/tmp/x86_64-unknown-linux-gnu/ports/libxml2/2.9.2/libxml2-2.9.2/include/libxml'
make[3]: Entering directory `/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/nokogiri-1.6.
@jtai
jtai / stemcell-completion.bash
Created December 13, 2013 18:50
Bash completion for stemcell
_stemcell_role()
{
COMPREPLY=( $( compgen -W '$(ls -1 roles | sed "s/\.rb$//")' -- "$cur" ) )
}
_stemcell()
{
local cur prev words cword
COMPREPLY=()
_get_comp_words_by_ref cur prev words cword
@jtai
jtai / elasticsearch.log
Created June 8, 2013 22:28
Elasticsearch log output when threadpool.index.queue_size is reached
[2013-04-28 19:52:08,944][WARN ][action.index ] [hostname] Failed to perform index on replica [logstash-2013.04.28][5]
org.elasticsearch.transport.RemoteTransportException: [otherhost][inet[/10.0.0.1:9300]][index/replica]
Caused by: org.elasticsearch.common.util.concurrent.EsRejectedExecutionException: rejected execution of [org.elasticsearch.transport.netty.MessageChannelHandler$RequestHandler]
at org.elasticsearch.common.util.concurrent.EsAbortPolicy.rejectedExecution(EsAbortPolicy.java:35)
at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:821)
at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1372)
at org.elasticsearch.transport.netty.MessageChannelHandler.handleRequest(MessageChannelHandler.java:212)
at org.elasticsearch.transport.netty.MessageChannelHandler.messageReceived(MessageChannelHandler.java:111)
at org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleCh
@jtai
jtai / elasticsearch.log
Created June 8, 2013 18:45
Elasticsearch log output when nodes are running different JVM versions
[2013-04-24 00:59:53,539][WARN ][action.index ] [hostname] Failed to perform index on replica [logstash-2013.04.24][3]
org.elasticsearch.transport.RemoteTransportException: Failed to deserialize exception response from stream
Caused by: org.elasticsearch.transport.TransportSerializationException: Failed to deserialize exception response from stream
at org.elasticsearch.transport.netty.MessageChannelHandler.handlerResponseError(MessageChannelHandler.java:171)
at org.elasticsearch.transport.netty.MessageChannelHandler.messageReceived(MessageChannelHandler.java:125)
at org.elasticsearch.common.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:70)
at org.elasticsearch.common.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:560)
at org.elasticsearch.common.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:787)
at org.elasticsear
@jtai
jtai / Descriptors.java
Created April 17, 2013 23:44
Java program to print out open / max file descriptors
import java.lang.management.ManagementFactory;
import java.lang.management.OperatingSystemMXBean;
import java.lang.reflect.Method;
class Descriptors {
public static void main(String [ ] args) {
OperatingSystemMXBean osMxBean = ManagementFactory.getOperatingSystemMXBean();
try {
Method getMaxFileDescriptorCountField = osMxBean.getClass().getDeclaredMethod("getMaxFileDescriptorCount");
Method getOpenFileDescriptorCountField = osMxBean.getClass().getDeclaredMethod("getOpenFileDescriptorCount");
@jtai
jtai / parser.php
Created March 27, 2012 03:53
Cache-Control header parser
<?php
class Parser
{
public function parse($string)
{
$this->string = trim($string);
$directives = array();
@jtai
jtai / escape.js
Created February 8, 2012 21:58
Escape lucene special chars
string.replace(/[+\-!(){}\[\]^"~*?:\\]|&&|\bAND\b|\|\||\bOR\b/ig, ' ').replace(/\s+/g, ' ').trim();
@jtai
jtai / gearman.ini
Created January 19, 2012 18:24
RPM packaging for gearman 1.0.1 PECL extension based on IUS php53u-pecl-apc spec file
extension=gearman.so
@jtai
jtai / gearmand.spec.diff
Created January 19, 2012 01:50
Update gearmand.spec for Gearman 0.27
--- gearmand.spec 2012-01-18 20:02:44.184424387 -0500
+++ gearmand.spec 2012-01-18 20:42:24.221426555 -0500
@@ -22,8 +22,8 @@
%endif
Name: gearmand
-Version: 0.14
-Release: 3%{?dist}
+Version: 0.27
+Release: 1%{?dist}