Skip to content

Instantly share code, notes, and snippets.

James Bowler JamesKBowler

  • Data Centauri Ltd
  • Cheshire UK
Block or report user

Report or block JamesKBowler

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
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 Dec 13, 2019
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 13, 2019
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.