Skip to content

Instantly share code, notes, and snippets.

View KanishkVashisht's full-sized avatar

Kanishk Vashisht KanishkVashisht

View GitHub Profile
export PATH_TO_FX = /path/to/javafx
export JAVA_HOME = /Library/Java/JavaVirtualMachines/jdk-12.0.2.jdk/Contents/Home #might be a bit different
sudo $JAVA_HOME/bin/jlink --module-path $PATH_TO_FX --add-modules java.se,javafx.base --bind-services --output /Library/Java/JavaVirtualMachines/jdkfx-12.0.2.jdk
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdkfx-12.0.2.jdk/
@KanishkVashisht
KanishkVashisht / geocoder.py
Created January 28, 2019 18:35
geocoder using gmaps client
#geocoding function using googlemaps python client
def geocode(address):
try: geocode_result = gmaps.geocode(address)
except:
print("Exception occured for "+address)
return (None, None, None)
geocode_result = geocode_result[0]
return (geocode_result['geometry']['location']['lat'],
geocode_result['geometry']['location']['lng'],
geocode_result['place_id']
@KanishkVashisht
KanishkVashisht / run-nightmare-xvfb
Created August 3, 2018 05:44
Simple script to run nightmare with Xvfb on digital ocean
#dependencies
apt-get update &&\
apt-get install -y libgtk2.0-0 libgconf-2-4 \
libasound2 libxtst6 libxss1 libnss3 xvfb
npm install segmentio/nightmare
# Start Xvfb
Xvfb -ac -screen scrn 1280x2000x24 :9.0 & export DISPLAY=:9.0
#I would usually format it by breaking the line at & but if you dont run the export in the same statement it doesnt seem to work
"""
Using extreme gradient boosting to predict the price of a taxi from point a to point b using google public data
"""
#importing libs
from numpy import loadtxt
from xgboost import XGBRegressor
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
import pandas as pd
@KanishkVashisht
KanishkVashisht / reverse_geocoder.py
Created March 5, 2018 22:06
Takes an input longitude and latitude from a csv where lat,long is column 0,1 -> Zip code as an output.
import csv
import requests
import json
#all you need to edit
INPUT_FILE = "";
OUTPUT_FILE = "";
API_KEY = "";