Skip to content

Instantly share code, notes, and snippets.

@micahhausler
micahhausler / stdout
Created May 19, 2016 19:50
sbt assembly error
[error] Class java.time.Duration not found - continuing with a stub.
[error] Class java.time.Duration not found - continuing with a stub.
[error] missing or invalid dependency detected while loading class file 'DefaultWrites.class'.
[error] Could not access type Instant in value java.time,
[error] because it (or its dependencies) are missing. Check your build definition for
[error] missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.)
[error] A full rebuild may help if 'DefaultWrites.class' was compiled against an incompatible version of java.time.
[error] missing or invalid dependency detected while loading class file 'DefaultWrites.class'.
[error] Could not access type LocalDate in value java.time,
[error] because it (or its dependencies) are missing. Check your build definition for
@micahhausler
micahhausler / marathon-lb.json
Last active May 6, 2016 20:17
marathon-lb.json
{
"id": "/marathon-lb",
"cmd": null,
"cpus": 1,
"mem": 256,
"disk": 0,
"instances": 2,
"constraints": [
[
"hostname",
@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 / 0001_initial.py
Last active February 15, 2016 02:03
Custom User Model Switch
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
import django.core.validators
#### SEE LINE 25!
class Migration(migrations.Migration):
@micahhausler
micahhausler / master.sh
Last active January 23, 2016 08:42
Docker Orca (0.4.0) Quickstart instructions
#!/bin/bash
#
# Requires docker-toolbox >= 1.9.0d
# https://github.com/docker/toolbox/releases
MACHINE_NAME="orcamaster"
docker-machine create -d virtualbox $MACHINE_NAME
eval $(docker-machine env $MACHINE_NAME)
@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 / cache.go
Last active December 31, 2015 19:43
Go map Data Race
package cache
import (
"sync"
)
// UserCache stores a concurrent-safe cache of authenticated users
type UserCache struct {
mu sync.RWMutex // guards Cache
Cache map[string]string
@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()
@micahhausler
micahhausler / pillar_config.yml
Last active December 23, 2015 11:19
salt django-pillar idea
# yaml
project:
# virtual env path
env: /path/to/venv/bin
# absolute path to django settings
settings_path: /path/to/settings
# django version
version: '1.5.3'