Skip to content

Instantly share code, notes, and snippets.


Parag K Mital pkmital

View GitHub Profile
View gist:77d8c768d9cf66cef7c0
# Example using Decision Trees
import numpy as np
import matplotlib.pylab as plt
%matplotlib inline
all_data = []
with open("data.txt") as input_file:
for line in input_file:
all_data.append([item.replace('\r\n', '') for item in line.split('\t')[1:]])
X = np.vstack(all_data[1:11]).astype(float).transpose() # inputs
pkmital / gist:8a15555d3b29eabaa606
Created May 15, 2015
draw error ellipse from covariance matrix
View gist:8a15555d3b29eabaa606
#include <iostream>
#include <cmath>
//You need OpenCV for this demo
#include <opencv2\core\core.hpp>
#include <opencv2\highgui\highgui.hpp>
cv::RotatedRect getErrorEllipse(double chisquare_val, cv::Point2f mean, cv::Mat covmat);
pkmital / gist:cb828230210e685d628f
Created Apr 24, 2015
YouTube Smash Up - Download Script
View gist:cb828230210e685d628f
youtube-dl --playlist-end 10 -o '%(playlist_index)s.%(ext)s'
for i in `ls *.mp4`; do `ffmpeg -i $i -vn -y "$i".wav`; done
youtube-dl -J --playlist-end 10 | json_reformat > titles.json
#output=$(youtube-dl -J --playlist-end 10 <&3)
#echo $output > titles.json
View gist:c1aa20cc2b8a1f38f8d1

This is my implementation of tanh for CUDA:

#include <iostream>
#include <math.h>
#include <cuComplex.h>
#include <complex>

typedef double     rtype;
pkmital / notebook-css
Last active Aug 29, 2015
View notebook-css
html {
font-size: 62.5% !important; }
body {
font-size: 1.5em !important; /* currently ems cause chrome bug misinterpreting rems on body element */
line-height: 1.6 !important;
font-weight: 400 !important;
font-family: "Raleway", "HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif !important;
color: #222 !important; }
View gist:a82ae18c117f3e6e1974
ruby -e "$(curl -fsSL"
brew install libvorbis --universal libsndfile --universal libogg --universal flac --universal
curl -O
tar -xvf vamp-plugin-sdk-2.5.tar.gz
cd vamp-plugin-sdk-2.5
make -f build/Makefile.osx
pkmital / asyncreadback.cpp
Created Aug 16, 2012
asynchronous readback
View asyncreadback.cpp
void setup()
pboIds = new GLuint[2];
pboIds[0] = 0; pboIds[1] = 0;
const int DATA_SIZE = screenWidth * screenHeight * 4;
const int PBO_COUNT = 2;
glGenBuffersARB(PBO_COUNT, pboIds);
glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, pboIds[0]);
pkmital / stlVectorTest
Created Aug 25, 2011
seeing if stl vector really keeps data contiguous
View stlVectorTest
#include <vector>
#include <iostream>
using namespace std;
typedef float T;
int main()
int data_size = 512;
vector<T *> data;