Skip to content

Instantly share code, notes, and snippets.

View chalfant's full-sized avatar

Chris Chalfant chalfant

View GitHub Profile
@chalfant
chalfant / setup_monitoring.rb
Created June 7, 2016 12:57
Create monitoring metric filters and alarms for CIS Benchmarks for AWS
#!/usr/bin/env ruby
# Implement CIS Benchmarks for AWS Section 3.x
# Details on each benchmark from https://benchmarks.cisecurity.org/downloads/show-single/?file=awsfoundations.100
# name should be in camelcase since we'll use it for filter and alarm names
filters = [
{
benchmark: '3.1',
@chalfant
chalfant / account_setup.json
Created December 9, 2015 01:37
Use this CloudFormation to setup a new AWS account for CloudTrail, billing reports, and cross-account delegated IAM access
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Creates resources for brand new aws account",
"Parameters": {
"AccountName": {
"Description": "Name for AWS account",
"Type": "String"
},
"AccountId": {
"Description": "Numeric AWS Account ID of new account",
@chalfant
chalfant / retroarch.cfg
Created May 31, 2015 16:00
Master config for RetroPie using controller from http://www.nes30.com/
## Skeleton config file for RetroArch
# Save all save files (*.srm) to this directory. This includes related files like .bsv, .rtc, .psrm, etc ...
# This will be overridden by explicit command line options.
# savefile_directory =
# Save all save states (*.state) to this directory.
# This will be overridden by explicit command line options.
# savestate_directory =
#!/usr/bin/env ruby
# obtain api key from: http://openweathermap.org/API
require 'librato/metrics'
require 'open_weather'
FISHERS_CITY_ID = 4257494
response = OpenWeather::Current.city_id(FISHERS_CITY_ID, 'APPID' => ENV['OPENWEATHER_APPID'])
outside_temp_k = response.parsed_response['main']['temp']
outside_temp_f = (outside_temp_k - 273.15) * 9 / 5 + 32
#include <avr/pgmspace.h>
int A_pin = 2; // Data pin for rows selection A
int B_pin = 3; // Data pin for rows selection B
int C_pin = 4; // Data pin for rows selection C
int D_pin = 5; // Data pin for rows selection D
int G1_pin = 9; //6; //green leds for uppwer rows
int G2_pin = 10; //7; //green leds for lower rows
@chalfant
chalfant / sure_6416.pde
Created October 22, 2013 23:35
This is my attempt at re-writing the code at http://www.82smugglers.com/misc/_6432_text.pde to work with the 6416 display.
#include <avr/pgmspace.h>
/* This is my attempt at re-writing the code at
* http://www.82smugglers.com/misc/_6432_text.pde
* to work with the 6416 display.
*/
int A_pin = 2; // Data pin for rows selection A
int B_pin = 3; // Data pin for rows selection B
int C_pin = 4; // Data pin for rows selection C
@chalfant
chalfant / cfn.json
Last active December 21, 2015 19:39
IAM Role, Policy and Instance Profile for Keyless Entry
"InstanceRole": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {
"Statement": [ {
"Effect": "Allow",
"Principal": {
"Service": [ "ec2.amazonaws.com" ]
},
"Action": [ "sts:AssumeRole" ]
@chalfant
chalfant / dropbox_cfn_init.json
Last active December 20, 2015 18:29
CloudFormation cfn-init directive to download dropbox installer to a Windows instance
"AWS::CloudFormation::Init": {
"config": {
"files": {
"C:\\Bootstrap\\apps\\dropbox.exe": {
"source": "http://www.dropbox.com/download?plat=win"
},
}
}
}
@chalfant
chalfant / get_windows_password.rb
Created August 3, 2013 18:42
Ruby script to get and decrypt a Windows instance's Administrator password.
#!/usr/bin/env ruby
require 'optparse'
require 'ostruct'
require 'aws-sdk'
require 'base64'
require 'openssl'
class Passworder
def initialize(args)
parse_opts(args)