Skip to content

Instantly share code, notes, and snippets.

View jpasquier's full-sized avatar

Jérôme Pasquier jpasquier

  • Fribourg, Switzerland
View GitHub Profile
#!/bin/bash
initial_directory=$(pwd)
temp_directory=$(mktemp -d)
build_directory=$(mktemp -d)
cd $temp_directory
wget https://ppa.launchpadcontent.net/aglasgall/pipewire-extra-bt-codecs/ubuntu/pool/main/p/pipewire/libspa-0.2-bluetooth_0.3.65-4%7Eglasgall1_amd64.deb
dpkg -x $(ls *.deb) $temp_directory
mkdir $build_directory/DEBIAN
mkdir -p $build_directory/usr/lib/x86_64-linux-gnu/spa-0.2/bluez5/
@jpasquier
jpasquier / unisante_phenobese_n_welch_t_test.R
Created June 20, 2023 08:51
[Unisanté - Phenobese] Sample size for a 2-sided Welch's t-test
n_welch_t_test <- function(m1, s1, m2, s2, r = 1, alpha = .05, pwr = .8) {
root_func <- function(n1) {
n2 <- r * n1
d <- m2 - m1
s <- sqrt(s1^2 / n1 + s2^2 / n2)
ncp = abs(d) / s
nu <- (s1^2 / n1 + s2^2 / n2)^2 /
(s1^4 / (n1^2 * (n1 - 1)) + s2^4 / (n2^2 * (n2 - 1)))
qu <- qt(1 - alpha / 2, nu)
1 - pt(qu, nu, ncp = ncp) + pt(-qu, nu, ncp = ncp) - pwr
#!/bin/python3
import numpy as np
import matplotlib.pyplot as plt
from multiprocessing import Pool, cpu_count
np.random.seed(666)
# Function that calculates (by simulation) the overflow probability of the
# system
@jpasquier
jpasquier / rush.R
Last active December 14, 2022 15:06
library(ggplot2)
library(parallel)
options(mc.cores = detectCores() - 1)
RNGkind("L'Ecuyer-CMRG")
set.seed(666)
# Function that calculates (by simulation) the overflow probability of the
# system