Skip to content

Instantly share code, notes, and snippets.

View endolith's full-sized avatar
😑

endolith

😑
View GitHub Profile
@endolith
endolith / bootstrap.ipynb
Created November 6, 2019 18:01 — forked from kjordahl/bootstrap.ipynb
Gaussian process bootstrap plots in iPython notebook
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@endolith
endolith / heart_wave_plotter.py
Last active November 5, 2019 02:48
Heartbeat waveform plotter for SpO2 Assistant
from pandas import read_csv
import matplotlib.pyplot as plt
import numpy as np
filename = '20181113000029_wave.csv'
offset = 0 # In samples, the point at which you want the plotting to start
data = read_csv(filename)
data = data[offset:]
@endolith
endolith / window_properties.py
Last active November 19, 2019 22:05
Window function property testing
"""
Created on Wed Aug 03 11:56:41 2016
"""
from scipy.signal.windows import (boxcar, hann, hamming, bartlett, bohman,
blackman, parzen, blackmanharris, cosine,
kaiser, tukey, gaussian)
from scipy.fftpack import fft
import numpy as np
import matplotlib.pyplot as plt
@endolith
endolith / Condorcet.py
Created August 2, 2019 19:28
two variations of Condorcet-Schulze voting algorithms [by Russ Paielli]
#!/usr/bin/env python
# alpha release 2005-02-04
# This python script by Russ Paielli implements two variations of
# Condorcet-Schulze voting algorithms and provides associated
# input/output utilities. To try it, type
# Condorcet.py <input> <output>
@endolith
endolith / CondorcetSSD.py
Created August 2, 2019 19:27
Cloneproof Condorcet SSD [by Mike Ossipoff and Russ Paielli]
#!/usr/bin/env python
# Copyright (C) 2002 by Mike Ossipoff and Russ Paielli
# version 1.0 - released 2002-02-14
# version 1.01 - released 2002-08-24 -- comments revised slightly
# version 1.02 - released 2004-02-14 -- comments revised slightly
# See http://ElectionMethods.org/CondorcetSSD.py for updates.
# See http://ElectionMethods.org for related informatioin.
@endolith
endolith / fftconv-conv-timings-2d.ipynb
Created July 24, 2019 19:19 — forked from stsievert/fftconv-conv-timings-2d.ipynb
constant timing for convolution methods (fft and direct)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@endolith
endolith / DFT_ANN.py
Last active April 30, 2025 19:25
Training neural network to implement discrete Fourier transform (DFT/FFT)
"""
Train a neural network to implement the discrete Fourier transform
"""
import matplotlib.pyplot as plt
import numpy as np
from tensorflow.keras.layers import Dense
from tensorflow.keras.models import Sequential
N = 32
batch = 10000
@endolith
endolith / mzti.m.py
Last active August 2, 2019 19:30
MZTi Matched Z-Transform improved lowpass example [by karrikuh, Matlab→Python translation]
from numpy import pi, exp, tan, sqrt, log10
import numpy as np
from scipy import signal
import matplotlib.pyplot as plt
def lp2_mzti(w0=None, K=None):
"""
Digital 2nd order lowpass filter design using
improved Matched Z transform (MZTi)
@endolith
endolith / finite_scroll.txt
Last active January 8, 2024 12:31
Adblock ublock kill infinite scrolling
! Title: Finite Scroll (kills infinite scrolling)
! Last modified: 2017-10-24
! Homepage: https://gist.github.com/endolith/72ac5e69e037be02b118adbedcdeac59
! This URL: https://gist.githubusercontent.com/endolith/72ac5e69e037be02b118adbedcdeac59/raw/finite_scroll.txt
! TODO: Add these scripts: https://infinite-scroll.com/
! Forbes infinite scroll (and all other AJAX)
import numpy as np
from numpy import exp, sqrt, pi, cos, sin, e
import matplotlib.pyplot as plt
from scipy import optimize
import warnings
warnings.filterwarnings("ignore",".*GUI is implemented.*")
from scipy._lib._util import check_random_state
from scipy.optimize._basinhopping import AdaptiveStepsize, RandomDisplacement