Skip to content

Instantly share code, notes, and snippets.

View jemus42's full-sized avatar
🆗
🆒

Lukas Burk jemus42

🆗
🆒
View GitHub Profile
@jemus42
jemus42 / xgboost-survival-infinite-lp.md
Created January 10, 2024 11:48
Reprex for XGBoost producing Inf in certain cases for survival models
if (!requireNamespace("mlr3proba")) remotes::install_github("mlr-org/mlr3proba")
#> Loading required namespace: mlr3proba

xdf = mlr3proba::grace
xdf[, c("id")] = NULL
colnames(xdf)[1:2] = c("time", "status")

rows = c(1L, 4L, 6L, 9L, 10L, 12L, 16L, 17L, 18L, 19L, 20L, 22L, 25L,
         26L, 27L, 28L, 30L, 33L, 36L, 37L, 38L, 39L, 40L, 43L, 45L, 49L,
@jemus42
jemus42 / git-timetravel.sh
Created October 26, 2023 12:21
git timetravel to a specific date
git-timetravel () {
# If first argument is empty you dun goof'd
if [ -z "${1}" ]
then
echo "Must provide a valid timestamp in roughly ISO 8601"
echo "Example: git-timetravel "2022-10-01 12:00" main
exit 1
fi
@jemus42
jemus42 / got-scraping-bit.R
Created June 9, 2021 10:34
Quick example to scrape some tabular data from wikipedia
library(rvest)
library(dplyr)
library(stringr)
# Game of Thrones ----
got_wiki <- read_html("https://en.wikipedia.org/wiki/List_of_Game_of_Thrones_episodes") %>%
html_table(fill = TRUE) %>%
magrittr::extract(c(2:9)) %>%
bind_rows() %>%
setNames(c(
@jemus42
jemus42 / episode_heatmap.R
Created April 7, 2020 19:00
Heatmapping episode ratings from trakt.tv
library(tRakt) # remotes::install_github("jemus42/tRakt")
library(dplyr)
library(ggplot2)
library(firasans) # remotes::install_github("hrbrmstr/firasans")
#' @param show_id The show's id on trakt.tv, can also be the show's slug.
#' @param asp_rect Wther to add ggplot2::coord_equal()
#' @examples
#' episode_heatmap("the-simpsons")
episode_heatmap <- function(show_id, asp_rect = TRUE) {
@jemus42
jemus42 / keybase.md
Created April 10, 2017 23:07
keybase verification

Keybase proof

I hereby claim:

  • I am jemus42 on github.
  • I am jemus42 (https://keybase.io/jemus42) on keybase.
  • I have a public key ASDkQyr4_SzMv6V-ZqaqI5vVzpGlXqMU0KcrHnvnspJ_1wo

To claim this, I am signing this object:

@jemus42
jemus42 / Chromecast.xml
Created March 30, 2017 15:56
Plex Media Server profile for Chromecats Ultra with HEVC support but with AC3 transcoding
<?xml version="1.0" encoding="utf-8"?>
<Client name="Chromecast">
<!-- Author: Plex Inc. -->
<TranscodeTargets>
<VideoProfile protocol="http" container="mkv" codec="h264" audioCodec="aac,mp3" context="streaming" />
<MusicProfile container="mkv" codec="opus" />
<PhotoProfile container="jpeg" />
<SubtitleProfile container="ass" codec="ass" />
</TranscodeTargets>
<CodecProfiles>
@jemus42
jemus42 / amzn_scrp.R
Created December 15, 2016 22:09
Simple amazon scraper with slack notification because @danjel
library(rvest) # Parse HTML
library(httr) # Send POST request, I think rvest depends on that anyway
url <- "https://www.amazon.de/dp/B01M0LHEZI"
slack_url <- "somewebhookurlimtoolazytoget"
avail <- read_html(url) %>%
html_node("#availability :first-child") %>%
html_text(trim = T)