Skip to content

Instantly share code, notes, and snippets.

View vvksh's full-sized avatar

Vivek Sah vvksh

View GitHub Profile
@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
@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 / 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 / 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 / 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 / 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()
\documentclass{article}
\usepackage{listings}
\usepackage[dvipsnames,table,xcdraw]{xcolor}
\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{gray}{rgb}{0.5,0.5,0.5}
\definecolor{mauve}{rgb}{0.58,0,0.82}
\lstset{language=Matlab,%
\usepackage{listings}
\usepackage{color}
\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{gray}{rgb}{0.5,0.5,0.5}
\definecolor{mauve}{rgb}{0.58,0,0.82}
\lstset{frame=tb,
language=Java,
aboveskip=3mm,
# Library not loaded: /usr/local/lib/libmysqlclient.18.dylib
sudo ln -s /usr/local/Cellar/mysql/8.0.11/lib/libmysqlclient.dylib /usr/local/lib/libmysqlclient.18.dylib
@vvksh
vvksh / yahooF.py
Created August 4, 2020 15:45
Yahoo finance get last 20 mins of stock data
import requests
import time
def getUrl(symbol):
now = int(time.time())
return "https://query1.finance.yahoo.com/v8/finance/chart/{}?symbol={}&period1={}&period2={}&interval=1m&includePrePost=true&lang=en-US&region=US&corsDomain=finance.yahoo.com".format(symbol, symbol, now-20*60, now)
def main():