Skip to content

Instantly share code, notes, and snippets.

def qaCatalinaBase = '/opt/apache-tomcat-8-qa'
def qaHttpPort = 8081
def stagingCatalinaBase = '/opt/apache-tomcat-8-staging'
def stagingHttpPort = 8082
def perfsCatalinaBase = '/opt/apache-tomcat-8-perfs'
def perfsHttpPort = 8084
def productionCatalinaBase = '/opt/apache-tomcat-8-production'
@ashayh
ashayh / foreman_vagrant.sh
Created June 13, 2015 20:05
foreman install in vagrant
#!/bin/bash
if pgrep -f "/usr/share/foreman" 2> /dev/null
then
echo "Foreman appears to already be installed. Exiting..."
else
sudo mkdir -p /etc/puppet
sudo touch /etc/puppet/autosign.conf
package main
import (
"fmt"
"os"
"time"
"github.com/gdamore/mangos"
"github.com/gdamore/mangos/protocol/pub"
"github.com/gdamore/mangos/protocol/sub"
"github.com/gdamore/mangos/transport/ipc"
echo "Flipping tables! (╯°□°)╯︵ ┻━┻"
num_rules=3
real=3 # exposed to the ELB as port 443
test=4 # used to install test certs for domain verification
health=5 # used by the ELB healthcheck
blue_prefix=855
green_prefix=866
@ashayh
ashayh / create-repo.rb
Last active August 29, 2015 14:21 — forked from hh/create-repo.rb
require 'rubygems'
require 'open-uri'
require 'nokogiri'
require 'net/http'
omnitruck_host='opscode-omnitruck-release.s3.amazonaws.com'
omnitruck_url="http://#{omnitruck_host}/"
doc = Nokogiri::HTML(open(omnitruck_url))
rpm_list = doc.xpath('//key/text()[contains(.,"el/")]').map(&:text)
> require 'rubygems'
> require 'ohai'
> o = Ohai::System.new
> o.all_plugins
> o["hostname"]
cat list_aws_events.rb
require 'fog' # gem install fog
aws = Fog::Compute::AWS.new
status = aws.describe_instance_status.body["instanceStatusSet"]
events = {}
status.each do |st|
if st["eventsSet"].size > 0
@ashayh
ashayh / search_iam_key.rb
Last active August 29, 2015 14:16
use ruby fog to search which users owns an IAM key
#!/usr/bin/env ruby
# If you have many IAM users, it's not easy to find which user
# owns a particular IAM key from the console.
# This script can be run with the first argument as the access key id.
require 'rubygems'
require 'ap' # gem install awesome_print
require 'fog' # gem install fog
@ashayh
ashayh / fog_s3_iam.rb
Created January 28, 2015 18:40
access S3 using ruby fog with IAM roles
require 'rubygems'
require 'fog'
# assuming your IAM role is named 'my-role' and has S3 access:
uri = URI('http://169.254.169.254/latest/meta-data/iam/security-credentials/my-role')
res = Net::HTTP.get_response(uri)
aws_creds = JSON.parse(res.body)
@ashayh
ashayh / LICENSE.txt
Last active August 29, 2015 14:06 — forked from addyosmani/README.md
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2014
Copyright (C) 2014 Addy Osmani @addyosmani
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE