Skip to content

Instantly share code, notes, and snippets.

View gene1wood's full-sized avatar
🎩

Gene Wood gene1wood

🎩
View GitHub Profile
@gene1wood
gene1wood / get_all_instances_all_regions.py
Last active August 29, 2015 14:02
Fetch all instances across all regions
import boto.ec2
import sys
from pprint import pprint
all_regions = [x.name for x in
boto.ec2.connect_to_region('us-east-1').get_all_regions()]
instances=[]
for region in all_regions:
instances.extend(boto.ec2.connect_to_region(region).get_only_instances())
@gene1wood
gene1wood / 0001-Adding-X-header-contents-to-the-body-of-the-email-in.patch
Last active August 29, 2015 14:03
Patch to the Bugzilla email template to embed X- headers in a non-displaying div
From ffd15b7565277569d6bdf57f6493841dabe6a412 Mon Sep 17 00:00:00 2001
From: Gene Wood <gene_wood@cementhorizon.com>
Date: Thu, 3 Jul 2014 09:39:37 -0700
Subject: [PATCH] Adding X- header contents to the body of the email in a
non-displaying div to enable easier Gmail filtering
---
.../BMO/template/en/default/email/bugmail.html.tmpl | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
@gene1wood
gene1wood / send_email.py
Last active August 29, 2015 14:04
Simple example of how to send email in Python through authenticated SMTP
fromaddr = 'me@example.com'
toaddr = 'you@example.org'
servername = 'smtp.example.com'
username = 'username'
password = 'password'
import smtplib
import time
server = smtplib.SMTP(servername, 25)
server.set_debuglevel(1)
@gene1wood
gene1wood / gist:9673278c99440a5a1ac8
Created July 25, 2014 20:42
How to build NCPA Nagios Cross Platform Agent RPM from source
# Find your OS version https://iuscommunity.org/pages/Repos.html#release-packages
sudo yum install -y http://dl.iuscommunity.org/pub/ius/stable/CentOS/6/x86_64/ius-release-1.0-11.ius.centos6.noarch.rpm
sudo yum install -y python27 python27-devel python27-pip openssl-devel
sudo pip2.7 install cx_Freeze
git clone https://github.com/NagiosEnterprises/ncpa.git
cd ncpa/build
make build_rpm
@gene1wood
gene1wood / change-default-subsonic-view-from-random-to-new.sh
Created August 11, 2014 17:11
This will patch Subsonic 4.9 to change the default view from Random to Recently Added
mkdir workspace
cd workspace
sudo cp /usr/share/subsonic/subsonic.war /usr/share/subsonic/subsonic.war.orig
unzip /usr/share/subsonic/subsonic.war
dos2unix WEB-INF/jsp/top.jsp # These dos2unix and unix2dos steps are needed because the files have DOS
dos2unix WEB-INF/jsp/index.jsp # line endings and the patches, if copy/pasted have UNIX line endings
cat > change-default-view-to-newest.patch <<'End-of-message'
diff -ru orig/WEB-INF/jsp/index.jsp new/WEB-INF/jsp/index.jsp
--- orig/WEB-INF/jsp/index.jsp 2014-01-23 23:07:04.000000000 -0800
+++ new/WEB-INF/jsp/index.jsp 2014-08-11 09:59:33.000000000 -0700
@gene1wood
gene1wood / create_security_monkey_trusting_role.py
Last active August 29, 2015 14:07
Code snipit to create the Security Monkey trusting IAM role
#!/usr/bin/env python
# Set this to the ARN of the trusted account role
trusted_account_role_arn="arn:aws:iam::123456789012:role/SecurityMonkeyInstanceProfile"
import boto.iam
conn_iam = boto.iam.connect_to_region('universal')
role_name='SecurityMonkey'
assume_role_policy_document = '''{
"Version":"2012-10-17",
@gene1wood
gene1wood / create_security_monkey_trusted_role.py
Last active August 29, 2015 14:07
Code snipit to create the Security Monkey trusted IAM role
import boto.iam
conn_iam = boto.iam.connect_to_region('universal')
role_name='SecurityMonkeyInstanceProfile'
assume_role_policy_document = '''{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "",
"Effect": "Allow",
"Principal": {
@gene1wood
gene1wood / hash_mysql_password.sh
Created October 30, 2014 22:28
One line python command to generate MySQL hashed password
echo "mypassword" | python -c "import hashlib; import sys; m = hashlib.sha1(); m.update(sys.stdin.read()); n = hashlib.sha1(); n.update(m.digest()) ; print('*' + n.hexdigest().upper())"
@gene1wood
gene1wood / auto-select-private-in-google-calendar-item-NOT-WORKING.js
Created December 15, 2014 23:59
NOT WORKING : Auto Select Private Visibility for Google Calendar Items
// ==UserScript==
// @name Auto Select Private Visibility for Google Calendar Items
// @namespace http://cs.cementhorizon.com
// @description Auto Select Private Visibility for Google Calendar Items
// @include https://www.google.com/calendar/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js
// @version 1
// @grant none
// ==/UserScript==
@gene1wood
gene1wood / one-page-bootstrap.html
Created December 18, 2014 05:43
One page Bootstrap using CDN delivered js and css
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Title Goes Here</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">