This file contains hidden or 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
DEBUG=True | |
LOG_FILE_SIZE=1024*1000 | |
LOGGING = { | |
'version' : 1, | |
'disable_existing_loggers':True, | |
'formatters' : { | |
'simple' : { | |
'format' : '%(levelname)s %(name)s %(message)s' | |
}, |
This file contains hidden or 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
################################################### | |
# Command line prompt settings | |
################################################### | |
__git_hg_ps1 () { | |
local b="$(git symbolic-ref HEAD 2>/dev/null)"; | |
if [ -n "$b" ]; then | |
printf " [%s]" "${b##refs/heads/}"; | |
elif [ "$(hg root 2> /dev/null)" ]; then | |
printf " [%s]" "$(hg branch)" | |
fi |
This file contains hidden or 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
def safe_sql(sql, *values): | |
assert sql.count('%s') == len(values), (sql, values) | |
placeholders, new_values = [], [] | |
for value in values: | |
if isinstance(value, (list, tuple, set)): | |
placeholders.append(', '.join(['%s'] * len(value))) | |
new_values.extend(value) | |
else: | |
placeholders.append('%s') | |
new_values.append(value) |
This file contains hidden or 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 django.test | |
class TimedTestCase(django.test.TestCase): | |
_TOO_LONG = 0.100 | |
def __init__(self, *args, **kwargs): | |
self._start = None | |
super(TimedTestCase, self).__init__(*args, **kwargs) | |
def setUp(self): |
This file contains hidden or 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 | |
# authors: @stantonk, @salubriousdave | |
import os | |
import sys | |
import subprocess | |
def is_hg_repo(path): | |
hgchkpath = os.path.join(path, '.hg') | |
return os.path.exists(hgchkpath) |
This file contains hidden or 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
/* | |
Notes: | |
Despite Scala's appearances, it is, in fact, a Statically Typed language. | |
It has just eliminated a great deal of the "type vomit" people are used | |
to seeing in Statically Typed languages (e.g. C, C++, Java). It often | |
can infer the type on its own. It also combines functional and | |
object-oriented programming paradigms in a fashion that feels similar | |
to Python. | |
*/ |
This file contains hidden or 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.conf import settings | |
from django.db import connections | |
#TODO: patch run method instead? | |
#TODO: print formatting | |
class LogSqlQueriesTestCase(TestCase): | |
@classmethod |
This file contains hidden or 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
#!/bin/sh | |
# your router config | |
ROUTER_PUBLIC_IP=home | |
ROUTER_OPEN_PORT=1234 | |
# your remote computer, behind the router | |
REMOTE_PORT=5900 | |
REMOTE_LAN_IP=10.0.1.1 | |
This file contains hidden or 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 | |
# http://stackoverflow.com/questions/5480131/will-python-systemrandom-os-urandom-always-have-enough-entropy-for-good-crypto | |
import math | |
import random | |
import sys | |
CHOICES = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$^&*()+/?,.' | |
if __name__ == '__main__': | |
if len(sys.argv) != 2: |
This file contains hidden or 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
mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false |