Skip to content

Instantly share code, notes, and snippets.

View josefslerka's full-sized avatar

Josef Šlerka josefslerka

View GitHub Profile
library(Matrix)
library(igraph)
library(plyr)
library(Rfacebook)
library(rjson)
library(Hmisc)
###########################################################
# I. stazeni postu a komentaru ze stranky a jejch ulozeni #
###########################################################
# https://developers.facebook.com/tools/explorer/
install.packages("vioplot")
install.packages("plyr")
library(plyr)
library(vioplot)
library(Rfacebook)
library(xlsx)
# http://cran.r-project.org/web/packages/twitteR/twitteR.pdf
library(twitteR)
library(arules)
setup_twitter_oauth("", "", "", "")
followers <- getUser("DolejsJiri")$getFollowers(n=737)
df_followers <- twListToDF(followers)
reduced <- data.frame(df_followers$statusesCount,df_followers$followersCount,df_followers$favoritesCount,df_followers$friendsCount)
colnames(reduced) <- c("statusesCount", "followersCount", "favoritesCount", "friendsCount")
@josefslerka
josefslerka / index.html
Created May 7, 2015 09:19
Jidáš_Iškariotský
<!doctype HTML>
<meta charset = 'utf-8'>
<html>
<head>
<link rel='stylesheet' href='//cdn.oesmith.co.uk/morris-0.4.2.min.css'>
<script src='//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js' type='text/javascript'></script>
<script src='//cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js' type='text/javascript'></script>
<script src='//cdn.oesmith.co.uk/morris-0.4.2.min.js' type='text/javascript'></script>
<!doctype HTML>
<meta charset = 'utf-8'>
<html>
<head>
<link rel='stylesheet' href='//cdn.leafletjs.com/leaflet-0.5.1/leaflet.css'>
<script src='//cdn.leafletjs.com/leaflet-0.5.1/leaflet.js' type='text/javascript'></script>
<script src='//rawgithub.com/leaflet-extras/leaflet-providers/gh-pages/leaflet-providers.js' type='text/javascript'></script>
<script src='//harrywood.co.uk/maps/examples/leaflet/leaflet-plugins/layer/vector/KML.js' type='text/javascript'></script>
<!doctype HTML>
<meta charset = 'utf-8'>
<html>
<head>
<link rel='stylesheet' href='//cdn.leafletjs.com/leaflet-0.5.1/leaflet.css'>
<script src='//cdn.leafletjs.com/leaflet-0.5.1/leaflet.js' type='text/javascript'></script>
<script src='//rawgithub.com/leaflet-extras/leaflet-providers/gh-pages/leaflet-providers.js' type='text/javascript'></script>
<script src='//harrywood.co.uk/maps/examples/leaflet/leaflet-plugins/layer/vector/KML.js' type='text/javascript'></script>
<!doctype HTML>
<meta charset = 'utf-8'>
<html>
<head>
<link rel='stylesheet' href='//cdn.leafletjs.com/leaflet-0.5.1/leaflet.css'>
<script src='//cdn.leafletjs.com/leaflet-0.5.1/leaflet.js' type='text/javascript'></script>
<script src='//rawgithub.com/leaflet-extras/leaflet-providers/gh-pages/leaflet-providers.js' type='text/javascript'></script>
<script src='//harrywood.co.uk/maps/examples/leaflet/leaflet-plugins/layer/vector/KML.js' type='text/javascript'></script>
require(httr)
full_url <- oauth_callback()
full_url <- gsub("(.*localhost:[0-9]{1,5}/).*", x=full_url, replacement="\\1")
print(full_url)
library(instaR)
app_id <- ""
app_secret <- ""
token <- instaOAuth(app_id, app_secret)
library(parallel)
dfUsers <- read.csv("xxx_users.csv")
x <- cbind(x = as.vector(dfUsers$name))
numWorkers <- 8
Sys.time()
res <- mclapply(x, whatGender,mc.cores = numWorkers)
Sys.time()
dfGender <-do.call("rbind", res)
Sys.time()
@josefslerka
josefslerka / gist:2330505
Created April 7, 2012 17:10
Jak importovat a vykreslit zakladni grafy v R a iGraph (a jak to ulozit)
require("igraph")
g <- read.graph("listalumia.txt", format="ncol", directed=TRUE)
# defaultni graf
plot(g)
# pocet hran
ecount(g)
# pocet nodu
vcount(g)