Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am endzyme on github.
  • I am nickhuanca (https://keybase.io/nickhuanca) on keybase.
  • I have a public key ASB1ieqGkiWH4joJSuPpWS-kKShDiPvQNRptjxjkUvpZdgo

To claim this, I am signing this object:

@endzyme
endzyme / expected input
Created August 25, 2017 19:41
gross firehose importer for terraform
[
{
"DeliveryStreamDescription": {
"HasMoreDestinations": false,
"VersionId": "1",
"CreateTimestamp": 12345678.047,
"DeliveryStreamARN": "arn:aws:firehose:us-east-1:1234567:deliverystream/some_name",
"DeliveryStreamStatus": "ACTIVE",
"DeliveryStreamName": "some_name",
"Destinations": [
@endzyme
endzyme / iam_to_tf_policy_toc.py
Created July 11, 2017 15:54
iam to terraform policy document converter
#!/usr/bin/env python3
import json,sys
json_files = sys.argv[1:]
if len(json_files) < 1:
print("Usage: <script>.py <jsonfile1> <jsonfile2>...")
exit(1)
for json_file in json_files:
@endzyme
endzyme / rake_semaphore.rb
Last active March 31, 2016 04:06
very hacky rake semaphore to enable multithreading data migrations in rake tasks
namespace :semaphore do
desc "Basic Semaphore Task"
task :my_task_name => :environment do
# Build list of running threads
@threads = []
@max_threads = 3
# Setup Rails Config to allow concurrency (prelaoding env for models)
Rails.configuration.threadsafe!
Rails.configuration.dependency_loading = true
#!/bin/bash
# Quick Dry Run Example Bash
dry=$1
function run () {
if [ ! -z "$dry" ]; then
echo "WOULD HAVE $@"
else
$@
fi
}
@endzyme
endzyme / install_jenkins_plugins.sh
Last active March 21, 2016 21:23
A quick script to cycle through exsiting plugins in jenkins and install any new ones defined in the script.
#!/bin/bash
#
# Author: Nick Huanca
#
# Basic assumptions:
# - This script is run from cwd: /var/lib/jenkins/plugins
# - You have wget
#
# Known Issues:
# Any versions with "1.2-SNAPSHOT (private blah blah blah)" appended
#!/usr/bin/env ruby
require 'yaml'
exit_code = 0
if ARGV.length != 1
puts "Usage: ruby validate_ymls.rb directory_absolute_path"
exit!
end
@endzyme
endzyme / C:\Program Files (x86)\Puppet Labs\Puppet\facter\lib\facter\some_fact.rb
Created August 5, 2013 21:40
Custom Facts for Windows in Puppet on the local File System
Facter.add("some_fact") do
setcode do
"return some string"
end
end
@endzyme
endzyme / f5_lb_soap_savon.md
Created June 11, 2013 01:01
F5 Load Balancer SOAP API Interactions with Savon

SOAP Calls

Get Heartbeat String

Connection

soap = 
  Savon.client do |s|
    s.wsdl "https://#{ipaddress}/iControl/iControlPortal.cgi?WSDL=LocalLB.Monitor"
    s.basic_auth [user, password]
    s.ssl_verify_mode :none
    s.endpoint "https://#{ipaddress}/iControl/iControlPortal.cgi"
@endzyme
endzyme / progress_bars.html.erb
Created April 30, 2013 16:35
Progress bars with twitter and state machines
<% items = @compute_resource.package.package_type.workflow %>
<% items.delete(:adding_to_network) if @compute_resource.load_balancers.empty? %>
<% count = items.count %>
<% state_index = items.index @compute_resource.machine_state.to_sym %>
<% state = @compute_resource.machine_state %>
<% found = false %>
<div class="row">
<% items.each do |e| %>
<div class="span2 pagination-centered">
<%= e.to_s.titleize %>