Skip to content

Instantly share code, notes, and snippets.

View rischanlab's full-sized avatar
💭
I may be slow to respond.

Rischan Mafrur rischanlab

💭
I may be slow to respond.
View GitHub Profile
@rischanlab
rischanlab / subfigure_in_Latex.tex
Last active August 29, 2015 14:01
Latex Subfigure
% Sub Figure in Latex
% Rischan Mafrur
% May 10, 2014
\begin{figure}
\begin{subfigure}{.25\textwidth}
\centering
\includegraphics[width=\textwidth]{tweet_tolak.png}
\caption{Caption Sub Figure A}
\label{fig:label_a}
@rischanlab
rischanlab / unfollow_nonfollowers.py
Last active August 29, 2015 14:01
Unfollow Twitter NonFollowers bulk [python]
def unfollow():
api = setup_api(consumer_key, consumer_secret, access_key, access_secret)
i = 0
while True:
try:
for page in Cursor(api.friends).pages():
print 'page:', i
f = open('out.txt','a')
f.write(str(datetime.now()) + ' Page ' + str(i) + '\n')
f.close()
@rischanlab
rischanlab / getBio.php
Last active August 29, 2015 14:01
Get twitter Bio using Twitter API Exchange [PHP]
<?php
/** Just simple code to get twitter Account Bio **/
/** Rischan Mafrur **/
/** April 28 2014 **/
ini_set('display_errors', true);
// set display error
@rischanlab
rischanlab / usagepackage.tex
Last active August 29, 2015 14:01
Standard Requirement Package in Latex
%Rischan Mafrur
%May 2014
% Cite and Caption
\usepackage{cite}
\usepackage{caption}
\usepackage{refstyle}
% this is package for write algorithm
\usepackage{algorithm}
@rischanlab
rischanlab / NaiveBayes.R
Created May 20, 2014 02:54
NaiveBayes in R
#author : Rischan Mafrur
#email : rischanlab@gmail.com
#website : rischanlab.github.io, ourmasjid.me
#May 15, 2014
#install requirement packages
install.packages("klaR")
install.packages("caret")
#loading library
@rischanlab
rischanlab / Bot.sh
Last active August 29, 2015 14:01
Simple MySQL User and DB management
#Dont forget to install this, if you use python to accessing your MySQL db
apt-get install libmysqlclient-dev python-dev
#If you wanna to use python MySQL and tweepy, you can install it
sudo pip install tweepy
sudo pip install MySQL-python
#Change root password
mysql => UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root'; FLUSH PRIVILEGES;
@rischanlab
rischanlab / NaiveBayes_MyProject.R
Created May 20, 2014 06:43
Twitter accounts classification using Naive Bayes in R
#author : Rischan Mafrur
#email : rischanlab@gmail.com
#website : rischanlab.github.io, ourmasjid.me
#May 15, 2014
#install requirement packages
install.packages("klaR")
install.packages("caret")
install.packages("plotrix")
@rischanlab
rischanlab / RandomForest.R
Created May 24, 2014 02:52
RandomForest in R
install.packages("randomForest",dependencies=TRUE)
library(randomForest)
fit <- randomForest(data$user ~ data$academic+data$email
+data$socnet+data$porn+data$comic+data$music
+data$shop+data$blog+data$video+data$search
+data$news, data=data)
print(fit)
importance(fit)
#to make the final table, I changed manually the n size every trial by: 1e3, 1e4, 1e5, 1e6, 1e7. Then I also chnaged the benchmark object 'res'
n <- 1e7
set.seed(51)
process <- data.frame(id=sample(100, n, rep=T), x=rnorm(n), y=runif(n), z=rpois(n, 1) pexp(2, rate=1/3) )
all <- multicore:::detectCores(all.tests=TRUE)
if(!require(rbenchmark)){
install.packages("rbenchmark")
} else{
@rischanlab
rischanlab / preprocessing_data.R
Last active September 16, 2015 04:00
This source code is for preprocessing our research data (personal user data behavior data)
### Author Information #####
### Coded by Rischan Mafrur ###
### 01/01/2015 ###
### For Thesis Purpose ###
### Language : R ###
### Dataset : Private Data ###
#Function for loading data
f_load_data <- function(path){
library(shiny)