Skip to content

Instantly share code, notes, and snippets.

View daroczig's full-sized avatar

Gergely Daróczi daroczig

View GitHub Profile
@cocinerox
cocinerox / RSelenium_2048.R
Last active August 29, 2015 14:13
RSelenium + 2048
# RSelenium + 2048 demo on Budapest RUG (BURN) meetup - Laszlo Szakacs, 2015-01-14
# Commented and updated on 2015-01-18
# Selenium: http://www.seleniumhq.org
# RSelenium: http://ropensci.github.io/RSelenium
# 2048: http://gabrielecirulli.github.io/2048
# 2048 + R: http://decisionsandr.blogspot.hu/2014/04/play-2048-using-r.html
# Strategies: http://stackoverflow.com/questions/22342854/what-is-the-optimal-algorithm-for-the-game-2048
@timelyportfolio
timelyportfolio / code.R
Created December 21, 2014 21:33
htmlwidgets dygraphs only show highlighted legend
library(dygraphs)
lungDeaths <- cbind(ldeaths, mdeaths, fdeaths)
dygraph(lungDeaths, main = "Deaths from Lung Disease (UK)") %>%
dyHighlight(highlightSeriesOpts = list(strokeWidth = 3)) -> d1
#this is a hack to set css directly
# dyCSS designed to read a text css file
d1$x$css = "
@yihui
yihui / README.md
Last active March 15, 2017 18:35
A Shiny app based on annyang that responds to voice input
@andrewheiss
andrewheiss / mtable_stargazer.R
Created November 4, 2014 15:04
mtable and stargazer
library(memisc)
library(stargazer)
library(pander)
lm0 <- lm(sr ~ pop15 + pop75, data = LifeCycleSavings)
lm1 <- lm(sr ~ dpi + ddpi, data = LifeCycleSavings)
lm2 <- lm(sr ~ pop15 + pop75 + dpi + ddpi, data = LifeCycleSavings)
mtable123 <- mtable("Model 1"=lm0,"Model 2"=lm1,"Model 3"=lm2, summary.stats=c("sigma","R-squared","F","p","N"))
pander(mtable123)
@jennybc
jennybc / reverse-categorical-axis-ggplot2.r
Created October 10, 2014 01:06
Reverse the order of a categorical axis in ggplot2
scale_x_discrete(limits = rev(levels(the_factor)))
@jeroen
jeroen / silent-install.sh
Last active May 15, 2017 08:45
Silent install of OpenCPU
# Prevent postfix from prompting for hostname
sudo debconf-set-selections <<< "postfix postfix/mailname string your.hostname.com"
sudo debconf-set-selections <<< "postfix postfix/main_mailer_type string 'Internet Site'"
sudo apt-get install -y postfix
# Install OpenCPU
sudo add-apt-repository -y ppa:opencpu/opencpu-2.0
sudo apt-get update
sudo apt-get install -y opencpu-server
@benmarwick
benmarwick / .emacs
Last active June 1, 2020 15:22
Notes on using Emacs
;;Record startup timestamp
(defvar Emacs/invokation-time
(current-time))
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(custom-enabled-themes (quote (tango-plus)))
@jeroen
jeroen / rcurl_stream.R
Last active January 27, 2016 13:11
line-by-line import of json records with RCurl
batchimport <- function(url, batchsize = 1e6) {
# Globals
stack <- batches <- list();
i <- j <- 1;
size <- 0;
# Function that parses intermediate json
clearstack <- function(all=FALSE){
bigstr <- do.call(paste0, stack);
lines <- strsplit(bigstr, "\n")[[1]];
@dhrrgn
dhrrgn / gist:10125477
Last active February 26, 2021 18:42
Upgrade Ubuntu OpenSSL to patch Heartbleed
sudo apt-get update
sudo apt-get install -y libssl1.0.0 openssl
# Confirm Build Date is at least Aril 7th 2014
openssl version -a
# Restart all services listed by this command:
sudo lsof -n | grep ssl | grep DEL
library(RJSONIO)
library(httr)
library(ggplot2)
api_key <- scan("~/.meetup.apikey", character(), quiet = TRUE)
group_id <- 1414043 ## LA R meetup
req_url <- paste0("http://www.meetup.com/2/events?key=", api_key,
"&group_id=",group_id,"&status=past")
events_data <- fromJSON(rawToChar(GET(req_url)$content))$results