Skip to content

Instantly share code, notes, and snippets.

:octocat:
Being Awesome

Tim (Alaric) Hartmann tfhartmann

:octocat:
Being Awesome
Block or report user

Report or block tfhartmann

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@tfhartmann
tfhartmann / cocoa_keypress_monitor.py
Created Dec 1, 2014
cocoa_keypress_monitor.py with logging to local example.log file
View cocoa_keypress_monitor.py
#!/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 Sep 14, 2016
building hhvm rpm
View hhvm_rpm.md
View nagios_stub.pp
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 Feb 12, 2014
Puppet Definition for perl module packages
View package_define.pp
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 Feb 12, 2014
Example script on how to poll a AWS SQS Queue and pull off messages
View sqs.py
#!//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 Feb 12, 2014
Example script on how to publish a message to an AWS SNS Queue
View sns.py
#!//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>'
View nepho_nosetests.md
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 Oct 24, 2013
Boston Openstack Meetup notes - Whats New in Havana
View gist:7137760

Whats new in Havana

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

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

View splunktalk_nagios_reports.md
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 Sep 25, 2013
Splunk Searches from Talk
View splunktalk_trackamac.md

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
You can’t perform that action at this time.