Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
| #!/usr/bin/env python | |
| # kd-tree index and nearest neighbour search | |
| # includes doctests, run with: python -m doctest kdtree.py | |
| class KDTree(object): | |
| """ | |
| kd-tree spatial index and nearest neighbour search | |
| http://en.wikipedia.org/wiki/Kd-tree | |
| """ |
| /* | |
| * Dependency : Excel Data Reader from http://exceldatareader.codeplex.com/ | |
| * You must add the references to the Dlls (downloaded from the link above) with Visual Studio. | |
| */ | |
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Text; | |
| using Excel; |
| from __future__ import with_statement | |
| from types import ClassType, MethodType, TypeType | |
| class Patch(object): | |
| class Missing: | |
| pass | |
| def __init__(self, obj, **kwargs): |
| import urllib2 | |
| import threading | |
| from Queue import Queue | |
| import sys, os, re | |
| class ThreadedDownload(object): | |
| REGEX = { | |
| 'hostname_strip':re.compile('.*\..*?/', re.I) | |
| } |
| .idea/* | |
| *.pyc |
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| """Which json is the best json.""" | |
| import json | |
| import simplejson as sjson | |
| import ujson | |
| import cjson | |
| import bson |
| import logging | |
| log = logging.getLogger(__name__) | |
| from sqlalchemy import Table | |
| from sqlalchemy import MetaData | |
| from sqlalchemy.orm import mapper | |
| from sqlalchemy.orm import scoped_session | |
| from sqlalchemy.orm import sessionmaker | |
| from zope.sqlalchemy import ZopeTransactionExtension |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
| #!/bin/sh | |
| ### | |
| # SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer) | |
| # For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos | |
| ### | |
| # Alot of these configs have been taken from the various places | |
| # on the web, most from here | |
| # https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx |
| requests==2.4.3 | |
| rsa==3.1.4 |