Skip to content

Instantly share code, notes, and snippets.

{
"stack": {
"capabilities": [],
"creation_time": "2014-02-19T16:04:56Z",
"description": "AWS CloudFormation Sample Template WordPress_Single_Instance: WordPress is web software you can use to create a beautiful website or blog. This template installs a single-instance WordPress deployment using a local MySQL database to store the data.",
"disable_rollback": true,
"id": "None",
"links": [
{
"href": "http://10.0.2.15:8004/v1/2e327e5e7fa94b25a44be66fd9d1ec4d/stacks/foobar1/None",
@andersonvom
andersonvom / runner.py
Last active August 29, 2015 13:56
Race Condition
class Runner(threading.Thread):
def __init__(self, in_queue, out_queue):
super(Runner, self).__init__()
self.in_queue = in_queue
self.out_queue = out_queue
self._keep_running = True
def run(self):
while self._keep_running or not self.in_queue.empty():
@andersonvom
andersonvom / remove_extinct.js
Created March 24, 2014 16:16
Javascript to remove all extict distro lines from the linux SVG timeline.
var remove_extict = function() {
var line = null;
var dot = null;
var num_extinct = 0;
do {
try {
line = $('[marker-end]');
dot = $('#'+line.id.replace('__line', '__dot'));
line.remove();
// dot.remove()
import mock
from heat.common import exception
from heat.common import template_format
from heat.engine import resource
from heat.engine import scheduler
from heat.tests import utils
from heat.tests.common import HeatTestCase
from ..resources import secret # noqa
@andersonvom
andersonvom / sample_random.sh
Created April 16, 2014 17:27
sample_random.sh
for i in 1 2 3 4 5 6 7 8 9 0;
do
echo $RANDOM
done
def no_none(props):
''' returns a dict with no None values'''
return {key: value
for key, value in props.iteritems()
if value is not None}
def handle_create(self):
properties = {
self.rs.nodes: self.nodes(),
@andersonvom
andersonvom / .gitconfig
Created September 11, 2014 22:27
Common GIT shortcuts - .gitconfig
[user]
name = Anderson Mesquita
email = find@out.com
[color]
ui = true
pager = true
[alias]
ci = commit
co = checkout
cp = cherry-pick
@APP.task(base=ErrorHandler)
def calc_mrr():
mrr_chord = chord(
chain(get_resources.s(key), calc_revenue.s())
for key in mrr_stacks
)
return mrr_chord(mrr_total.s()) # mrr_total receives a list of AsyncResult
# but I need the actual results (the output of calc_revenue,
# which is the values returned by _sum_revenues)
@andersonvom
andersonvom / openstack.rb
Last active August 29, 2015 14:07
Ruby script to start a new tmux session with the correct windows set up
#!/usr/bin/env ruby
HOME = Dir.home
OPENSTACK = File.join(HOME, 'development', 'openstack')
def openstack
session_name = 'openstack'
windows = {
screen: "cd #{OPENSTACK}; vagrant up && vagrant ssh",
vagrant: "cd #{OPENSTACK}; sleep 10 ; vagrant ssh",
@andersonvom
andersonvom / router.sh
Created October 11, 2014 19:31
Routing configuration to use the VPN for VPN stuff, and default gateway for everything else
#!/bin/bash
VPN_DEVICE=utun0
VPN_NETWORK=10
DEFAULT_GATEWAY=192.168.1.1 # home
host_exceptions=(
xxx.xxx.xxx.xxx # Some public service that needs to be accessed from the VPN
)