Skip to content

Instantly share code, notes, and snippets.

@coderanger
coderanger / my_resource.rb
Created March 17, 2015 21:59
Example blank Halite resource
#
# Copyright 2015, Noah Kantrowitz
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@coderanger
coderanger / travis.rb
Last active January 20, 2016 20:59
WIP knife travis plugin.
require 'chef/knife'
module Poise
class Travis < Chef::Knife
include Chef::Mixin::ShellOut
deps do
require 'yaml'
require 'kitchen'
end
@coderanger
coderanger / gen_travis.rb
Created November 14, 2014 21:45
Travis harness generators
#!/usr/bin/env ruby
require 'yaml'
# Make sure we never commit this stuff accidentally
IO.write('.gitignore', ".docker.*\n", mode: 'a') unless IO.read('.gitignore').include?('.docker.*')
# Generate a new client key
unless File.exists?('.docker.crt')
CA_BASE = File.expand_path('~/src/docker-ca')
@coderanger
coderanger / berks-api-lite.rb
Created October 30, 2014 23:42
Berks API Lite.
#!/usr/bin/env ruby
require 'json'
require 'openssl'
require 'tempfile'
require 'fog'
BUCKET = 'something'
ROOT = File.expand_path('..', __FILE__)
UNIVERSE = {}
@coderanger
coderanger / s3.py
Last active August 29, 2015 13:59
Unfinished apt-s3 replacement.
#!/usr/bin/python
#
# Author:: Noah Kantrowitz <noah@coderanger.net>
#
# Copyright 2013-2014, Balanced, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
@coderanger
coderanger / README.md
Last active August 18, 2023 18:33
How to patch Ubuntu for Heartbleed

How to patch Ubuntu for Heartbleed

  1. sudo apt-get update
  2. sudo apt-get install -y libssl1.0.0 openssl
  3. openssl version -a and confirm the "built on" date is >= 2014-04-07
  4. sudo lsof -n | grep ssl | grep DEL and restart all listed services.

Repeat #4 until no results are returned.

@coderanger
coderanger / recon.py
Created April 8, 2014 01:17
Quick script to scrape OpenSSL versions
#!/usr/bin/env python
import os
import subprocess
import json
from boto.ec2 import connect_to_region
REGIONS = ['us-east-1', 'us-west-1', 'us-west-2']
@coderanger
coderanger / README.md
Last active August 29, 2015 13:56
Command to run depsolver

To use this snippet first replace the _default in the URL with your environment name if you are using somethign other than the global default. Next in the run list, replace ... with your cookbook names. Unlike other run lists, you cannot have roles here, and you don't use the 'recipe[foo]' syntax, just 'foo'.

@coderanger
coderanger / reconnect.pl
Created February 16, 2014 02:03
Reconnect plugin for Tigerlily
use strict;
my $reconnect_timer;
sub try_reconnect {
my $ui = ui_name("main");
my $server = active_server();
if(!$server) {
$ui->print("(trying to reconnect)\n");
TLily::Event::send(
@coderanger
coderanger / balanced.json
Created February 11, 2014 18:43
Balanced packer config
{
"variables": {
"aws_access_key_id": "{{env `AWS_ACCESS_KEY_ID`}}",
"aws_secret_access_key": "{{env `AWS_SECRET_ACCESS_KEY`}}",
"aws_account_id": "4819-1673-9571",
"s3_bucket": "balanced-amis",
"x509_cert_path": "{{pwd}}/balanced-aws.crt",
"x509_key_path": "{{pwd}}/balanced-aws.key"
},
"builders": [