Skip to content

Instantly share code, notes, and snippets.

View pat-s's full-sized avatar

Patrick Schratz pat-s

View GitHub Profile
/* -------------------------------------------------------
*
* !! This file was generated by xaringanthemer !!
*
* Changes made to this file directly will be overwritten
* if you used xaringanthemer in your xaringan slides Rmd
*
* Issues or likes?
* - https://github.com/gadenbuie/xaringanthemer
* - https://www.garrickadenbuie.com
@pat-s
pat-s / install-r-macOS.sh
Created December 14, 2019 08:20
Install R official on macOS
#! /bin/bash
R_VERSION=$1
wget https://mac.r-project.org/el-capitan/R-${R_VERSION}-branch/R-${R_VERSION}-branch-el-capitan-sa-x86_64.tar.gz
sudo tar fvxz R*.tar.gz -C /
rm R*.tar.gz
@pat-s
pat-s / example.R
Created March 17, 2020 21:14
init_mlr3learner_drat_deploy
init_mlr3learner_drat_deploy("mlr3learners.mboost") # replace this with the actual learner name
@pat-s
pat-s / gist:938d5642573107654e09c9884dd3bc28
Last active April 1, 2020 16:32
add mlr3learners Paramtest
fs::dir_create("inst/paramtest", recurse = TRUE)
writeLines('on:
push:
pull_request:
# for now, CRON jobs only run on the default branch of the repo (i.e. usually on master)
schedule:
# * is a special character in YAML so you have to quote this string
- cron: "0 4 * * *"
name: Parameter Check
browse_news <- function(package = NULL) {
# check for pkgdown url
field_url <- desc::desc_get_urls(file = system.file("DESCRIPTION", package = package))[1]
# check if a news site exists for the given url
has_pkgdown <- httr::status_code(httr::GET(paste0(field_url, "/news"))) == 200
if (has_pkgdown) {
view_url((paste0(field_url, "/news")))
return(invisible())
}
Jun 12 01:03:00 charge2 kernel: [762622.063494] testing the buffer
Jun 12 01:03:00 charge2 kernel: [762622.063505] testing the buffer
Jun 12 01:03:00 charge2 kernel: [762622.063592] testing the buffer
Jun 12 01:03:00 charge2 kernel: [762622.063604] testing the buffer
Jun 12 01:03:01 charge2 CRON[58247]: (ursmaendli) CMD (/home/ursmaendli/charge2/run.sh >> /home/ursmaendli/run-sh.log 2>&1)
Jun 12 01:03:01 charge2 CRON[58248]: (ursmaendli) CMD (/home/ursmaendli/charge2/run-static.sh >> /home/ursmaendli/run-static-sh.log 2>&1)
Jun 12 01:03:02 charge2 containerd[80521]: time="2020-06-12T01:03:02.341916576Z" level=info msg="shim containerd-shim started" address=/containerd-shim/355a87ba8742cd32cd0d779d231a254f64410b04ae06fd07a1616efb84c2781f.sock debug=false pid=58266
Jun 12 01:03:02 charge2 containerd[80521]: time="2020-06-12T01:03:02.397109845Z" level=info msg="shim containerd-shim started" address=/containerd-shim/ef6ccfec1e235dab150e0ec0e1409e821985432e28a324418737a76f1c85f8a3.sock debug=false pid=58300
Jun 12
if (requireNamespace(c("callr", "git2r"), quietly = TRUE)) {
has_git = git2r::in_repository()
if (has_git) {
message("Running `git2r::pull()` in the background.")
callr::r_bg(function() {git2r::pull()})$wait()$get_result()
}
}
if (requireNamespace(c("callr", "git2r", "gert", "cli"), quietly = TRUE)) {
has_git = git2r::in_repository()
if (has_git && Sys.getenv("RSTUDIO") == 1) {
cli::cli_text("Running
{.code gert::git_pull(verbose = FALSE, prune = TRUE, rebase = TRUE)}
in the background.")
callr::r_bg(function() {
gert::git_pull(verbose = FALSE, prune = TRUE, rebase = TRUE)
},
stdout = out <- tempfile(), stderr = err <- tempfile())$wait()
# because base::file.rename() is a pain across OS
requireNamespace("fs", quietly = TRUE)
# download cluto zip file
temp = tempfile()
utils::download.file("http://glaros.dtc.umn.edu/gkhome/fetch/sw/cluto/cluto-2.1.2a.zip", temp, quiet = TRUE)
utils::unzip(temp, files = c("cluto-2.1.2/Linux-x86_64/vcluster", "cluto-2.1.2/MSWIN-x86_64/vcluster.exe"))
unlink(temp)
@pat-s
pat-s / code.R
Created September 10, 2021 06:35
OpenDataScience Europe 2021 talk - Patrick Schratz
## ----mlr3-config, echo = FALSE---------------------------------------------------------------------------
lgr::get_logger("bbotk")$set_threshold("warn")
lgr::get_logger("mlr3")$set_threshold("warn")
## ----example, fig.show="hide"----------------------------------------------------------------------------
library("mlr3verse", quietly = TRUE)
set.seed(42)
# example tasks