Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
| import base64 | |
| import hashlib | |
| import hmac | |
| import simplejson as json | |
| def base64_url_decode(inp): | |
| padding_factor = (4 - len(inp) % 4) % 4 | |
| inp += "="*padding_factor | |
| return base64.b64decode(unicode(inp).translate(dict(zip(map(ord, u'-_'), u'+/')))) |
| d = {192: u'A', 193: u'A', 194: u'A', 195: u'A', 196: u'A', 197: u'A', | |
| 199: u'C', 200: u'E', 201: u'E', 202: u'E', 203: u'E', 204: u'I', | |
| 205: u'I', 206: u'I', 207: u'I', 209: u'N', 210: u'O', 211: u'O', | |
| 212: u'O', 213: u'O', 214: u'O', 216: u'O', 217: u'U', 218: u'U', | |
| 219: u'U', 220: u'U', 221: u'Y', 224: u'a', 225: u'a', 226: u'a', | |
| 227: u'a', 228: u'a', 229: u'a', 231: u'c', 232: u'e', 233: u'e', | |
| 234: u'e', 235: u'e', 236: u'i', 237: u'i', 238: u'i', 239: u'i', | |
| 241: u'n', 242: u'o', 243: u'o', 244: u'o', 245: u'o', 246: u'o', | |
| 248: u'o', 249: u'u', 250: u'u', 251: u'u', 252: u'u', 253: u'y', | |
| 255: u'y'} |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
| """ | |
| Two things are wrong with Django's default `SECRET_KEY` system: | |
| 1. It is not random but pseudo-random | |
| 2. It saves and displays the SECRET_KEY in `settings.py` | |
| This snippet | |
| 1. uses `SystemRandom()` instead to generate a random key | |
| 2. saves a local `secret.txt` |
| -- show running queries (pre 9.2) | |
| SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
| FROM pg_stat_activity | |
| WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
| ORDER BY query_start desc; | |
| -- show running queries (9.2) | |
| SELECT pid, age(clock_timestamp(), query_start), usename, query | |
| FROM pg_stat_activity | |
| WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
| ** Find commmonly accessed tables and their use of indexes: | |
| SELECT relname,seq_tup_read,idx_tup_fetch,cast(idx_tup_fetch AS numeric) / (idx_tup_fetch + seq_tup_read) AS idx_tup_pct FROM pg_stat_user_tables WHERE (idx_tup_fetch + seq_tup_read)>0 ORDER BY idx_tup_pct; | |
| Returns output like: | |
| relname | seq_tup_read | idx_tup_fetch | idx_tup_pct | |
| ----------------------+--------------+---------------+------------------------ | |
| schema_migrations | 817 | 0 | 0.00000000000000000000 | |
| user_device_photos | 349 | 0 | 0.00000000000000000000 |
| /** | |
| * This function performs the fetch from cache portion of the functionality needed to cache ajax | |
| * calls and still fulfill the jqXHR Deferred Promise interface. | |
| * See also $.ajaxPrefilter | |
| * @method $.ajaxTransport | |
| * @params options {Object} Options for the ajax call, modified with ajax standard settings | |
| */ | |
| $.ajaxTransport("json", function(options){ | |
| if (options.localCache) | |
| { |
| /** | |
| * Prefilter for caching ajax calls - adapted from | |
| * https://github.com/paulirish/jquery-ajax-localstorage-cache, made to work with jqXHR Deferred Promises. | |
| * See also $.ajaxTransport. | |
| * New parameters available on the ajax call: | |
| * localCache : true, // required if we want to use the cache functionality | |
| * cacheTTL : 1, // in hours. Optional | |
| * cacheKey : 'post', // optional | |
| * isCacheValid : function // optional - return true for valid, false for invalid | |
| * @method $.ajaxPrefilter |
| 1033edge.com | |
| 11mail.com | |
| 123.com | |
| 123box.net | |
| 123india.com | |
| 123mail.cl | |
| 123qwe.co.uk | |
| 126.com | |
| 150ml.com | |
| 15meg4free.com |
I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.
These are the steps I went through to set up an SSL cert.