Skip to content

Instantly share code, notes, and snippets.

@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": [
@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 / 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 / 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 / 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 / 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 / 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 / gmos.md
Created April 23, 2015 04:27
GMOs: Not That Dangerous

Okay, so lets rewind a bit. Roundup is a brand name used by Monsanto for a type of herbicide called "glyphosphate" While it was under patent protection for 20 years, those patents all expired back in 2000 so now many companies market similar herbicides. These products are used by farmers to kill off smaller plants like grasses and bacteria that spread in the wild and would use nutrients in the soil that the farmer would rather be absorbed by their crops. It does this by blocking the creation of a few key proteins needed by all cells. This doesn't affect insects for the most part as animals don't make these proteins ourselves, we have to eat them ("essential amino acids"). But in plants, it kills them by denying them these required proteins.

Enter "Roundup Ready Soybeans" (and others, soybeans were the first though). They took genes from a few sources (a specific bacterium, a virus that infects cauliflowers, and a petunia flower) and combined to create a new method to synthesize those essential proteins, spec

@coderanger
coderanger / glim_farming.py
Created June 6, 2015 04:40
Monte carlo simulation for Glim Farming in with Lyme.
import math
import random
import statistics
def run_Take_on_a_Clay_Pupil(state):
state['cp'] = 1
def run_Reading_and_writing(state):
"""Requires Pygmalion 1."""
state['glim'] += 105
@coderanger
coderanger / next.rb
Last active August 29, 2015 14:23
What properties could look like.
#
# 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