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 threading import Thread | |
from Queue import Queue | |
''' | |
an alternative to Python's ThreadPool, but this version can make use of any kind of functions | |
''' | |
class ThreadPool: | |
def __init__(self, cnt): |
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
def window_slide(iter, size=2): | |
mem = [None] * size | |
for i, each in enumerate(iter): | |
mem[i % size] = each | |
if i >= size - 1: | |
yield mem[(i + 1) % size:] + mem[:(i + 1) % size] |
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 fastcluster import linkage | |
from collections import deque | |
from sklearn.metrics import mean_squared_error | |
import numpy | |
def f_creator(coef, intercept): | |
def f(x): | |
return intercept + coef * x | |
return f |
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 fasteners | |
import threading | |
class BindFreePort(object): | |
def __init__(self, start, stop): | |
self.port = None | |
import random, socket | |
self.sock = socket.socket() |
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
psutil |
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
HOST="user@host" | |
REMOTE_PATH="/remoth/path" | |
RUN_COMMAND="docker run --rm -v ${REMOTE_PATH}:/run -w /run debian:jessie echo 'hello world!'" | |
echo "connecting to ${HOST} and sycing files to the remote ..." | |
rsync -a ./ "${HOST}:${REMOTE_PATH}" | |
echo "running the script at the remote ..." | |
ssh ${HOST} "cd ${REMOTE_PATH} && ${RUN_COMMAND}" |
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
.remoterunignore | |
.remoterun_lock | |
.remoterunrc | |
.git | |
.gitignore | |
.DS_Store |
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
# Copyright (c) 2011 Joshua D. Bartlett | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: | |
# | |
# The above copyright notice and this permission notice shall be included in |
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 | |
def unzip(l): | |
return zip(*l) | |
def merge(*itrs): | |
from itertools import chain | |
return chain.from_iterable(itrs) | |
async def wait(l): |
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
// Place your key bindings in this file to overwrite the defaults | |
[ | |
{ | |
"key": "alt+a", | |
"command": "editor.action.selectAll" | |
}, | |
{ | |
"key": "alt+x", | |
"command": "editor.action.clipboardCutAction" | |
}, |