Skip to content

Instantly share code, notes, and snippets.

View nikolaypavlov's full-sized avatar

Mykola Pavlov nikolaypavlov

View GitHub Profile
@nikolaypavlov
nikolaypavlov / cfar.c
Created September 9, 2014 15:40
Constant False Alarm Rate (CFAR) Detection
#include <stdio.h>
#include <math.h>
const int buffSize = 4;
const float false_rate = 0.01;
float train_cell1[buffSize] = {-0.1980671, 0.9246765, 0.3704300, 1.1070784};
float train_cell2[buffSize] = {-0.02937893, -0.90626937, -0.85622522, 0.49817418};
float test_cell[buffSize] = {1.87743553, 0.02268982, -1.41455143, 0.54926504};
@nikolaypavlov
nikolaypavlov / gist:f4832cba720917b16905
Last active August 29, 2015 14:05
Fourth order bandpass IIR filter (100 Hz - 500 Hz)
//
// Fourth order bandpass IIR filter coefficients (100 Hz - 500 Hz, sampling rate 22050 Hz)
//
// a[0]*y[n] + a[1]*y[n-1] + … + a[n]*y[0] = b[0]*x[n] + b[1]*x[m-1] + … + b[m]*x[0]
//
#include <stdio.h>
const double a[5] = {1, -3.91745514489661, 5.75755576410991, -3.76266550602334, 0.922565876650813};
const double b[5] = {0.000780326282260527, 0, -0.00156065256452105, 0, 0.000780326282260527};

Generate the list yourself:

$ cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS*.sdk/System/Library/Frameworks/UIKit.framework/Headers
$ grep -H UI_APPEARANCE_SELECTOR ./* | sed 's/ __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_5_0) UI_APPEARANCE_SELECTOR;//'

UIActivityIndicatorView

gar.fun<-function(out.var,mod.in,bar.plot=T,x.names=NULL,...){
require(devtools)
source_gist('5086859')
best.wts<-plot.nnet(mod.in,wts.only=T)
out.ind<-which(out.var==colnames(eval(mod.in$call$y)))
#get input-hidden weights and hidden-output weights, remove bias
inp.hid<-data.frame(
plot.nnet<-function(mod.in,nid=T,all.out=T,all.in=T,wts.only=F,rel.rsc=5,circle.cex=5,node.labs=T,
line.stag=NULL,cex.val=1,alpha.val=1,circle.col='lightgrey',pos.col='black',neg.col='grey',...){
require(scales)
#gets weights for neural network, output is list
#if rescaled argument is true, weights are returned but rescaled based on abs value
nnet.vals<-function(mod.in,nid,rel.rsc){
library(scales)