doubledispatch <- function(x,y) {
z <- list()
z_classes <- expand.grid(
cl_x=class(x),
cl_y=class(y)
)
z_classes$cl_z <- paste0(
z_classes$cl_x,
"_",
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
RED='\033[0;31m' | |
NOCOLOR='\033[0m' # No Color | |
GREEN='\033[0;32m' | |
RANGE_SIZE=65536 | |
USERID="$1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Derived from https://unix.stackexchange.com/a/487546/378468 | |
URL=www.google.com | |
openssl s_client -showcerts -verify 5 -servername "$URL" -connect "$URL":443 < /dev/null | \ | |
awk '/BEGIN CERTIFICATE/,/END CERTIFICATE/{ if(/BEGIN CERTIFICATE/){a++}; out="cert"a".pem"; print >out}' | |
for cert in *.pem; do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Based on https://floss.social/@matt_hinckley/113847180218473193 | |
padme <- function(x, pre_pad = 0, post_pad = 0, padding_value = 0){ | |
ndims <- length(dim(x)) | |
if (length(pre_pad) == 1L) { | |
pre_pad <- rep(pre_pad, ndims) | |
} | |
if (length(post_pad) == 1L) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Use requests with truststore from a package | |
# | |
# from requests_truststore import requests | |
# resp = requests.get("https://google.com") | |
from requests import Session | |
from requests.adapters import HTTPAdapter | |
import ssl | |
import truststore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# WARNINGS: | |
# (1) Do not run this script with sudo permissions | |
# (2) Ideally, run this script line by line (the sed commands span multiple lines, please run all the sed commands at once) | |
# (3) You should change the NAME_EMAIL value accordingly. | |
# (4) The libxp6 package is old and unmaintained. It may have security issues. | |
# (5) The package build scripts are getting old and unmaintained as well. They are using more and more deprecated features. | |
# (6) Warning (5) means that for 26.04 this script may not work anymore without changes | |
# (7) I am not really interested in making the changes for 26.04. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
reprex::reprex({ | |
library(DelayedArray) | |
x <- DelayedArray(matrix(1L, nrow = 2, ncol = 1)) | |
colnames(x) <- "potato" | |
# wrong: | |
df <- as.data.frame(x, drop = TRUE) | |
colnames(df) | |
# workaround: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
title: "Demo inconsistency" | |
author: "" | |
date: "" | |
output: html_document | |
--- | |
```{r Chunk1} | |
Sys.sleep(5) | |
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# udev rule | |
# Mount USB drive to the media directory using the partition name as mount point | |
# | |
# Description: | |
# Created for Home Assistant OS, this rule mounts any USB drives | |
# into the Hassio media directory (/mnt/data/supervisor/media). | |
# When a USB drive is connected to the board, the rule creates one directory | |
# per partition under the media directory. The newly created partition is named | |
# as the partition name. If the partition does not have a name, then the following |
Referencial transparency is a property of most programming languages, where the name of the variables does not affect the outcome.
Let's start with a simple example:
add1 <- function(variable) {
return(variable + 1)
}
add1(1)
NewerOlder