Skip to content

Instantly share code, notes, and snippets.

@micahhausler
micahhausler / setup.py
Created January 9, 2015 19:32
gross setup.py work-around
from setuptools import setup
import sys
if 'sdist' in sys.argv and sys.version_info < (2, 7, 9, 'final', 0):
import os
del os.link
setup(
# ...
)
@micahhausler
micahhausler / get_gemfury_packages.py
Last active August 29, 2015 14:11
Gemfury Download
#!/usr/bin/env python
# Copyright (C) Micah Hausler, 2014
# Using MIT License <http://opensource.org/licenses/MIT>
#
__doc__ = """
This is a quick hack to download all your python packages from Gemfury.
$ virtualenv venv
$ source ./venv/bin/activate
@micahhausler
micahhausler / Dockerfile
Created October 2, 2014 21:43
Volume Dockerfile
# Shared Volume
FROM busybox:buildroot-2014.02
MAINTAINER micah hausler, micah.hausler@ambition.com
VOLUME /data
CMD ["/bin/sh"]
@micahhausler
micahhausler / etcd_setup.sh
Created September 17, 2014 20:35
confd nested ranges
etcdctl mkdir services/web/cust1/
etcdctl mkdir services/web/cust2/
etcdctl set services/web/cust1/1 '{"ip": "10.0.0.1"}'
etcdctl set services/web/cust1/2 '{"ip": "10.0.0.2"}'
etcdctl set services/web/cust2/1 '{"ip": "10.0.0.3"}'
etcdctl set services/web/cust2/2 '{"ip": "10.0.0.4"}'
@micahhausler
micahhausler / Vagrantfile
Created September 10, 2014 20:47
Vagrant CoreOS setup (w/ rudder)
# -*- mode: ruby -*-
# # vi: set ft=ruby :
require 'fileutils'
Vagrant.require_version ">= 1.6.0"
CLOUD_CONFIG_PATH = File.join(File.dirname(__FILE__), "user-data")
CONFIG = File.join(File.dirname(__FILE__), "config.rb")
@micahhausler
micahhausler / gist:9055862
Last active August 29, 2015 13:56 — forked from anonymous/gist:9053693
Git command counter (OS X)
history -w /dev/stdout | grep -o "^git [a-zA-Z]*\( -\{1,2\}\([a-zA-Z]\)*\)*" | sort | uniq -c | sort -rg
@micahhausler
micahhausler / nginx.conf
Last active January 2, 2016 08:09
NGINX configuration for a Django heartbeat.
server {
listen 10.10.10.10:80;
server_name demo.ambition.io;
location /heartbeat {
set $my_host $host;
if ($host ~ "\d+\.\d+\.\d+\.[\d\:]+") {
set $my_host "demo.ambition.io";
}
@micahhausler
micahhausler / heartbeat.py
Last active January 2, 2016 08:09
Django heartbeat configuration for ELB Health Check
from django.http import HttpResponse
def HeartBeat(request):
"""
This method is for the AWS load balancer health check.
"""
return HttpResponse('{\'data\': {\'status\': \'healthy\'}}')
@micahhausler
micahhausler / alias.py
Last active March 16, 2016 20:15
Set a domain to an ELB
import boto
from boto.route53.record import ResourceRecordSets
import json
subdomain = 'twitter'
primary_domain = 'tryambition.com'
load_balancer_name = 'elb-2'
elb_conn = boto.connect_elb()
@micahhausler
micahhausler / accept.py
Created November 15, 2013 17:01
Salt Key Interface
import salt.client
from salt.key import Key
client = salt.client.LocalClient()
ret = client.cmd('saltmaster','test.get_opts',[], username='username', password='password', eauth='pam')
opts = ret['saltmaster']
opts['pki_dir'] = '/etc/salt/pki/master/'
kcli = Key(opts)
kcli.all_keys()