Skip to content

Instantly share code, notes, and snippets.

View akshayjh's full-sized avatar
🚀

Akshay jha akshayjh

🚀
  • Hyperdimensions
  • pune
View GitHub Profile
@akshayjh
akshayjh / sources.list
Created July 7, 2016 07:05 — forked from pichuang/sources.list
Kali Linux source.list /etc/apt/sources.list
deb http://kali.cs.nctu.edu.tw/ /kali main contrib non-free
deb http://kali.cs.nctu.edu.tw/ /wheezy main contrib non-free
deb http://kali.cs.nctu.edu.tw/kali kali-dev main contrib non-free
deb http://kali.cs.nctu.edu.tw/kali kali-dev main/debian-installer
deb-src http://kali.cs.nctu.edu.tw/kali kali-dev main contrib non-free
deb http://kali.cs.nctu.edu.tw/kali kali main contrib non-free
deb http://kali.cs.nctu.edu.tw/kali kali main/debian-installer
deb-src http://kali.cs.nctu.edu.tw/kali kali main contrib non-free
deb http://kali.cs.nctu.edu.tw/kali-security kali/updates main contrib non-free
deb-src http://kali.cs.nctu.edu.tw/kali-security kali/updates main contrib non-free
@akshayjh
akshayjh / taxes.py
Created October 25, 2016 07:13 — forked from tristanwietsma/taxes.py
Real estate tax web scraper
import sys, re
from string import join
import requests
r = requests.get("http://www.co.kane.il.us/TaxAssessment/Treasurer.aspx?parcelnumber=" + sys.argv[1])
text = r.text
ADDRESS = """<span id="lblPropertyAddress[0-9]" style="display:inline-block;">([A-Za-z0-9 ,-.]*)</span><br />"""
TAXES = """TaxYear=(\d\d\d\d)">(\d\d\d\d|Current Year)</a></td><td>([0-9.]*)</td>"""
RATE = """<span id="lblTaxRate" style="display:inline-block;"><font face="Arial">([0-9.]*)</font></span><br />"""
@akshayjh
akshayjh / WebScrape.R
Created November 2, 2016 07:17 — forked from zachmayer/WebScrape.R
Scrape Web Data
rm(list = ls(all = TRUE)) #CLEAR WORKSPACE
library(quantmod)
#Scrape data from the website
library(XML)
rawPMI <- readHTMLTable('http://www.ism.ws/ISMReport/content.cfm?ItemNumber=10752')
PMI <- data.frame(rawPMI[[1]])
names(PMI)[1] <- 'Year'
#Reshape
@akshayjh
akshayjh / FacebookFromR.r
Created November 9, 2016 11:53 — forked from epijim/FacebookFromR.r
scrape facebook from R. Based off
###############################################################################################
## ##
## Setup ##
## ##
###############################################################################################
# install.packages("Rfacebook") # from CRAN
# install.packages("Rook") # from CRAN
# install.packages("igraph") # from CRAN
@akshayjh
akshayjh / ml-with-c50-credits.R
Created February 11, 2017 11:53 — forked from hopped/ml-with-c50-credits.R
Identifying risky bank loans using C5.0 with boosting and cost matrix
# Download data set via:
# http://archive.ics.uci.edu/ml/datasets/Statlog+%28German+Credit+Data%29
#
# Note, the example below uses the pre-processed data that is used in the book 'Machine Learning with R' by Brett Lantz
library(C50)
df <- read.csv("credit.csv", stringsAsFactors=TRUE)
set.seed(12345)
df_rand <- df[order(runif(1000)),]
@akshayjh
akshayjh / example1.py
Last active March 16, 2017 11:29 — forked from onyxfish/example1.py
Basic example of using NLTK for name entity extraction.
import nltk
with open('sample.txt', 'r') as f:
sample = f.read()
sentences = nltk.sent_tokenize(sample)
tokenized_sentences = [nltk.word_tokenize(sentence) for sentence in sentences]
tagged_sentences = [nltk.pos_tag(sentence) for sentence in tokenized_sentences]
chunked_sentences = nltk.ne_chunk_sents(tagged_sentences, binary=True)
@akshayjh
akshayjh / pos_tagging.py
Created March 21, 2017 09:43 — forked from gupul2k/pos_tagging.py
NER and POS Tagging with NLTK and Python
#Script tags POS and NER[Named Entity Recognition] for a supplied text file.
#Date: Nov 2 2012
#Author: Hota Sobhan
import nltk
f = open('C:\Python27\Test_File.txt')
data = f.readlines()
#Parse the text file for NER with POS Tagging
@akshayjh
akshayjh / nltk_tokenize_tag_chunk.rst
Created March 22, 2017 03:57 — forked from japerk/nltk_tokenize_tag_chunk.rst
NLTK Tokenization, Tagging, Chunking, Treebank

Sentence Tokenization

>>> from nltk import tokenize >>> para = "Hello. My name is Jacob. Today you'll be learning NLTK." >>> sents = tokenize.sent_tokenize(para) >>> sents ['Hello.', 'My name is Jacob.', "Today you'll be learning NLTK."]

@akshayjh
akshayjh / convert_csv_to_json
Created April 11, 2017 14:25 — forked from d4rk8l1tz/convert_csv_to_json
Python : Convert CSV to JSON (line by line)
def convertCSVtoJSON(input): #pass the name of the input csv file
f = open(input, 'r')
j = open('.tempJSON', 'w')
fieldnames = ("field1,field2,field3")
reader = csv.DictReader(f, fieldnames)
for row in reader:
json.dump(row, j)
j.write('\n')
f.close()
j.close()