This file contains 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
import asyncio | |
from threading import Thread, Timer | |
import logging | |
import sys | |
logging.basicConfig( | |
level=logging.INFO, | |
format='%(threadName)10s %(name)18s: %(message)s', |
This file contains 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
from functools import reduce | |
import operator | |
from itertools import tee | |
def list_get(dictionary, list): | |
return reduce(operator.getitem, list, dictionary) | |
def pairwise(iterable): |
This file contains 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
var state = { | |
prop: undefined | |
doSomething: (envName) => {}, | |
doSomethingElse: (_) => {}, | |
setProp: (v) => { | |
this.prop = v | |
}, | |
} | |
process.stdin.setEncoding('utf-8') |
This file contains 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
from subprocess import Popen, PIPE | |
import json | |
class Manager: | |
def __init__(self, name): | |
self.ps = Popen( | |
['nodejs', 'src/js/index.js'], | |
stdin=PIPE, stdout=PIPE) | |
self.name = name |
This file contains 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
""" | |
Simple wrapper to compute a parrallelize a function. | |
given a function f that takes a single argument, `arg`, the batch_job decorator | |
turns f into a function that takes a list of args and computes each result in | |
a seperate process. It then returns the results as a list. | |
___ | |
use: |
This file contains 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
"""Functions that can be used as decorators to check the state of class datastructures are sound. | |
The class_validator function adds a validation step to each method in the decorated class if the environment is | |
in TESTING mode. This is used primarily for testing in order to catch cases where class instances enter states | |
they shouldn't. | |
Example: | |
``` | |
def simple_validator(self, *args, **kwargs): |
This file contains 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
# taken from https://github.com/bulletphysics/bullet3/issues/3131 | |
import ctypes | |
import sys | |
import os | |
class RedirectStream(object): | |
@staticmethod | |
def _flush_c_stream(stream): |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
OlderNewer