Skip to content

Instantly share code, notes, and snippets.

View tfhartmann's full-sized avatar
:octocat:
Being Awesome

Alaric Hartmann tfhartmann

:octocat:
Being Awesome
View GitHub Profile
@tfhartmann
tfhartmann / cocoa_keypress_monitor.py
Created December 1, 2014 21:33
cocoa_keypress_monitor.py with logging to local example.log file
#!/usr/bin/env python
# cocoa_keypress_monitor.py by Bjarte Johansen is licensed under a
# License: http://ljos.mit-license.org/
from AppKit import NSApplication, NSApp
from Foundation import NSObject, NSLog
from Cocoa import NSEvent, NSKeyDownMask
from PyObjCTools import AppHelper
import logging
@tfhartmann
tfhartmann / hhvm_rpm.md
Last active September 14, 2016 06:42
building hhvm rpm
@tfhartmann
tfhartmann / nagios_stub.pp
Last active August 29, 2015 14:05
Nagios Puppet
resources { 'nagios_service': purge => true }
file {
'/etc/nagios/nagios_command.cfg' : ensure => present;
'/etc/nagios/nagios_contact.cfg' : ensure => present;
'/etc/nagios/nagios_contactgroup.cfg' : ensure => present;
'/etc/nagios/nagios_host.cfg' : ensure => present;
'/etc/nagios/nagios_hostgroup.cfg' : ensure => present;
'/etc/nagios/nagios_servicegroup.cfg' : ensure => present;
'/etc/nagios/nagios_service.cfg' : ensure => present;
@tfhartmann
tfhartmann / package_define.pp
Created February 12, 2014 17:59
Puppet Definition for perl module packages
So first I create a definition in a manifest called perl_modules.pp in the root of my module like this:
define radiator::perl_modules() {
package { "perl-$name": ensure => 'installed', before => Package['Radiator'] }
}
Then call the definition in packages.pp
@tfhartmann
tfhartmann / sqs.py
Created February 12, 2014 14:02
Example script on how to poll a AWS SQS Queue and pull off messages
#!//opt/boxen/homebrew/bin/python
import boto.sqs
from boto.sqs.message import RawMessage
import json
import time
import requests
REGION = 'us-west-2'
@tfhartmann
tfhartmann / sns.py
Created February 12, 2014 14:00
Example script on how to publish a message to an AWS SNS Queue
#!//opt/boxen/homebrew/bin/python
import boto.sns
import json
REGION = 'us-west-2'
TOPIC = '<ARN>'
URL = '<Body of Message in this example I used a url>'
@tfhartmann
tfhartmann / nepho_nosetests.md
Last active December 28, 2015 19:49
nepho_nosetests
from cement.core import handler, hook, foundation
from cement.utils import test
from nepho import cli
from nepho.cli.base import Nepho

class MyTestApp(Nepho):
    class Meta:
        # Load the base Nepho cement controller
        app = cli.base.Nepho()
@tfhartmann
tfhartmann / gist:7137760
Created October 24, 2013 13:55
Boston Openstack Meetup notes - Whats New in Havana

Whats new in Havana

Networking Component - Neutron (Cisco) | January -> Zero to current knowledge

Cisco Nexus driver FireWall as a Service … waa?? FWaaS demo

index=nagios (nagiosevent="SERVICE NOTIFICATION" ) OR (nagiosevent="HOST NOTIFICATION" ) ( user_id=$userid$)|lookup local=t nagios-hostgroupmembers host_name AS src_host | convert ctime(_time) as time | eval Name=coalesce(name,hostnotification) |transaction delim=
src_host, nagiosevent | table time,eventcount,src_host,hostgroup,user_id,Name,reason,nagiosevent
@tfhartmann
tfhartmann / splunktalk_trackamac.md
Created September 25, 2013 14:34
Splunk Searches from Talk

I love this search, it's got a subsearch, from an input file, lookup, eval.. and a field extraction, it's got it all!

index=dhcp eventtype="dhcpd_server" NOT DHCPEXPIRE [| inputlookup mac_tracking.csv | fields mac ] | rex field=_raw "DHCP(ACK on|REQUEST for) (?<clientip>(?<!\d)(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})(?!\d)) (to|for)" | rename clientip as host | lookup huis host | eval Link="http://map.harvard.edu/?bld=".bld_root | rename  huid as HUID, mac as "MAC Address", mac_status as "Laptop Status", match_string as "Location", ip as "IP Address", src_translated_ip as "External IP Address" | transaction _time,mac| table _time, HUID, "Location", "MAC Address", "IP Address", "External IP Address","Laptop Status", Link