Skip to content

Instantly share code, notes, and snippets.

View JustinAzoff's full-sized avatar

Justin JustinAzoff

View GitHub Profile
@JustinAzoff
JustinAzoff / gen_regex.py
Created November 8, 2011 20:28
Generate a case insensitive regex for bro
#!/usr/bin/env python
import sys
phrase = sys.argv[1]
parts = [l + l.upper() for l in phrase.lower()]
regex = ''.join(['[%s]' % part for part in parts])
print regex
#!/usr/bin/env python
# Author: Justin Lintz
# usage: ./focal_length dir
# Requiresments: dcraw http://www.cybercom.net/~dcoffin/dcraw/
import os
import sys
from subprocess import Popen, PIPE
from operator import itemgetter
DCRAW='dcraw' # or /path/to/dcraw
class approx::server {
package {'approx':
ensure => latest;
}
config_file { "/etc/approx/approx.conf":
source => "puppet://$servername/approx/approx.conf",
require => Package['approx'],
}
@JustinAzoff
JustinAzoff / solr_searcher.py
Created March 24, 2009 02:35
minimal client for the solr REST api
from urllib2 import urlopen
from urllib import urlencode
import simplejson
class SolrSearcher:
def __init__(self, url):
self.url = url
def search(self, q, **kwargs):
args = {'q': q, 'wt': 'json'}