Skip to content

Instantly share code, notes, and snippets.

Avatar

Gábor Csárdi gaborcsardi

View GitHub Profile
View Dockerfile
FROM ubuntu:20.04
ENV R_VERSION 4.1.2
RUN apt-get -y update && \
apt-get -y install wget gdebi-core && \
wget https://cdn.rstudio.com/r/ubuntu-2004/pkgs/r-${R_VERSION}_1_amd64.deb && \
gdebi --non-interactive r-${R_VERSION}_1_amd64.deb && \
rm r-${R_VERSION}_1_amd64.deb && \
apt-get -y autoremove gdebi-core && \
@gaborcsardi
gaborcsardi / Pkgdown deploy from Travis.md
Last active Nov 17, 2021
Walkthrough: deploy a pkgdown site from Travis
View Pkgdown deploy from Travis.md

Run usethis::use_pkgdown_travis()

usethis::use_pkgdown_travis()
✔ Setting active project to '/Users/gaborcsardi/works/ps'Adding 'docs/' to '.gitignore'Set up deploy keys by running `travis::use_travis_deploy()`Insert the following code in '.travis.yml'
  before_cache: Rscript -e 'remotes::install_cran("pkgdown")'
@gaborcsardi
gaborcsardi / notes.Rmd
Last active Jul 16, 2019
TGM 2019-07-15
View notes.Rmd
---
title: "Some new features in processx and callr"
output: html_notebook
---
# Better errors in processx, callr, gh
## Better errors from C
```{r error = TRUE}
View processes.Rmd
---
title: "Overview of Tools for External (R) Processes"
output:
html_document:
df_print: paged
---
## processx - run external processes
```{r}
@gaborcsardi
gaborcsardi / cleanupJenkinsWorkspaces.groovy
Created Sep 30, 2018 — forked from EvilBeaver/cleanupJenkinsWorkspaces.groovy
A jenkins script to clean up workspaces on slaves
View cleanupJenkinsWorkspaces.groovy
// Check if a slave has < 10 GB of free space, wipe out workspaces if it does
import hudson.model.*;
import hudson.util.*;
import jenkins.model.*;
import hudson.FilePath.FileCallable;
import hudson.slaves.OfflineCause;
import hudson.node_monitors.*;
View async-example.Rmd
---
title: Examples for the async package
output:
html_document:
keep_md: yes
---
There is not too much text here, sorry. Please just read the code. :)
```{r}
@gaborcsardi
gaborcsardi / benchmark.R
Created Mar 13, 2018
S4 vs R6, very crude
View benchmark.R
library(R6)
library(methods)
library(microbenchmark)
make_class4 <- function() {
cl <- setClass("num_with_id", slots = c(id = "character"),
contains = "numeric")
setGeneric("getId", function(x) stop("Not implemented"))
setMethod("getId", c("num_with_id"), function(x) x@id)
View keybase.md

Keybase proof

I hereby claim:

  • I am gaborcsardi on github.
  • I am gaborcsardi (https://keybase.io/gaborcsardi) on keybase.
  • I have a public key ASCYCFJfhgSPp_YvDb9HbKVnQDbYamq71iQMSSnn8Rw_wgo

To claim this, I am signing this object:

@gaborcsardi
gaborcsardi / cran-over-time.R
Last active Jul 18, 2020
Size of the CRAN R package repository over time
View cran-over-time.R
library(jsonlite)
## Download
pkgs <- fromJSON("http://crandb.r-pkg.org/-/events")
## Filter
na_pkgs <- unique(pkgs$name[ is.na(pkgs$date) ])
events <- pkgs[ ! pkgs$name %in% na_pkgs, c("date", "name", "event")]
View dokku-rabbitmq-expose-tcp6.txt
root@rhub:~# dokku --trace rabbitmq:expose rhub 5672 4369 35197 15672
+ [[ -f /home/dokku/dokkurc ]]
+ [[ -d /home/dokku/.dokkurc ]]
+ for f in '$DOKKU_ROOT/.dokkurc/*'
+ source /home/dokku/.dokkurc/DOKKU_EVENTS
++ export DOKKU_EVENTS=1
++ DOKKU_EVENTS=1
+ [[ -n 1 ]]
+ set -x
+ parse_args rabbitmq:expose rhub 5672 4369 35197 15672