Skip to content

Instantly share code, notes, and snippets.

Avatar
🤨

endolith

🤨
View GitHub Profile
@endolith
endolith / cyclic_noise.py
Last active October 21, 2022 00:52
Cyclic noise from filtering white noise in Python
View cyclic_noise.py
import numpy as np
import matplotlib.pyplot as plt
from scipy.ndimage import gaussian_filter
rng = np.random.default_rng()
# shape = (1024, )
# shape = (512, 512)
shape = (128, 128, 128)
@endolith
endolith / db_to_gpx.py
Created September 9, 2022 01:08
Maprika sqlite database to GPX track converter
View db_to_gpx.py
"""
Written by GPT3 from this English prompt (with one tweak to the prompt, to get
the timestamp parameter to not error out, and PEP8 fixes):
----
1. Open a sqlite database with a name like `2022-07-17 17.48.19.db` or
`2021-04-11 08.44.16.db`
2. Inside is a table called `locations`, with headers [LOCTYPE INTEGER,
TIMESTAMP BIGINT, LATITUDE REAL, LONGITUDE REAL,ALTITUDE REAL, ACCURACY
@endolith
endolith / estimated_variance_of_estimated_probability.py
Created July 10, 2022 19:15
Confirm the formula for estimating the variance of an estimated probability.
View estimated_variance_of_estimated_probability.py
"""
Confirm the formula for estimating the variance of an estimated probability.
Created on Fri May 27 11:06:43 2022
"""
import numpy as np
def func(x):
"""
@endolith
endolith / FIR_filter_NN.py
Last active November 25, 2022 21:54
Neural network learning FIR filter
View FIR_filter_NN.py
"""
Train a neural network to learn an FIR filter.
Created on Fri Aug 3 15:00:40 2018
"""
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense
from tensorflow.keras.callbacks import Callback
import numpy as np
from scipy import signal
@endolith
endolith / pinned
Created January 18, 2022 17:41
Windows 7 conda "pinned" file
View pinned
python 3.8.*
scikit-learn ==0.24.1
@endolith
endolith / zfft.py
Created August 14, 2021 18:36 — forked from aluchies/zfft.py
Zoom FFT functionality. Includes implementation of chirpz transform.
View zfft.py
""" Zoom FFT function"""
import numpy as np
from time import time
from scipy.fftpack import fft, ifft
from numpy import swapaxes
def chirpz(x, A=None, W=None, M=None):
"""chirpz(x, A, W, M) - Chirp z-transform of variable x
@endolith
endolith / Weber 1977 all transcriptions.md
Last active February 23, 2021 04:30
Some quotes from Weber (1978) "Comparison of Public Choice Systems"
View Weber 1977 all transcriptions.md

Weber (1978). "Comparison of Public Choice Systems".

I can't find any online OCRed copy of this content, so I'm transcribing a bunch of stuff.

Citation:

Actually this contains three previous unpublished papers, which is why it's sometimes listed as "1977". Example citations for the individual papers:

@endolith
endolith / harris_sivian.py
Last active February 28, 2022 17:30
Brownian noise of air
View harris_sivian.py
"""
Created on Wed Nov 04 11:34:53 2015
"""
from numpy import logspace, log10, sqrt, pi
import matplotlib.pyplot as plt
from audio_electronics_shortcuts import dB
import pint
u = pint.UnitRegistry()
@endolith
endolith / readme.md
Last active January 30, 2022 01:40
How to extract images from PDF files recursively in folders in fish shell
View readme.md

Dependencies

sudo apt install poppler-utils imagemagick

To extract all the images:

for file in **.pdf
    pdfimages -all "$file" "$file"
end
View WAV output.asc
Version 4
SHEET 1 880 680
FLAG 64 144 0
FLAG 64 64 signal
IOPIN 64 64 Out
SYMBOL voltage 64 48 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V1
SYMATTR Value SINE(0 1 2000)