Skip to content

Instantly share code, notes, and snippets.

@zen4ever
zen4ever / crash.log
Created August 6, 2016 00:31
Terraform crash log
2016/08/05 17:25:50 [INFO] Terraform version: 0.7.0 e822a79165dbc06bbf8271ee349fe256867d53dc
2016/08/05 17:25:50 [DEBUG] Detected home directory from env var: /Users/andrew
2016/08/05 17:25:50 [DEBUG] Detected home directory from env var: /Users/andrew
2016/08/05 17:25:50 [DEBUG] Attempting to open CLI config file: /Users/andrew/.terraformrc
2016/08/05 17:25:50 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2016/08/05 17:25:50 [DEBUG] Detected home directory from env var: /Users/andrew
2016/08/05 17:25:50 [TRACE] Graph after step *terraform.ConfigTransformer:
module.howard_production_elb2elk - *terraform.GraphNodeConfigModule
var.region - *terraform.GraphNodeConfigVariable
@zen4ever
zen4ever / upload_ssl.sh
Created February 9, 2016 16:26
upload ssl
#!/usr/local/bin/bash
export DOMAIN_NAME=$1
export PROFILE_NAME=$2
if [ -z "$3" ]; then
export CERTIFICATE_NAME=$(echo $DOMAIN_NAME | sed -e 's/\*/wildcard/g')
else
export CERTIFICATE_NAME=$3
fi
echo $CERTIFICATE_NAME
aws iam upload-server-certificate --server-certificate-name $CERTIFICATE_NAME$(date +"-%Y-%m-%d") --certificate-body file://$DOMAIN_NAME.crt --private-key file://$DOMAIN_NAME.key --certificate-chain file://$DOMAIN_NAME.chain.crt --profile $PROFILE_NAME # --path /cloudfront/

Keybase proof

I hereby claim:

  • I am zen4ever on github.
  • I am zen4ever (https://keybase.io/zen4ever) on keybase.
  • I have a public key whose fingerprint is A2E7 B69E AA58 755C A525 B9C7 9963 9DEC 4A73 E6CD

To claim this, I am signing this object:

@zen4ever
zen4ever / widgets.py
Created June 19, 2012 08:56
SpanWidget
class SpanWidget(forms.Widget):
"""
Renders a value wrapped in a <span> tag.
Based on Killarny, http://www.djangosnippets.org/snippets/1340/
Modified to place the value in a hidden control, so that it
returns a value in the GET/POST response.
"""
def __init__(self, attrs=None, choices=(), url=False):
super(SpanWidget, self).__init__(attrs=attrs)
self.url = url
@zen4ever
zen4ever / gist:2494169
Created April 25, 2012 22:55
Decorator for using form with django-piston and JSON-encoded POST body
from django.utils import simplejson as json
from piston.decorator import decorator
def validate_json(form_class, class_method=True):
@decorator
def wrap(f, *args, **kwargs):
if class_method:
request = args[1]
@zen4ever
zen4ever / gist:2327666
Created April 7, 2012 11:13
Print available video capture formats on iOS
AVCaptureVideoDataOutput *videoOutput = [[AVCaptureVideoDataOutput alloc] init];
NSDictionary *formats = [NSDictionary dictionaryWithObjectsAndKeys:
@"kCVPixelFormatType_1Monochrome", [NSNumber numberWithInt:kCVPixelFormatType_1Monochrome],
@"kCVPixelFormatType_2Indexed", [NSNumber numberWithInt:kCVPixelFormatType_2Indexed],
@"kCVPixelFormatType_4Indexed", [NSNumber numberWithInt:kCVPixelFormatType_4Indexed],
@"kCVPixelFormatType_8Indexed", [NSNumber numberWithInt:kCVPixelFormatType_8Indexed],
@"kCVPixelFormatType_1IndexedGray_WhiteIsZero", [NSNumber numberWithInt:kCVPixelFormatType_1IndexedGray_WhiteIsZero],
@"kCVPixelFormatType_2IndexedGray_WhiteIsZero", [NSNumber numberWithInt:kCVPixelFormatType_2IndexedGray_WhiteIsZero],
@"kCVPixelFormatType_4IndexedGray_WhiteIsZero", [NSNumber numberWithInt:kCVPixelFormatType_4IndexedGray_WhiteIsZero],
@zen4ever
zen4ever / install.sh
Created February 4, 2012 12:23
Install puppet via Gems/RVM on Debian (run as root)
sudo bash < <(curl https://raw.github.com/gist/1737523/puppet-install.sh )
@zen4ever
zen4ever / widgets.py
Created September 25, 2011 21:43
Hour widget django
from django import forms
TIME_CHOICES = [('', '--------')]
for i in range(0, 24):
for m in ["00", "30"]:
hour = i % 12
if i == 12:
hour = 12
TIME_CHOICES.append(
("%02d:%s" % (i, m),
@zen4ever
zen4ever / settings.py
Created September 24, 2011 04:44
Static files config
import os.path
PROJECT_ROOT = os.path.abspath(os.path.dirname(os.path.realpath(__file__)))
# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/media/"
MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'site_media', 'media')
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
@zen4ever
zen4ever / urlrewrite.js
Created August 14, 2011 09:51
URLRewrite
(function(){
var url = new String(window.location);
window.location = url.replace(".marpasoft", "").replace("imported-", "");
})();