Skip to content

Instantly share code, notes, and snippets.

@maracuja
maracuja / ooyala.js
Created December 10, 2013 14:16
This is for when I have to come back and integrate custom analytics into my ooyala player
var debug = {};
OO.ready(function() {
OO.Player.create(
'ooyalaplayer',
'{{ request.GET.ocid }}',
{
"enableChannels": true,
"wmode" : "transparent",
onCreate: function(player) {
@maracuja
maracuja / fabfile.py
Created February 11, 2014 14:34
My Default Fab Commands
from fabric.api import *
from fabric.colors import cyan, green
print(cyan(''))
print(cyan(' _,-""`""-~`)'))
print(cyan('(`~ \\'))
print(cyan(' | a a \\'))
print(cyan(' ; o ; ___ _,,,,_ _.-~\'.'))
print(cyan(' \ `^` /`_.-"~ `~-;` \\'))
print(cyan(' \_ _ .\' `, |'))
@maracuja
maracuja / .profile
Created July 8, 2014 12:04
my hacked together .profile prompt settings for git
DEFAULT="[37;40m"
PINK="[35;40m"
GREEN="[32;40m"
ORANGE="[33;40m"
alias __git_ps1="git branch 2>/dev/null | grep '*' | sed 's/* \(.*\)/\1/'"
export PS1='\n\e${PINK}\u \e${DEFAULT}at \e${ORANGE}\h\
\e${DEFAULT}in \e${GREEN}\w \e${DEFAULT}on \e${PINK}$(__git_ps1) $(echo `git status` | grep "nothing to commit" > /dev/null 2>&1; if [ "$?" -eq "0" ]; then echo ""; else echo "!"; fi) \e${DEFAULT} \n~ 🍔 '
@maracuja
maracuja / gist:d419b3f3156674c40c4d
Created September 8, 2014 08:26
timestamped db backup command for postgres in crontab
0 5,13 * * * pg_dump dbname_dev --no-owner > /var/lib/postgresql/backups/dev-`date +\%Y-\%m-\%d_\%T`.sql
0 5,13 * * * pg_dump dbname_uat --no-owner > /var/lib/postgresql/backups/uat-`date +\%Y-\%m-\%d_\%T`.sql
@maracuja
maracuja / get-your-box-ip-addresses.py
Created September 19, 2014 16:23
Get Your Box IP Addresses
import boto.ec2
aws_access_key_id=''
aws_secret_access_key=''
conn = boto.ec2.connect_to_region("eu-west-1", aws_access_key_id=aws_access_key_id, aws_secret_access_key=aws_secret_access_key)
reservations = conn.get_all_reservations()
boxes = [
{ 'name': 'skylark-web-dev-01', 'current_ip': '' },
{ 'name': 'skylark-web-uat-01', 'current_ip': '' },
@maracuja
maracuja / expanded_test.py
Last active August 29, 2015 14:07
Test Output of ElasticSearch
from collections import defaultdict, OrderedDict
from wagtail.wagtailcore.models import Page
from lma.apps.manager.models import ManagerPage
from lma.apps.article.models import ArticlePage
from lma.apps.video.models import VideoPage
search_types = OrderedDict([
('manager', ('Manager Profiles', ManagerPage)),
('statement', ('Statements', ArticlePage)),
@maracuja
maracuja / get_boxes.py
Created November 4, 2014 16:55
Get the ips pf existing boxes
import boto.ec2
aws_access_key_id=''
aws_secret_access_key=''
conn = boto.ec2.connect_to_region("eu-west-1", aws_access_key_id=aws_access_key_id, aws_secret_access_key=aws_secret_access_key)
reservations = conn.get_all_reservations()
def get_login(instance):
if 'name' in instance.tags:
@maracuja
maracuja / settings.py
Created November 20, 2014 17:42
Save to S3
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
AWS_S3_SECURE_URLS = False
AWS_QUERYSTRING_AUTH = False
AWS_S3_ACCESS_KEY_ID = ""
AWS_S3_SECRET_ACCESS_KEY = ""
AWS_STORAGE_BUCKET_NAME = 'bucket_name'
AWS_HEADERS = {
'Expires': 'Thu, 15 Apr 2010 20:00:00 GMT',
'Cache-Control': 'max-age=86400',
'Content-Type': 'text/xml'
@maracuja
maracuja / models.py
Created January 28, 2015 16:04
My super amazing tweet fetching script.
from django.db import models
from django.contrib import admin
class Tweet(models.Model):
text = models.CharField(max_length=140)
created_at = models.DateTimeField()
tweet_id = models.BigIntegerField()
visible = models.BooleanField(default=True)
ITEMS_PER_PAGE = 10
@maracuja
maracuja / list_buckets.py
Created March 25, 2015 11:45
List Buckets for Singapore
import boto.s3
aws_access_key_id=''
aws_secret_access_key=''
conn = boto.s3.connect_to_region("ap-southeast-1", aws_access_key_id=aws_access_key_id, aws_secret_access_key=aws_secret_access_key)
conn.get_all_buckets()