Skip to content

Instantly share code, notes, and snippets.

View danslimmon's full-sized avatar

Dan Slimmon danslimmon

View GitHub Profile
@danslimmon
danslimmon / logstash_postfix.conf
Last active July 30, 2018 21:32
My logstash config for postfix logs
filter {
# Capture all the generic syslog stuff and populate @timestamp
if [type] == "postfix" {
grok {
match => [ "message", "%{SYSLOGBASE} %{GREEDYDATA:_syslog_payload}" ]
singles => true
}
# Postfix pads single-digit numbers with spaces (WHYYYYY)
mutate { gsub => [ "timestamp", " ", " 0" ] }
date { match => [ "timestamp", "MMM dd HH:mm:ss"] }
@danslimmon
danslimmon / cql_client.py
Last active March 7, 2018 04:07
Using Python's cql module, connect to a Cassandra server over SSL
from thrift.transport import TSSLSocket
from thrift.transport import TTransport
import cql
sock = TSSLSocket.TSSLSocket(host='cass.example.com', port=9160, ca_certs='/path/to/ca_certs.pem')
trans = TTransport.TFramedTransport(sock)
conn = cql.connect('cass.example.com', 9160, 'keyspace', user='username', password='password', transport=trans, cql_version='3.0.0')
:~
:=
:_#
:,
:!
:!!
:.
:@
:@@
:#!
@danslimmon
danslimmon / read_opentsdb.r
Last active February 22, 2017 21:02
Reads data from OpenTSDB into an R data frame.
# Loads data from OpenTSDB.
#
# `server.url`: The URL of the OpenTSDB server (e.g. 'http://tsdb.example.com')
# `metrics`: List of strings specifying the metrics to pull (e.g.
# c("avg:web.cpu.user{host=*}", "sum:web.requests{type=login}")
# )
# `start.dt`: How far to go back in the time series, in any format OpenTSDB
# (e.g. "4h-ago")
# `end.dt`: Where to end the results (defaults to now)
# `datify`: Whether to convert timestamps to POSIXlt objects (defaults to TRUE)
Brieonce
Celine Dijon
Cheeses & Mary Chain
Lil Kimchi
Iggy Popsicle
Modest Mousse
Rigatoni Toni Tone
S'Morrissey
Jay Ziti
Sonny and Pear
$ dig happy.newyear
; <<>> DiG 9.8.3-P1 <<>> happy.newyear
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 59466
#!/usr/bin/python
import random
import re
import sys
options = {}
class RollSpec:
def __init__(self, spec):
#!yaml|gpg
myapp:
username: app_user
password: |
-----BEGIN PGP MESSAGE-----
...
-----END PGP MESSAGE-----
myapp:
username: app_user
password: hunter2