Skip to content

Instantly share code, notes, and snippets.

@davidkelley
davidkelley / network.template
Created April 13, 2014 15:12
AWS Cloudformation that launches Private and Public Subnets inside a configured VPC complete with a Bastion Host
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "Creates networking infrastructure.",
"Parameters" : {
"BastionKeyName" : {
"Description" : "Name of an existing EC2 KeyPair to enable SSH access to the bastion host",
"Type" : "String",
@kcd83
kcd83 / gist:79030f14be869f4884d0
Last active August 29, 2015 14:01 — forked from tehranian/gist:7123269
Allow SSH on ports other than 22 and create the directory
#!/bin/bash
# High-performance, native SSH implementation for Jenkins SSH slaves. Jenkins'
# standard turn-key SSH slave implementation uses an embedded, "pure Java"
# implementation of SSH (https://github.com/jenkinsci/trilead-ssh2).
# That standard implementation combines all of the convenience of a pure Java
# implementation with all of the "performance" of a pure Java implementation :P
# If your distributed build process generates large build artifacts like ISOs,
# VM images, Vagrant boxes, etc, then you will see a substantial benefit from
Bitly tech talk 4/22/2010
On 4/22 we held a bit.ly tech talk on 'Command Line Fu', where we invited talented hackers to come share their best moves. Please correct my notes and add your fu here!
# jehiah
# in place file regex replacement
perl -pi -e 's/this/that/g' filename_pattern
# print the last column
@edufelipe
edufelipe / prettyjson.py
Created July 13, 2010 18:43
Script to prettyprint and highlight json to terminal
#!/usr/bin/env python
import cStringIO
import json
import sys
from pygments import highlight
from pygments.formatters import TerminalFormatter
from pygments.lexers.web import JavascriptLexer
@r4um
r4um / nagios-ntfctl.rb
Created April 18, 2012 13:25
Enable/disable nagios host and or service notifications
#!/usr/bin/ruby
#
# Enable/disable host and or service notifications
#
require 'net/http'
require 'optparse'
require 'pp'
require 'socket'
@philandstuff
philandstuff / haproxy-statsd.rb
Created October 8, 2012 09:34
script to pump haproxy stats into statsd
#!/usr/bin/ruby
require 'socket'
HOSTNAME = `facter hostname`.chomp
SOCKET = UDPSocket.new
IO.popen(["curl","http://localhost:8000/haproxy;csv"]) do |haproxy_csv|
header_line = haproxy_csv.gets
header_line.gsub!(/# /,'')
HEADERS = header_line.split(/,/)[0..-2]
@t9md
t9md / vagrant-snapshot.rb
Created June 4, 2011 16:21
vagrant snapshot management command for one vm.
## place this file to same directory of `Vagrantfile' then simply require "snap.rb" in Vagrantfile
module Snap
module VBox
class SnapShot
require "forwardable"
extend Forwardable
def_delegators :@snap, :name, :uuid, :time_stamp
@@snaps = []
class << self
@garnaat
garnaat / iam_admin_example.py
Created September 15, 2010 13:51
Use IAM/boto to create an Admin group
"""
IAM boto examples:
In this example, we show how to create a group
for administrators who have full access to IAM
functionality but no access to other AWS services.
"""
import boto
#
# First create a connection to the IAM service
@logikal
logikal / chef11-vagrant.md
Last active December 14, 2015 06:49
Chef 11 has come out, and possibly broken a bunch of your carefully crafted cookbooks. How are you going to test them, though? Here's one way, using chef-solo via Vagrant.

Requirements

  • RVM (or rbenv, but this will use RVM)
  • You're using RVM or rbenv to manage your rubies, right? If not, you should be.
  • Virtualbox
  • some cookbooks you wrote and want to test

Set it up

We don't want to mess up our carefully crafted Chef 10.x environment, right? We'll use rvm gemsets to make a disposable set of gems. If something goes wrong, just close the terminal you're in, or run rvm gemset use default. You'll drop back to the default gemset.

@logikal
logikal / ways_to_change_attributes.rb
Last active December 17, 2015 02:29
How to change default attributes
# With Vagrantfile's chef.json:
chef.json = {
"postgresql" => {
"version" => "9.2"
}
}
# Calling a premade databag item, from a recipe
# ! This probably will require modifications