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
ximeg / ThresholdingAlgo.py
Created Apr 20, 2017
Python implementation of smoothed z-score algorithm from http://stackoverflow.com/a/22640362/6029703
View ThresholdingAlgo.py
#!/usr/bin/env python
# Implementation of algorithm from http://stackoverflow.com/a/22640362/6029703
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
anonymous / gist:8564133
Created Jan 22, 2014
Print view of large pandas DataFrame. Modified from bigbug: http://stackoverflow.com/a/15786557/28035
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
usage:
df = pd.DataFrame(np.random.randn(20,10), columns=list('ABCDEFGHIJKLMN')[0:10])
df.sw(5,2,3,2)
@davfre
davfre / git_cheat-sheet.md
Last active Dec 13, 2019
git commandline cheat-sheet
View git_cheat-sheet.md
@EyalAr
EyalAr / client.py
Created Dec 11, 2013
Demo code for my post about python's blocking stream reading functions.
View client.py
from subprocess import Popen, PIPE
from time import sleep
# run the shell as a subprocess:
p = Popen(['python', 'shell.py'],
stdin = PIPE, stdout = PIPE, stderr = PIPE, shell = False)
# issue command:
p.stdin.write('command\n')
# let the shell output the result:
sleep(0.1)
@kirpit
kirpit / bash.py
Last active Aug 13, 2019
Enables to run subprocess commands in a different thread with TIMEOUT option!
View bash.py
#! /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
brantfaircloth / mult_prod_single_consume.py
Created Oct 1, 2011
Python multiprocessing: multiple producers, single consumer
View mult_prod_single_consume.py
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.