Skip to content

Instantly share code, notes, and snippets.

View franzbischoff's full-sized avatar
I were here

Francisco Bischoff franzbischoff

I were here
View GitHub Profile
@franzbischoff
franzbischoff / tsmp-examples.ipynb
Last active March 22, 2024 14:14
tsmp examples.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@franzbischoff
franzbischoff / check_buildignore.R
Created March 4, 2020 21:19
Check which files are ignored and which will stay in your R package using .Rbuildignore
check_buildignore <- function() {
patterns <- readLines(".Rbuildignore")
hits <- list()
for (pat in patterns) {
hit <- dir(
full.names = FALSE, recursive = TRUE,
all.files = TRUE, include.dirs = TRUE, no.. = TRUE
)[grepl(
pat,
dir(
@franzbischoff
franzbischoff / plot_dependencies.R
Last active March 5, 2020 23:54 — forked from crsh/plot_dependencies.R
Plots the network of package dependencies
#' Plot network of package dependencies
#'
#' @param pkg package description, can be path or package name. See \code{\link[devtools]{as.package}} for
#' more information.
#'
#' @details The resulting plot visualizes the network of package dependencies. If you are trying to cut down
#' on package dependencies look for big red dots that represent a lot of upstream but few downstream
#' dependencies.
#' @import ggplot2
#' @export
@franzbischoff
franzbischoff / arguments.R
Last active July 9, 2020 23:32
How to verify if arguments were called, the difficult way
myfunction <- function (a, b, c, ...)
{
p <- list()
# use formals to get the arguments from a function.
# use sys.function() to get the own function. if you return sys.function() you return itself
formal.args <- formals(sys.function())
formal.args[["..."]] <- NULL # this is not needed, but here you can remove the "..." argument
for (arg in names(formal.args)) {
#Load Libraries
library(foreach)
library(utils)
library(iterators)
library(doParallel)
#Choose number of iterations
n <- 1000
#Progress combine function
@franzbischoff
franzbischoff / fft.cpp
Created September 19, 2020 22:39
FFT thread-safe
/*
R : A Computer Language for Statistical Data Analysis
Copyright (C) 1998--2019 The R Core Team
Copyright (C) 1995, 1996, 1997 Robert Gentleman and Ross Ihaka
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
@franzbischoff
franzbischoff / fluss_score_tests.R
Last active April 25, 2022 20:36
Experiment of FLUSS scores
# Create the GT and predictions
set.seed(2022)
ts_length <- 1000
n_points <- 10
truth <- sort(round(runif(n_points, 1, ts_length), 0))
min_diff <- min(abs(diff(truth)))
mask <- runif(n_points) > 0.5
reported_equal <- truth + round(runif(n_points, -min_diff / 2, min_diff / 2), 0)
reported_half <- reported_equal[mask]
reported_half_rand <- sort(round(runif(floor(n_points / 2), 1, ts_length), 0))
@franzbischoff
franzbischoff / fixtailscale.sh
Last active April 2, 2022 09:30
Tailscale hack on homeassistant official addon for creating and updating SSL certificates
#!/bin/bash
# disclaimer: I did it for personal use, no garantees
# this version doesn't check if the script was already runned. Nothing bad happens anyway.
# first you need to have the "reconfig.sh" inside the addon container. If you are just updating the container,
# the data folder usually stays there with the script.
dockerssl="/data/ssl"
localssl="/root/ssl/tailscale"
@franzbischoff
franzbischoff / turn_off_leds.sh
Created July 26, 2022 11:52
Cubietruck tricks
#!/bin/bash
# Description:
# This turns off all the annoying leds that makes your cubietruck looks like a christmas tree
# original from https://karellen.blogspot.com/2015/07/turning-off-leds-on-cubietruck.html
find /sys/devices/platform/leds-sunxi/ -name "brightness" | sed s'/:/\\:/g' | while read l; do echo 0 > "$l"; done
{"name":"anymapp","hostname":"BISCHOFF-wsl","pid":37886,"level":30,"event":{"message":"logEvent","data":{"elementID":"u1","eventInfo":{"dragInfo":{},"item":{"valid":false},"keyInfo":{"ctrl":false,"alt":false,"shift":false,"keyCode":0},"pageX":"577px","pageY":"731px","srcElement":"u1","window":{"width":795,"height":1096,"scrollx":0,"scrolly":0}},"eventType":"Click or Tap","path":["2083d309e6664fa28fb78a592c3051ea"],"timeStamp":1669042256891}},"msg":"logEvent","time":"2022-11-21T14:50:57.236Z","v":0}