Skip to content

Instantly share code, notes, and snippets.

@boyihu
boyihu / gist:96a89760d6fe656b723a2fbfde1fc111
Created February 13, 2018 17:08 — forked from andrewgiessel/gist:4514186
butterworth bandpass filter in python
from scipy.signal import butter, lfilter
def butter_bandpass_filter(data, lowcut, highcut, fs, order=5):
nyq = 0.5 * fs
low = lowcut / nyq
high = highcut / nyq
b, a = butter(order, [low, high], btype='band')
y = lfilter(b, a, data)
return y
@boyihu
boyihu / ipython_fft_example.ipynb
Created February 13, 2018 13:25 — forked from jedludlow/ipython_fft_example.ipynb
IPython Notebook FFT Example
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@boyihu
boyihu / remez_examples.py
Created February 13, 2018 01:26 — forked from WarrenWeckesser/remez_examples.py
Examples of designing a FIR filter with scipy.signal.remez.
from __future__ import division, print_function
import numpy as np
from scipy import signal
import matplotlib.pyplot as plt
def plot_response(fs, w, h, title):
plt.figure()
plt.plot(0.5*fs*w/np.pi, 20*np.log10(np.abs(h)))
@boyihu
boyihu / resize.sh
Created February 2, 2017 03:57 — forked from carpedm20/resize.sh
Image-net 2012
#!/bin/sh
image_path=/home/carpedm20/imagenet
for name in $image_path/val/*.JPEG; do
convert -resize 256x256\! $name $name
done
@boyihu
boyihu / convnet_test.py
Created January 4, 2017 16:35 — forked from axel-angel/convnet_test.py
Caffe script to compute accuracy and confusion matrix
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Author: Axel Angel, copyright 2015, license GPLv3.
import sys
import caffe
import numpy as np
import lmdb
import argparse
@boyihu
boyihu / gist:a7ca16f21c1cf82e11820764bf686267
Created November 2, 2016 17:00 — forked from faleev/gist:3435377
Compile FFmpeg on Ubuntu

Compile FFmpeg on Ubuntu

This guide supports Ubuntu Precise Pangolin 12.04, Ubuntu Oneiric Ocelot 11.10, Ubuntu Natty Narwhal 11.04, and Ubuntu Maverick Meerkat 10.10. Separate guides are available for Ubuntu Lucid Lynx 10.04 and Ubuntu Hardy Heron 8.04. This guide will enable several external encoding and decoding libraries: libfaac (AAC encoder), libfdk-aac (AAC encoder), libmp3lame (MP3 encoder), libopencore-amr (AMR encoder/decoder), librtmp (for additional RTMP protocols), libtheora (Theora encoder), libvorbis (Vorbis encoder), libvpx (VP8 encoder/decoder), and libx264 (H.264 encoder). These are optional and may be omitted if desired. This guide will also install many filters (see the filter list in the [Filtering Guide](https://ffmpeg.org/trac/ffmpeg/wiki/Fi

@boyihu
boyihu / install_ffmpeg_ubuntu.sh
Created November 2, 2016 16:37 — forked from xdamman/install_ffmpeg_ubuntu.sh
Install latest ffmpeg on ubuntu 12.04 or 14.04
#!/bin/bash
# Bash script to install latest version of ffmpeg and its dependencies on Ubuntu 12.04 or 14.04
# Inspired from https://gist.github.com/faleev/3435377
# Remove any existing packages:
sudo apt-get -y remove ffmpeg x264 libav-tools libvpx-dev libx264-dev
# Get the dependencies (Ubuntu Server or headless users):
sudo apt-get update