Skip to content

Instantly share code, notes, and snippets.

@p-lewis
p-lewis / encode.js
Last active August 4, 2016 05:08
Encode a message in node.js for a Celery worker
var uuid = require("node-uuid");
// Create a message to be consumed by the queuedemo.tasks.add Celery task
// will incorporate arguments x & y as part of `add(x,y)` message
function makeCeleryAddMessage(x, y){
var msgId = uuid.v4();
// This is the outer AMQP envelope
var msgEnvelope = {

Guide to how fucked is SSL?

Thanks to Jacob Kaplan-Moss, Donald Stufft, David Reid, Allen Short, Zain Memon, and Chris Armstrong for review.

This is a guide for technical individuals to understand in what circumstances SSL communications are secure against an observer-in-the-middle (for all intents and purposes: the NSA).

@pamelafox
pamelafox / view.html
Created August 21, 2012 14:30
Google Maps AutoComplete for Profile Location Field
<div class="control-group">
<label class="control-label">Location</label>
<div class="controls">
<input name="location" type="text" placeholder="City, State, Country" value="">
<input name="location_city" type="hidden" value="">
<input name="location_state" type="hidden" value="">
<input name="location_country" type="hidden" value="">
<input name="location_lat" type="hidden">
<input name="location_lng" type="hidden">
</div>
@nachocab
nachocab / genes.csv
Created May 20, 2012 22:16
D3 heatmap using Backbone.js and CoffeeScript
gene_name lassa_day_0 lassa_day_3 lassa_day_6 lassa_day_8 lassa_day_10 lassa_day_12 marburg_day_0 marburg_day_1 marburg_day_3 marburg_day_5 marburg_day_7 marburg_day_9 ebola2_day_0 ebola2_day_1 ebola2_day_3 ebola2_day_4 ebola2_day_5 ebola2_day_6 ebola2_day_7 ebola2_day_8 lcmv_day_1 lcmv_day_2 lcmv_day_3 lcmv_day_4 lcmv_day_6 lcmv_day_7
GENE_1 0 0.685 1.047 1.020 0.957 8e-01 0 -0.855 -1e+00 -1.546 -1.359 -1.077 0 -6e-01 -0.219 1.295 0.923 1.216 1e+00 1.632 0.550218483523337 -0.117805570597282 0.0732205574710542 -0.564914153485835 -0.359415199104997 0.00898927502093986
GENE_2 0 2.459 3.299 3.086 2.658 3e+00 0 0.193 9e-01 1.433 1.246 1.091 0 -1e-01 0.392 2.142 2.734 3.863 4e+00 4.216 -0.0754593963815329 0.0967734690139892 0.28316769523287 -0.412279746153753 -0.324753442770228 0.288227993676913
GENE_3 0 0.121 2.131 1.628 1.561 1e+00 0 -0.939 -1e+00 -1.544 -1.632 -1.055 0 2e-02 -0.049 0.008 0.393 1.031 3e-01 0.324 0.0499325227230727 -0.0397401531526083 0.2124328794823 0.0731657480808578 0.0189570855935306 -0.01848
@yourcelf
yourcelf / mplayer-rifftrax.py
Created May 18, 2012 22:59
Command line wrapper for mplayer to make rifftrax syncing easier
#!/usr/bin/env python
import sys
import time
import subprocess
def main(vid, aud):
try:
vidproc = subprocess.Popen(["mplayer", vid], stdin=subprocess.PIPE)
audproc = subprocess.Popen(["mplayer", aud], stdin=subprocess.PIPE)
@gingerlime
gingerlime / change_db_owner.sh
Created April 24, 2012 19:32
Postgresql - Changing ownership on all tables
#!/bin/bash
usage()
{
cat << EOF
usage: $0 options
This script set ownership for all table, sequence and views for a given database
Credit: Based on http://stackoverflow.com/a/2686185/305019 by Alex Soto

With apologies to Gruber... http://www.flickr.com/photos/nasahqphoto/7088014787/

"Space shuttle Discovery, mounted atop a NASA 747 Shuttle Carrier Aircraft (SCA), flies over the Washington skyline as seen from a NASA T-38 aircraft, Tuesday, April 17, 2012. "

In celebration of abandoning our space program, we paraded our ailing 30-year old technology over the heads of warmongering lawmakers today.

"Discovery, the first orbiter retired from NASA’s shuttle fleet, ..."

A shuttle-sized walker was too expensive, especially after we bailed out all those banks.

@pamelafox
pamelafox / util.js
Created April 13, 2012 17:44
JavaScript Utility Libraries (Scroll down!)
var ED = ED || {};
// Utility functions
ED.util = (function() {
// Data structure functions
function each(object, callback) {
if (object === null) return;
@epicserve
epicserve / send_email.py
Created January 3, 2012 21:07
A little script to test sending email
#!/usr/bin/env python
from argparse import ArgumentParser
import smtplib
from email.mime.text import MIMEText
"""
Example Usage:
./send_email.py \
@dgouldin
dgouldin / gist:1320358
Created October 27, 2011 18:17
Django model relation graph
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.db.models import loading
from django.db.models.fields.related import RelatedField
INDENT = ' '
for app_name in settings.INSTALLED_APPS:
print app_name
app_label = app_name.split(".")[-1]
try: