Skip to content

Instantly share code, notes, and snippets.

View pat-s's full-sized avatar

Patrick Schratz pat-s

View GitHub Profile
@pat-s
pat-s / collect-mlr3-updates.R
Last active May 16, 2022 00:46
Collects all mlr3 packages updates in the last quarter
library(tidyverse)
library(htmltab)
library(lubridate)
library(pkgsearch)
list_repos = httr::content(httr::GET("https://api.github.com/orgs/mlr-org/repos?per_page=100"))
list_repos_v = unlist(lapply(list_repos, function(x) x$name))
repos_mlr3 = grep("mlr3", list_repos_v, value = TRUE)
# add non-mlr3 repos
{
"version": "0.9.0",
"description": "The R installation manage: Install, remove, configure R versions.",
"homepage": "https://github.com/pat-s/rcli",
"license": "LGPL-3",
"url": "https://github.com/pat-s/rcli/releases/download/0.9.0/rcli",
"bin": "rcli",
"checkver": "github"
}
@pat-s
pat-s / gist:b0cb9a11e6f3fabe50e05b89915180cf
Created July 18, 2022 08:05
Stripped RSW server image
FROM ubuntu:focal
# set ENV variables
ENV LC_ALL=en_US.UTF-8
ENV LANG=en_US.UTF-8
ENV TERM=xterm
ENV DEBIAN_FRONTEND=noninteractive
# locale ----------------------------------------------------------------------#
RUN apt update \
@pat-s
pat-s / github-migrate.sh
Created August 23, 2022 21:58
Migrate GH repo via API
### DEPENDENCIES
# - curl
# - jq
### VARIABLES
export REPO_NAME=FIXME
export ORG_NAME=FIXME
export SLEEP_TIME=15
export TOKEN=FIXME # empty scopes are sufficient
@pat-s
pat-s / migrate.sh
Created February 7, 2023 18:47
Migrate from Terraform Cloud to "Remote" storage backend
export TFC_TOKEN=<CHANGEME> # TF cloud token
export WORKSPACE_ID=<CHANGEME> # old TF cloud Workspace ID
export WORKSPACE_ID_NEW=<CHANGEME> # new OTF workspace ID
export TOKEN_REMOTE_BACKEND=<CHANGEME> # OTF token
export REMOTE_BACKEND_URL=<CHANGEME> # OTF URL
### START
HTTP_RESPONSE=$(curl \
--header "Authorization: Bearer "$TFC_TOKEN"" \
@pat-s
pat-s / test.R
Last active March 29, 2023 08:05
blockCV: raster -> terra
#### blockCV old
library(raster)
x <- raster(system.file("external/rlogo.grd", package="raster"))
resolution = 10000
ybin = 3
xbin = 3