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
d = {} | |
for i, v in enumerate('zero one two three four five six seven eight nine ten eleven twelve thirteen'.split()): | |
d[v] = i | |
for v, i in d.items(): | |
if 3 < i < 10: | |
d[v + 'teen'] = i + 10 | |
d.update({ |
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 apply_cid(obj): | |
cids = models.CallerId.objects.filter(extension=obj).all() | |
for c in cids: | |
c.status = 1 | |
c.save() | |
class CidInLineAdmin(admin.TabularInline): | |
model = model.CallerId | |
extra = 0 |
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/python | |
import psycopg2 | |
import urllib2 | |
import base64 | |
KEY = "OmMaNiPadMeHumPokemonchick" | |
class Db(): |
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/python | |
import psycopg2 | |
def GetListInSQL(): | |
try: | |
conn = psycopg2.connect(database="db1023250_fssip", user="u1023250_fssip", password="ampersantPiNgVi237m273", host="77.221.130.141", port="5432") | |
print "Open connection" | |
except: | |
print "WARNING! I can't open connection" | |
cur = conn.cursor() |
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 flatten(dictionary): | |
""" | |
>>> flatten({}) | |
{} | |
>>> flatten({ | |
... "name": { | |
... "first": "One", | |
... "last": "Drone", | |
... }, | |
... "job": "scout", |