Skip to content

Instantly share code, notes, and snippets.

View manashmandal's full-sized avatar
👨‍💻
Probably Coding || ! Probably Coding

Manash Kumar Mandal manashmandal

👨‍💻
Probably Coding || ! Probably Coding
View GitHub Profile
@manashmandal
manashmandal / dt_sentiment_plot.r
Created October 12, 2016 08:03
Plotting sentiment
install.packages('ggplot2')
require(ggplot2)
df <- data.frame(Sentiment = c('Positive', 'Negative'), Count = c(174, 115))
ggplot(df, aes(Sentiment, Count)) + geom_bar(stat="identity")
@manashmandal
manashmandal / wordcloud.py
Created October 12, 2016 09:23
Donald trump word cloud
# Dependencies:
# NLTK
# WordCloud
# Scikit-learn
# Matplotlib
# Scipy
# Python version: 2.7
%matplotlib inline
@manashmandal
manashmandal / dtrump.py
Created October 12, 2016 09:36
Predictive analysis
status_updates = ['JOIN ME FOR A FEW MINUTES IN PANAMA CITY BEACH, FLORIDA. This is a MOVEMENT like never seen before- and will never be seen again. This is our last chance- lets MAKE AMERICA SAFE AND GREAT AGAIN!', 'I would like to wish everyone who is observing the solemn and holy day of Yom Kippur an inspirational day of reflection. We hope that everyone’s prayers are answered and that we all have a year of peace, security, good health, prosperity and blessings. -DJT', 'JOIN ME FOR A FEW MINUTES IN PANAMA CITY BEACH, FLORIDA. This is a MOVEMENT like never seen before- and will never be seen again. This is our last chance- lets MAKE AMERICA SAFE AND GREAT AGAIN!', 'I would like to wish everyone who is observing the solemn and holy day of Yom Kippur an inspirational day of reflection. We hope that everyone’s prayers are answered and that we all have a year of peace, security, good health, prosperity and blessings. -DJT', 'Great morning in San Antonio, Texas - GREAT afternoon in Dallas, Texas. Departing now
import pandas as pd
import geoip2.database
mmdb_path = 'C:\\Users\\Manash\\Downloads\\Compressed\\GeoLite2-Country.mmdb\\GeoLite2-Country.mmdb'
ipaddress_path = 'C:\\Users\\Manash\\Downloads\\IP_Address.csv'
ipdf = pd.read_csv(ipaddress_path)
reader = geoip2.database.Reader(mmdb_path)
for ip in ipdf['IP Address']:
@manashmandal
manashmandal / jupyter_scrapy.py
Created October 21, 2016 13:43
Scrapy in jupyter notebook
#http://stackoverflow.com/questions/26177620/how-to-execute-scrapy-shell-url-with-notebook
import requests
from scrapy.http import TextResponse
r = requests.get('http://stackoverflow.com/')
response = TextResponse(r.url, body=r.text, encoding='utf-8')
@manashmandal
manashmandal / data_file.txt
Created November 9, 2016 16:46
Load N col, M row based files
x1,x2,x3,x4,x5
1,2,3,4,5
2,3,4,5,6
4,5,6,6,7
@manashmandal
manashmandal / load_export.R
Created November 14, 2016 22:01
Load SPSS and Export CSV with variable names
require('foreign')
spss_data <- read.spss('file.sav', use.value.labels = TRUE)
write.csv(spss_data, 'out_file.csv')
@manashmandal
manashmandal / FTDI_Basic_Hookup_for_ESP-01.jpg
Created November 17, 2016 19:57 — forked from stonehippo/FTDI_Basic_Hookup_for_ESP-01.jpg
Notes on using the ESP8266 with the Arduino IDE
FTDI_Basic_Hookup_for_ESP-01.jpg
@manashmandal
manashmandal / check.ino
Last active November 18, 2016 14:59
LM35
#define BAUD 9600
class LM35 {
private:
byte pin;
unsigned int reading;
public:
LM35(byte pin){
pin = pin;