Skip to content

Instantly share code, notes, and snippets.

View daroczig's full-sized avatar

Gergely Daróczi daroczig

View GitHub Profile
@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 = "
@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
@JoshData
JoshData / build_logins.sh
Last active November 26, 2020 17:59
rstudio multi-user helper
#!/bin/bash
# Start an AWS instance with one of the AMIs provided by:
# http://www.louisaslett.com/RStudio_AMI/
#
# Get this script.
# wget https://gist.githubusercontent.com/JoshData/615aa18cecb8a6596f59/raw/1b43765552862af98cb16d95dd236a81f6c5b464/build_logins.sh
# chmod +x build_logins.sh
#
# Then use this script to create many logins on the system.
@jeroen
jeroen / readme.md
Last active January 17, 2017 17:21
Testing R packages on Solaris
@hyOzd
hyOzd / delete-file-and-buffer.el
Created July 21, 2015 11:55
emacs delete current file and close the buffer
;; based on http://emacsredux.com/blog/2013/04/03/delete-file-and-buffer/
(defun delete-file-and-buffer ()
"Kill the current buffer and deletes the file it is visiting."
(interactive)
(let ((filename (buffer-file-name)))
(if filename
(if (y-or-n-p (concat "Do you really want to delete file " filename " ?"))
(progn
(delete-file filename)
(message "Deleted file %s." filename)
@dmarcelinobr
dmarcelinobr / President's_height.R
Last active January 4, 2016 22:56
height of president divided by height of most successful opponent. Data from Stulp et al. 2013's paper.
height_ratio <- c(0.924324324, 1.081871345, 1, 0.971098266, 1.029761905,
0.935135135, 0.994252874, 0.908163265, 1.045714286, 1.18404908,
1.115606936, 0.971910112, 0.97752809, 0.978609626, 1,
0.933333333, 1.071428571, 0.944444444, 0.944444444, 1.017142857,
1.011111111, 1.011235955, 1.011235955, 1.089285714, 0.988888889,
1.011111111, 1.032967033, 1.044444444, 1, 1.086705202,
1.011560694, 1.005617978, 1.005617978, 1.005494505, 1.072222222,
1.011111111, 0.983783784, 0.967213115, 1.04519774, 1.027777778,
1.086705202, 1, 1.005347594, 0.983783784, 0.943005181, 1.057142857)
msg <- function(..., prob = 0.25) {
if (runif(1) > prob) {
return(invisible())
}
messages <- c(...)
message(sample(messages, 1))
}
encourage <- function() {
@jonocarroll
jonocarroll / simplystats_thanksgiving.R
Last active December 1, 2015 05:48
SimplyStats thanksgiving Rubik's Cube solution
## transform the input to the output using rubiks-cube transformations and dplyr
require(dplyr)
## provided input
input <- data.frame(matrix(c("h","a","t","t","i","v","i","g","k","s","g","n","n","g","n","i"),
4,
4,
byrow=TRUE,
dimnames=list(NULL,paste0("col",1:4))),
stringsAsFactors=FALSE)
@Faheetah
Faheetah / Jenkinsfile.groovy
Last active October 7, 2025 15:42
Jenkinsfile idiosynchrasies with escaping and quotes
node {
echo 'Results included as an inline comment exactly how they are returned as of Jenkins 2.121, with $BUILD_NUMBER = 1'
echo 'No quotes, pipeline command in single quotes'
sh 'echo $BUILD_NUMBER' // 1
echo 'Double quotes are silently dropped'
sh 'echo "$BUILD_NUMBER"' // 1
echo 'Even escaped with a single backslash they are dropped'
sh 'echo \"$BUILD_NUMBER\"' // 1
echo 'Using two backslashes, the quotes are preserved'
sh 'echo \\"$BUILD_NUMBER\\"' // "1"
@wico
wico / Dockerfile
Created June 9, 2016 07:32
Dockerfile to build lampe
FROM ubuntu:15.10
RUN apt-get clean && \
apt-get update && \
apt-get -y install \
libsoup2.4-dev \
libgtk-3-dev \
libjson-glib-dev \
valac \
make \