Skip to content

Instantly share code, notes, and snippets.

View benbramley's full-sized avatar

Ben Bramley benbramley

View GitHub Profile
@benbramley
benbramley / fuzzylookup.py
Created June 29, 2015 12:00
Fuzzy lookup in Splunk
import csv,sys
from fuzzywuzzy import fuzz
LOOKUPCSV = 'somelookup.csv'
RATIOTHRESHOLD = 80
def output_results(results, mvdelim = '\n', output = sys.stdout):
"""Given a list of dictionaries, each representing
a single result, and an optional list of fields,
output those results to stdout for consumption by the
@benbramley
benbramley / xmlfile.py
Created March 20, 2015 05:16
Ansible lookup plugin for XML files
from ansible import utils, errors
import os
import xml.etree.ElementTree as etree
class LookupModule(object):
def __init__(self, basedir=None, **kwargs):
self.basedir = basedir
def tostr(self, node):
@benbramley
benbramley / prettytable.py
Created January 13, 2015 07:33
PrettyTable makes it easy to display data in a nice and neat but non-graphical format that you can use in command line programs, automatically generated emails, etc.
#!/usr/bin/env python
#
# Copyright (c) 2009, Luke Maurits <luke@maurits.id.au>
# All rights reserved.
# With contributions from:
# * Chris Clark
# * Klein Stephane
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@benbramley
benbramley / splunksearch.py
Created January 13, 2015 07:28
Execute adhoc Splunk Searches in Pythonista
import urllib2
import urllib
from xml.dom import minidom
import re
import csv
import prettytable
import StringIO
import console
u='[SPLUNK USER HERE]'
@benbramley
benbramley / aiaInstrument.xml
Created July 11, 2013 14:00
OpTier Oracle AIA Instrumentation
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright(c) Ecetera -->
<instrumentation xmlns="http://www.optier.com/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.optier.com/namespace ../../conf/OpTierPluginInstrument.xsd">
<process>
<class>
<name>oracle.tip.adapter.jms.inbound.JmsConsumer</name>
<additionalPath>${corefirst.home}/tierext/lib/cf-otti.jar;${corefirst.home}/tierext/lib/cf-sdk-wrapper.jar</additionalPath>
<static>false</static>