Skip to content

Instantly share code, notes, and snippets.

View vvksh's full-sized avatar

Vivek Sah vvksh

View GitHub Profile
@vvksh
vvksh / rolling_mean.py
Created November 18, 2017 21:32
plot of rolling mean using pandas
#say `x` is list of noisy values
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
x = np.random.uniform(size=100)
mean_x = pd.Series(x).rolling(window=2).mean()
@vvksh
vvksh / foogle_mainActivity.java
Created December 18, 2015 06:01
Gets the menu of the nearest restaurant
package com.vivek.foogle;
import android.app.PendingIntent;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.location.Location;
import android.net.ParseException;
import android.app.Notification;
@vvksh
vvksh / classifier.py
Created December 18, 2015 05:50
Implementation of K-Nearest neighbor classification algorithm
class KNN(Classifier):
def __init__(self, dataObj=None, headers=[], categories=None, K=None):
'''Take in a Data object with N points, a set of F headers, and a
matrix of categories, with one category label for each data point.'''
# call the parent init with the type
Classifier.__init__(self, 'KNN Classifier')
# store the headers used for classification
self.headers = headers
@vvksh
vvksh / pi_chair.py
Last active December 18, 2015 06:14
Smart Chair which tracks weight of the person sitting on it over a period of time. Also updates a google spreadsheet automatically which can be used to track the changes. Uses raspberry PI and ultrasonic range finder to turn a simple chair into a smart chair.
import RPi.GPIO as GPIO
import time
import json
import gspread
from oauth2client.client import SignedJwtAssertionCredentials
import datetime
#Access to Google spreadsheet for storing data
json_key = json.load(open('clientid.json'))
@vvksh
vvksh / FollowActivity.java
Created December 18, 2015 05:22
An activity class for OnTrack android application(location sharing app). Describes the process when a user enters a session with a passcode to see the location of people who are in that session.
package edu.colby.ontrack.ontrack;
import android.content.Intent;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
@vvksh
vvksh / freeflix.py
Created December 18, 2015 05:12
Gets the streaming link of a movie/TV from a popular streaming website and plays it in your native video player
"""author: VIvek Sah
filename: freeFlix.py v3.0
description: takes the search input from command line. searches putlocker.is database for that movie,
gets te source file, and opens the file in a browser
"""
from selenium import webdriver
from Tkinter import *
import re
import subprocess