I hereby claim:
- I am stephenemslie on github.
- I am stephenemslie (https://keybase.io/stephenemslie) on keybase.
- I have a public key ASBlYoClNgkGUA0RW4_B3_KDyv84UKNYp57qkH7-BZzDDgo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
import os | |
import sqlalchemy as sa | |
engine = sa.create_engine(os.environ['DBURI']) | |
meta = sa.MetaData(bind=engine, reflect=True) | |
tmpl = """ | |
op.drop_constraint('{name}', '{source}') | |
op.create_foreign_key('{name}', '{source}', '{referent}', ['{local_cols}'], ['{remote_cols}'], deferrable=True) | |
""" |
// This needs to listen on port 53, so run with sudo node boot2docker-dns.js | |
var exec = require('child_process').exec; | |
var jack = require('dnsjack').createServer(); | |
jack.route('localdocker', function(domain, callback){ | |
exec('sudo -u $SUDO_USER boot2docker ip', function(err, stdout, stderr){ | |
callback(null, stdout); | |
}); | |
}); | |
jack.listen(); |
import serial | |
import socket | |
import argparse | |
import sys | |
NEWLINE = "\r\n" | |
if __name__ == "__main__": | |
p = argparse.ArgumentParser() | |
p.add_argument("com_port") |
import csv | |
from django.contrib import admin | |
from django.http import HttpResponse | |
class UserAdmin(ModelAdmin): | |
actions = ["export_as_csv"] | |
def export_as_csv(self, request, queryset): | |
response = HttpResponse(content_type='text/csv') |
""" | |
resolved_pattern Django context processor: insert the current url's ResolverMatch object into context. | |
Example use: Set class=active to a menu item, based on the namespace of the currently matched url. | |
<li {% if resolved.namespace == "home" %}class="active"{% endif %}> home </li> | |
or more specifically: | |
<li {% if resolved.view_name == "contact" %}class="active"{% endif %}> contact </li> |