Skip to content

Instantly share code, notes, and snippets.

import MySQLdb
def task():
try:
db = MySQLdb.connect(
db="my_db", user=user, passwd=passwd,
host=host,
ssl={
"key": "/etc/ssl/private/client-key.pem",
"cert": "/etc/ssl/private/client-cert.pem",
@gcko
gcko / related.py
Last active August 7, 2023 09:32
Django Custom Model ForeignKey Field for Spanning Databases
@stephanvd
stephanvd / multifact_sum_aggregator.js
Created October 31, 2013 09:33
Aggregate over multiple fact fields. Result looks like this: http://imgur.com/fI636rq The aggregator returns first field for renderers without multifield support. The renderer is a modified version of the built-in table to support multifield. Quick and dirty but it gets the job done. For https://github.com/nicolaskruchten/pivottable.
multifactSumAggregator = function() {
return function(facts) {
return function() {
var summedFacts = {};
for (_i = 0, _len = facts.length; _i < _len; _i++) {
summedFacts[facts[_i]] = 0
}
@fredrick
fredrick / couchdb.conf
Created November 28, 2011 01:43 — forked from kowsik/couchdb.conf
Upstart script for CouchDB
# Upstart file at /etc/init/couchdb.conf
# CouchDB
start on runlevel [2345]
stop on runlevel [06]
pre-start script
chown -R couchdb /usr/local/etc/couchdb
chown -R couchdb /usr/local/lib/couchdb
chown -R couchdb /usr/local/var/log/couchdb