This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib.admin.views.decorators import staff_member_required | |
@staff_member_required | |
def login_using_email(request, email): | |
'''DONT EVER USE this method for normal purposes. This is only there, for debugging specific problems related to users''' | |
from django.contrib.auth import get_backends | |
from django.contrib.auth import login as django_login | |
from django.contrib.auth.models import User |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# I didn't write those, ;) all props go to http://stackoverflow.com/users/110735/clint-modien | |
# | |
# The following bash functions show you the difference in commits between the branch you are on | |
# and another branch that you either want to commit too or merge from. | |
# | |
# USAGE: | |
# gbout branch_i_want_to_push_too [-p, --raw] | |
# gbin branch_i_want_to_pull_from [-p, --raw] | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.core.exceptions import SuspiciousOperation | |
from django.utils.encoding import force_unicode | |
from django.contrib.sessions.backends.base import SessionBase, CreateError | |
from django.conf import settings | |
import redis | |
class SessionStore(SessionBase): | |
""" | |
A Redis-based session store. | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'analysis': { | |
'filter': { | |
'filter_edge_ngram': { | |
'side': 'back', | |
'max_gram': 20, | |
'min_gram': 2, | |
'type': 'edgeNGram', | |
}, | |
'filter_ngram': { | |
'max_gram': 20, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
log = logging.getLogger('socrates') | |
from Queue import Empty, Full, Queue | |
from riak.transports import RiakPbcTransport | |
from riak.transports.transport import RiakTransport | |
class PbcPoolTransport(RiakTransport): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -XDELETE 'http://localhost:9200/twitter/' | |
curl -XPUT 'http://localhost:9200/twitter/' -d '{ | |
"settings" : { | |
"analysis": | |
{ | |
"filter": { | |
"synonym_filter" : { | |
"type" : "synonym", | |
"synonyms": [ | |
"i-phone 4, i phone 4, iphone 4 => iphone4" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
Real time log files watcher supporting log rotation. | |
Author: Giampaolo Rodola' <g.rodola [AT] gmail [DOT] com> | |
License: MIT | |
""" | |
import os |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A naive dns server with a Redis backend | |
# Set keys in Redis you want to be authoritative for (set google.com. 127.0.0.1) | |
# Tip: Use Redis's ttl functions to have temporary names | |
# Currently only does A records, feel free to fix that | |
# | |
# Licensed under the PSF License | |
# Thanks to: http://code.activestate.com/recipes/491264-mini-fake-dns-server/ | |
# Author: @Kaerast <[email protected]> | |
import socket |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import subprocess | |
# PyObjC-related imports | |
from AppKit import NSApplication, NSSystemDefined | |
from PyObjCTools import AppHelper | |
KEY_UP = 11 |
OlderNewer