Skip to content

Instantly share code, notes, and snippets.

View ps-pat's full-sized avatar

Patrick Fournier ps-pat

View GitHub Profile
@ps-pat
ps-pat / proof.md
Created April 23, 2026 18:08
Keyoxide verification

openpgp4fpr:AC2D25E7E59D5740936F48A9407DA3D98F93442B

@ps-pat
ps-pat / cours-2.R
Last active September 16, 2025 02:10
Code vu durant les séances du cours "R avancé" à l'automne 2025
## Expérimentation avec les vecteurs `raw` ##
v1 <- 1:3
as.raw(v1)
#> [1] 01 02 03
v2 <- c(10, 20, 30)
as.raw(v2)
#> [1] 0a 14 1e
@ps-pat
ps-pat / basic.R
Last active October 2, 2023 13:11
MAT8186 -- Cours 7
library(Rmpi)
## Crée les workers.
nworkers <- 5
mpi.spawn.Rslaves(nslaves = nworkers)
## Demande à chaque worker de retourner son rang.
mpi.remote.exec(mpi.comm.rank())
## On termine!
@ps-pat
ps-pat / fonctions.R
Created September 18, 2023 17:46
MAT8186 -- Cours 4
## Constructeur
point <- function(v){
v <- as.numeric(v)
stopifnot(identical(length(v), 2L))
structure(v, class = c("point", class(v)))
}
@ps-pat
ps-pat / fonctions.R
Last active September 18, 2023 15:23
MAT8186 -- Cours 3
## Debug
fact <- function(x) {
x < 0 && return(x)
x * fact(x - 1.0)
}
## Profile
cutVector <- function(vec, m) {
n <- length(vec) / m