Skip to content

Instantly share code, notes, and snippets.

View BenKnisley's full-sized avatar

Ben Knisley BenKnisley

View GitHub Profile
@BenKnisley
BenKnisley / gist:4f74d5861945c67f604f4ac12601e26d
Created April 17, 2018 14:27 — forked from sebpiq/gist:4128537
Python implementation of the Goertzel algorithm for calculating DFT terms
import math
def goertzel(samples, sample_rate, *freqs):
"""
Implementation of the Goertzel algorithm, useful for calculating individual
terms of a discrete Fourier transform.
`samples` is a windowed one-dimensional signal originally sampled at `sample_rate`.
The function returns 2 arrays, one containing the actual frequencies calculated,

Keybase proof

I hereby claim:

  • I am benknis on github.
  • I am benknis (https://keybase.io/benknis) on keybase.
  • I have a public key whose fingerprint is 55A1 3BFD F45D C0E4 5CCF 0B6F 6843 0148 E31F 2285

To claim this, I am signing this object:

@BenKnisley
BenKnisley / gist:e213bbe878af36117532
Created May 16, 2015 13:55
Linux Command to Print File
lp -d <printer> <file>
Example:
lp -d Canon-MX350 test.pdf
@BenKnisley
BenKnisley / Create Traffic Monitor
Created May 10, 2015 12:37
Iptables Traffic Monitor
## Create new chain
iptables -N <Name>
## Create outgoing monitor
iptables -A INPUT -s <IpAddr> -j <Name>
## Create incoming monitor
iptables -D INPUT -s <IpAddr> -j <Name>
sudo apt-add-repository ppa:benknis/repono
sudo apt-get update
sudo apt-get install repono
@BenKnisley
BenKnisley / Python Server-Client Pair
Last active August 29, 2022 09:50
Two way communication Python Server-Client pair
Simple Python Server-Client Pair With Two Way Communication