Skip to content

Instantly share code, notes, and snippets.

@johntdyer
johntdyer / Benchmark.txt
Last active August 29, 2015 14:21
Heka LPEG grammar to parse JVM GC Log ( http://lpeg.trink.com/share/2229225886834348027 )
Benchmark
samples: 10000
seconds per match: 7.084e-06
max memory (bytes): 220474
max Lua instructions: 1188
--[[
# Install dependencies.
brew update
brew install lua
brew install luarocks
brew install blueutil
wget https://github.com/sdegutis/mjolnir/releases/download/0.4.3/Mjolnir-0.4.3.tgz
mkdir -p ~/.luarocks
mkdir -p ~/.mjolnir/
echo 'rocks_servers = { "http://rocks.moonscript.org" }' > ~/.luarocks/config.lua

Keybase proof

I hereby claim:

  • I am johntdyer on github.
  • I am johntdyer (https://keybase.io/johntdyer) on keybase.
  • I have a public key whose fingerprint is A38F E03F 4C69 C523 6A00 9A12 7552 1842 8EB2 B8C3

To claim this, I am signing this object:

package main
import (
"crypto/tls"
"crypto/x509"
"flag"
"io/ioutil"
"log"
"net/http"
)
@johntdyer
johntdyer / slac.rb
Last active August 29, 2015 14:11
Sensu slack extension
#!/usr/bin/env ruby
# Sends events to slack for wonderful chatty notifications
#
# This extension requires the slack gem
#
# The reason I wrote this instead of using the normal slack handler, is that with Flapjack
# all events are handled unless you do crazy filtering stuff. Also with a large number of events
# and checks the sensu server can get overloaded with forking stuff. So anyway, slack extension :)
#

Using the nc command you can scan a port or a range of ports to verify whether a UDP port is open and able to receive traffic.

This first command will scan all of the UDP ports from 1 to 65535 and add the results to a text file:

$ nc -vnzu server.ip.address.here 1-65535 > udp-scan-results.txt

This merely tells you that the UDP ports are open and receive traffic.

Perhaps a more revealing test would be to actually transfer a file using UDP.

/*/logs
/*/reports
*.tgz
*.tar
*.cdr.json
*.cdr.csv
*.txt.tgz
*.tar.gz
*.pdf
*.exe
Request timeout for icmp_seq 4462
Request timeout for icmp_seq 4463
Request timeout for icmp_seq 4464
Request timeout for icmp_seq 4465
Request timeout for icmp_seq 4466
Request timeout for icmp_seq 4467
Request timeout for icmp_seq 4468
Request timeout for icmp_seq 4469
Request timeout for icmp_seq 4470
64 bytes from 74.125.196.101: icmp_seq=4454 ttl=44 time=17741.454 ms
@johntdyer
johntdyer / support_data_collector.sh
Created October 1, 2014 17:59
support_data_collector
#!/bin/bash
# create working dir
mkdir /tmp/report
# archive some basic files
for h in /proc/cpuinfo /etc/redhat-release /opt/voxeo/prism/conf/version.xml /opt/voxeo/prism/conf/capacity.json; do
cat h > /tmp/report/$h.report
done
@johntdyer
johntdyer / com.tropo.sensu.plist
Created October 1, 2014 12:12
com.tropo.sensu.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC -//Apple//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd>
<plist version="1.0">
<dict>
<key>Label</key><string>com.tropo.sensu</string>
<key>ProgramArguments</key>
<array>
<string>/var/root/.rvm/bin/launchctl_sensu-client</string>
<string>-c/var/root/etc/sensu/config.json</string>
<string>-d/var/root/etc/sensu/conf.d/</string>