Skip to content

Instantly share code, notes, and snippets.

@tomgruner
tomgruner / gist:5ce8bb1f4c55d17b5b25
Created July 4, 2014 22:27
Migrate from django social auth to python social auth
from django.contrib.sessions.models import Session
for s in Session.objects.iterator():
session_dict = s.get_decoded()
if '_auth_user_backend' in session_dict.keys():
#New backend is social.backends.facebook.FacebookOAuth2
#Change from old backend
if session_dict['_auth_user_backend'] == 'social_auth.backends.facebook.FacebookBackend':
session_dict['_auth_user_backend'] = 'social.backends.facebook.FacebookOAuth2'
new_s = Session.objects.save(s.session_key, session_dict, s.expire_date)
print new_s.pk
@tomgruner
tomgruner / hello.conf
Created May 10, 2014 22:31
example supervisor conf for docker
[program:hello]
command = docker run --rm busybox /bin/sh -c "while true; do echo hello world; sleep 1; done"
autostart = true
autorestart = true
@tomgruner
tomgruner / row_template.html
Created August 3, 2012 09:53
Tooltip Ellipsis inside backbone view render method
<script id="componentTypeRowTpl" type="text/html">
<td>{{ name }}</td>
<td class="ellipsis_100">{{ description }}</td>
</script>
@tomgruner
tomgruner / admin.py
Created January 11, 2012 16:39 — forked from uhop/admin.py
Adding Dojo's rich editor with minimal plugins to Django's Admin that shows the editor on click and hides on blur
# Example how to add rich editor capabilities to your models in admin.
from django.contrib.admin import site, ModelAdmin
import models
# we define our resources to add to admin pages
class CommonMedia:
js = (
'https://ajax.googleapis.com/ajax/libs/dojo/1.6.0/dojo/dojo.xd.js',