cd ~/.virtualenvs/myvirtualenv/lib/python2.x/site-packages
echo 'import sys;sys.setdefaultencoding("utf-8")' > sitecustomize.py
to automatically create a sitecustomize.py every time you create a virtualenv, edit your
# sitch keys and values in a dict | |
aDict = { | |
"key1": "value1", | |
"key2": "value2", | |
"key3": "value3" | |
} | |
inverse = dict(zip(aDict.values(), aDict.keys())) |
<?php | |
// resolve the power of two terms of a given sum | |
// using the binary system | |
function resolvePowerOfTwo($sum) | |
{ | |
$result = array(); | |
// binary representation | |
$bin = decbin($sum); |
# -*- coding: utf-8 -*- | |
# data raised by destatis (https://www.destatis.de/) | |
# "Vorläufige Ergebnisse auf Grundlage des Zensus 2011, Zensusdaten mit dem Stand vom 10.04.2014" | |
# data as of 2011 | |
# population sum = 80327900 | |
# city count = 11300 | |
# -*- coding: utf-8 -*- | |
# data raised by destatis | |
# "Vorläufige Ergebnisse auf Grundlage des Zensus 2011, Zensusdaten mit dem Stand vom 10.04.2014" | |
# data as of 2011 | |
# population sum = 80327900 | |
# city count = 11300 | |
# cleared additions: |
import datetime | |
import time | |
class Duration: | |
def __init__(self, start_time=None, end_time=None): | |
self.start_time = start_time | |
self.end_time = end_time | |
def start(self): | |
self.start_time = time.time() |
def kill_duplicates(seq): | |
seen = set() | |
seen_add = seen.add | |
return [ x for x in seq if not (x in seen or seen_add(x))] |
def color_print(msg, color): | |
colors = { "clear": "\033[0;m", | |
"gray": "\033[1;30m", | |
"red": "\033[1;31m", | |
"green": "\033[1;32m", | |
"yellow": "\033[1;33m", | |
"blue": "\033[1;34m", | |
"magenta": "\033[1;35m", | |
"cyan": "\033[1;36m", | |
"white": "\033[1;37m", |
-- find duplicated values | |
SELECT | |
address_line1, address_line2, zip, city, country, COUNT(*) | |
FROM | |
location | |
GROUP BY | |
address_line1, address_line2, zip, city, country | |
HAVING | |
COUNT(*) > 1; |