Skip to content

Instantly share code, notes, and snippets.

Avatar
🔨
🦥

Kyle Brandt kylebrandt

🔨
🦥
View GitHub Profile
View gist:89dc754c658340e87d97
package main
import (
"fmt"
"time"
)
type Meeting struct {
Who []Person
When time.Time
@kylebrandt
kylebrandt / gist:92671689da33c3075326
Last active Aug 29, 2015
Convert Windows 100NS Epoch (Timestamp_Sys100NS) To a Unix Epoch
View gist:92671689da33c3075326
func TSys100NStoEpoch(nsec uint64) int64 {
//nsec is really 100*NS
//Got this constant from https://golang.org/src/pkg/syscall/ztypes_windows.go, not sure where it comes from, but seems to work
nsec -= 116444736000000000
seconds := nsec / 1e7
return int64(seconds)
}
View gist:b2906d990d0e762ad87e
package main
import (
"bytes"
"encoding/json"
"flag"
"io"
"log"
"net"
"os"
@kylebrandt
kylebrandt / another.py
Last active Aug 29, 2015
No promises...
View another.py
#!/usr/bin/python
#Parse Nginix Logs and insert results into either MySQL or SQLite
#Then run various reports on the data
#Kyle Brandt 2010
import re, optparse
import cProfile
from datetime import datetime
from time import time
from sqlalchemy import create_engine
@kylebrandt
kylebrandt / gist:04c0658828e616b5d8c5
Created Feb 29, 2016
Cloudera Not Default HBase Settings
View gist:04c0658828e616b5d8c5
zookeeper.session.timeout: 600000
HBase Service Advanced Configuration Snippet (Safety Valve) for hbase-site.xml:
<property>
<name>hbase.snapshot.enabled</name>
<value>true</value>
</property>
Java Configuration Options for HBase RegionServer:
-XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:-ResizePLAB -XX:ParallelGCThreads=17 -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintAdaptiveSizePolicy
@kylebrandt
kylebrandt / gist:89a98f30680b799a6317
Created Feb 29, 2016
Cloudera Non-Default HDFS Settings
View gist:89a98f30680b799a6317
io.compression.codecs:
org.apache.hadoop.io.compress.DefaultCodec
com.hadoop.compression.lzo.LzoCodec
com.hadoop.compression.lzo.LzopCodec
org.apache.hadoop.io.compress.GzipCodec
org.apache.hadoop.io.compress.BZip2Codec
org.apache.hadoop.io.compress.DeflateCodec
org.apache.hadoop.io.compress.SnappyCodec
org.apache.hadoop.io.compress.Lz4Codec
@kylebrandt
kylebrandt / gist:85218ae078e57a8d3088
Created Feb 29, 2016
Cloudera zookeeper Non-Defaults
View gist:85218ae078e57a8d3088
tickTime: 30000
maxSessionTimeout: 600000
View gist:14acacd867d67382629a
/opt/tsdbrelay/tsdbrelay -b ny-bosun01:8080 -t localhost:4242 -l 0.0.0.0:5252 -denormalize=os.cpu__host,os.mem.used__host,os.net.bytes__host,os.net.bond.bytes__host,os.net.other.bytes__host,os.net.tunnel.bytes__host,os.net.virtual.bytes__host -r co-bosun:80 -redis ny-bosun01:6389 -db 0
@kylebrandt
kylebrandt / gist:91bd77288bdd526fa7df
Last active Mar 3, 2016
Bosun Elastic Expression Query Example, Per Minute
View gist:91bd77288bdd526fa7df
$minute = 5
$bucketSize = "${minute}m"
$index = esls("logstash")
$keyField = "logsource"
$filter = esquery("message", "scollector")
escount($index, $keyField, $filter, $bucketSize, "1d", "") / $minute
View gist:a63fbf1d36f6d4f6cc100383cf140906
$metric = "sum:5m-avg:rate{counter,,1}:__ny-nexus02.os.net.bytes{host=ny-nexus02,iname=Ethernet3/1}"
$monthToDate = mtod(-4)
$commit = 150
$mtdAgo = epoch()-$monthToDate
$q = q($metric, tod($mtdAgo), "") * 8
$mtdAgo > d("1d") && percentile($q, .95) / 1e6 > $commit*.70
You can’t perform that action at this time.