Skip to content

Instantly share code, notes, and snippets.

View maxmanders's full-sized avatar

Max Manders maxmanders

View GitHub Profile
#!/usr/bin/env python
import pprint
import dns.resolver
hostname = "hostname here"
resolver = dns.resolver.Resolver()
resolved_ip_list = []
answers = resolver.query(hostname, 'A')
for rdata in answers:
@maxmanders
maxmanders / gist:4706971
Last active December 12, 2015 03:28
Enumerate Devices in a Zenoss deviceClass
#!/usr/bin/env python
import pprint
import Globals
from Products.ZenUtils.ZenScriptBase import ZenScriptBase
from transaction import commit
dmd = ZenScriptBase(connect=True).dmd
find = dmd.Devices.findDevice
@maxmanders
maxmanders / gist:4529353
Created January 14, 2013 11:09
Zenoss 4.2 Collector Problem
1. Installed using auto deploy tool
2. Stopped Zenoss
3. touch /opt/zenoss/etc/DAEMONS_TXT_ONLY
4. Create /opt/zenoss/etc/daemons.txt with:
zenping
zensyslog
zenstatus
zentrap
zenmodeler
zenrender
59 current_account = ''
60 case line
61 when /^\[(.*)\]$/
62 account_name = (line.match(/^\[(.*)\]$/).captures)[0]
63 p 'account_name = ' + account_name
64 current_account = account_name
65 p 'current_account = ' + current_account
66 @accounts[current_account] = {} unless @accounts.has_key? current_account
67 when /^aws_access_key_id=.*$/
68 aws_access_key_id = (line.match(/^aws_access_key_id=(.*)$/).captures)[0]
@maxmanders
maxmanders / gen-iam-cert.sh
Created November 23, 2012 14:46
Generate AWS IAM Certificate
#!/bin/bash
outdir=$1
if [ -z "${outdir}" ]; then
outdir=/tmp/
fi
cd ${outdir}
openssl genrsa -out pk-amazon.pem 2048
@maxmanders
maxmanders / Gemfile
Created November 18, 2012 10:19
Ruby environment
source 'http://rubygems.org'
gem 'rails', '3.2.9'
gem 'sqlite3'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
@maxmanders
maxmanders / gist:4065239
Created November 13, 2012 11:05
Delay start of NSSM created service until the end of a Chef run.
nssm_service "chef-client" do
application "C:/opscode/chef/embedded/bin/ruby.exe"
options "C:/opscode/chef/bin/chef-client -C C:/chef/client.rb -i 1800 -s 120"
end
service "chef-client" do
action :nothing
only_if { WMI::Win32_Service.find(:all).collect{|s| s.name}.include?("chef-client") }
end
@maxmanders
maxmanders / php_fatal_exception_handler.php
Created October 5, 2012 13:47
PHP Fatal Exception Handler
/*
* Somewhere in their bootstrap code, index.php or wherever, we'd register a shutdown
* callback that is executed when PHP completes serving the request (whether successfully,
* or in the event of a fatal error.
*/
register_shutdown_function('requestShutdown');
function requestShutdown() {
$error = error_get_last();
O2: Just a little reminder. We're automatically giving you 10% of July's subscription back on your September bill. Find out more at http://blog.o2.co.uk
➜ django-ukgeocode git:(develop) ✗ sudo gem install ruby-shadow
Password:
Building native extensions. This could take a while...
ERROR: Error installing ruby-shadow:
ERROR: Failed to build gem native extension.
/Users/maxmanders/.rvm/rubies/ruby-1.9.2-p320/bin/ruby extconf.rb
checking for getspent() in -lshadow... no
checking for getspent()... no
checking for fgetspent()... no