Skip to content

Instantly share code, notes, and snippets.


James Bowler JamesKBowler

  • Data Centauri Ltd
  • Cheshire UK
View GitHub Profile
gatopeich /
Last active Aug 9, 2020
Install Jupyter iPython Notebook on Android via Termux
pkg upgrade
# Install runtime deps
pkg install python libzmq libcrypt
# Add build deps
pkg install python-dev libzmq-dev libcrypt-dev clang
pip3 install -U pip
pip3 install pyzmq --install-option="--zmq=/usr/lib"
pip3 install jupyter
ximeg /
Created Apr 20, 2017
Python implementation of smoothed z-score algorithm from
#!/usr/bin/env python
# Implementation of algorithm from
import numpy as np
import pylab
def thresholding_algo(y, lag, threshold, influence):
signals = np.zeros(len(y))
filteredY = np.array(y)
avgFilter = [0]*len(y)
stdFilter = [0]*len(y)
anonymous / gist:8564133
Created Jan 22, 2014
Print view of large pandas DataFrame. Modified from bigbug:
View gist:8564133
import pandas
def _sw(df, up_rows=10, down_rows=5, left_cols=4, right_cols=3, return_df=False):
''' display df data at four corners
A,B (up_pt)
C,D (down_pt)
parameters : up_rows=10, down_rows=5, left_cols=4, right_cols=3
df = pd.DataFrame(np.random.randn(20,10), columns=list('ABCDEFGHIJKLMN')[0:10])
davfre /
Last active Sep 23, 2020
git commandline cheat-sheet
EyalAr /
Created Dec 11, 2013
Demo code for my post about python's blocking stream reading functions.
from subprocess import Popen, PIPE
from time import sleep
# run the shell as a subprocess:
p = Popen(['python', ''],
stdin = PIPE, stdout = PIPE, stderr = PIPE, shell = False)
# issue command:
# let the shell output the result:
kirpit /
Last active Aug 31, 2020
Enables to run subprocess commands in a different thread with TIMEOUT option!
#! /usr/bin/env python
import threading
import subprocess
import traceback
import shlex
class Command(object):
Enables to run subprocess commands in a different thread with TIMEOUT option.
brantfaircloth /
Created Oct 1, 2011
Python multiprocessing: multiple producers, single consumer
import time
import random
from multiprocessing import Process, Queue, JoinableQueue, cpu_count
""" Adjust time.sleep() values to see action of consumer """
def work(id, jobs, result):
while True:
task = jobs.get()
if task is None:
You can’t perform that action at this time.