Skip to content

Instantly share code, notes, and snippets.

View moorepants's full-sized avatar

Jason K. Moore moorepants

View GitHub Profile
@ximeg
ximeg / ThresholdingAlgo.py
Created April 20, 2017 07:20
Python implementation of smoothed z-score algorithm from http://stackoverflow.com/a/22640362/6029703
#!/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)
@randallreedjr
randallreedjr / heroku-remote.md
Last active April 25, 2024 07:06
Add a Heroku remote to an existing git repo

Working with git remotes on Heroku

Generally, you will add a git remote for your Heroku app during the Heroku app creation process, i.e. heroku create. However, if you are working on an existing app and want to add git remotes to enable manual deploys, the following commands may be useful.

Adding a new remote

Add a remote for your Staging app and deploy

Note that on Heroku, you must always use master as the destination branch on the remote. If you want to deploy a different branch, you can use the syntax local_branch:destination_branch seen below (in this example, we push the local staging branch to the master branch on heroku.

$ git remote add staging https://git.heroku.com/staging-app.git
@pylover
pylover / a2dp.py
Last active March 11, 2024 03:06
Fixing bluetooth stereo headphone/headset problem in ubuntu 16.04, 16.10 and also debian jessie, with bluez5.
#! /usr/bin/env python3
"""Fixing bluetooth stereo headphone/headset problem in debian distros.
Workaround for bug: https://bugs.launchpad.net/ubuntu/+source/indicator-sound/+bug/1577197
Run it with python3.5 or higher after pairing/connecting the bluetooth stereo headphone.
This will be only fixes the bluez5 problem mentioned above .
Licence: Freeware
@bishboria
bishboria / springer-free-maths-books.md
Last active April 25, 2024 06:27
Springer made a bunch of books available for free, these were the direct links
# .bashrc
################################################################################
# python environment control
################################################################################
export PYTHON_ENV=""
function entervirtualenv
{
if type virtualenvwrapper.sh >/dev/null 2>&1; then
@TimBozeman
TimBozeman / superH
Created May 19, 2014 20:34
A script you can bind to a hotkey that toggles the Hamster Time Tracker window
#!/bin/bash
# @File Switch between current window and Hamster Time Tracker
# get current window
hamster="Time Tracker"
currentWindow=$(xprop -id $(xprop -root 32x '\t$0' _NET_ACTIVE_WINDOW | cut -f 2) _NET_WM_NAME|cut -d'"' -f2)
if [ "${currentWindow}" != "$hamster" ]
# write the title of the current window to a file and switch to hamster
then echo "${currentWindow}" > /tmp/hamster.dat && wmctrl -Fa "$hamster"
# read window temp file and switch to it
@sloria
sloria / bobp-python.md
Last active April 20, 2024 13:02
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@kwmsmith
kwmsmith / pairwise_cython.pyx
Last active August 12, 2022 04:25
Numba vs. Cython: Parallel Cython with OMP
#cython:boundscheck=False
#cython:wraparound=False
import numpy as np
from cython.parallel cimport prange
from libc.math cimport sqrt
cdef inline double dotp(int i, int j, int N, double[:, ::1] X) nogil:
cdef:
int k
import numpy as np
import scipy.linalg.blas
cdef extern from "f2pyptr.h":
void *f2py_pointer(object) except NULL
ctypedef int dgemm_t(
char *transa, char *transb,
int *m, int *n, int *k,
double *alpha,
@stefanschmidt
stefanschmidt / remove-annotations.sh
Last active February 1, 2024 17:01
Remove all annotations from a PDF document
pdftk original.pdf output uncompressed.pdf uncompress
LANG=C sed -n '/^\/Annots/!p' uncompressed.pdf > stripped.pdf
pdftk stripped.pdf output final.pdf compress