Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
| import requests | |
| url = "https://api.github.com" | |
| user = "<user-name>" | |
| token = "<make-personal-access-token-@-https://github.com/settings/tokens>" | |
| queries = [ | |
| { "page": i , "per_page": 100 } | |
| for i in [1, 2, 3,] |
Amazon changed the install in Linux 2. One no-longer using 'yum' See: https://aws.amazon.com/amazon-linux-2/release-notes/
sudo amazon-linux-extras install docker
sudo service docker start
sudo usermod -a -G docker ec2-user| import macros | |
| proc typeName(head: NimNode): NimNode = | |
| if head.len == 0: head else: head[1] | |
| proc baseName(head: NimNode): NimNode = | |
| if head.len == 0: newIdentNode("RootObj") else: head[2] | |
| proc isObjectDef(head: NimNode): bool = | |
| head.len == 0 or head[2].kind == nnkIdent |
| sudo yum install gcc python27 python27-devel postgresql-devel | |
| sudo curl https://bootstrap.pypa.io/ez_setup.py -o - | sudo python27 | |
| sudo /usr/bin/easy_install-2.7 pip | |
| sudo pip2.7 install psycopg2 |
| #!/usr/bin/env python | |
| import re | |
| from collections import defaultdict | |
| from pprint import pprint | |
| def findall(line, query="httpretty"): | |
| rgx = re.compile(f"(?P<occurrence>[\w]*[import\s]?{query}[\w\.]*)\w*") | |
| return re.findall(rgx, line) |
| class conduit(object): | |
| def __init__(self, iterator): | |
| self.iterator = iterator | |
| def filter(self, predicate): | |
| return conduit(itertools.ifilter(predicate, self.iterator)) | |
| def map(self, func): | |
| return conduit(itertools.imap(func, self.iterator)) |
| """ | |
| Some python code for | |
| Markov Chain Monte Carlo and Gibs sampling | |
| by Bruce Walsh | |
| """ | |
| import numpy as np | |
| import numpy.linalg as npla |