Skip to content

Instantly share code, notes, and snippets.

View jeroen's full-sized avatar

Jeroen Ooms jeroen

View GitHub Profile
@jeroen
jeroen / platform.R
Last active May 14, 2025 13:53
CRAN Packages with NeedsCompilation but unknown platform (no src dir)
df <- as.data.frame(read.dcf(url('https://cran.r-universe.dev/bin/linux/noble-x86_64/4.5/src/contrib/PACKAGES')))
unknown_platform <- df$NeedsCompilation == 'yes' & !grepl('linux', df$Built)
df$Package[unknown_platform]
@jeroen
jeroen / datadeps.R
Last active April 29, 2025 17:00
Bioc packages with 'hard' dependency on data packages
# Bioc packages with 'hard' dependency on data packages
# Please consider making these a 'soft' dependency (aka Suggests) if data is only needed for examples/vignettes.
software <- available.packages(repos = 'https://bioconductor.org/packages/devel/bioc/')
annotation <- available.packages(repos = 'https://bioconductor.org/packages/release/data/annotation')
experiment <- available.packages(repos = 'https://bioconductor.org/packages/release/data/experiment')
datapkgs <- c(row.names(annotation), row.names(experiment))
deps <- tools::package_dependencies(db = software)
datadeps <- sapply(deps, function(x){
intersect(x, datapkgs)
}, simplify = FALSE)
@jeroen
jeroen / clone.c
Created November 26, 2024 11:30
Example to clone with libgit2
//Compile: gcc test.c $(pkg-config --libs --cflags libgit2)
#include <git2.h>
#include <stdio.h>
int main() {
git_libgit2_init();
git_repository *repo = NULL;
int error = git_clone(&repo, "https://github.com/jeroen/sys", "test", NULL);
if (error < 0) {
@jeroen
jeroen / devtest.png
Last active November 8, 2024 21:53
Proposal for development tests
devtest.png
@jeroen
jeroen / bioc.R
Last active March 27, 2024 12:31
Get bioconductor HEAD commits
library(curl)
library(yaml)
parse_raw_gitpack <- function(buf){
con <- rawConnection(buf)
on.exit(close(con))
txt <- readLines(con, warn = FALSE)
stopifnot(grepl('^[0-9a-f]{4}#', txt[1]))
stopifnot(grepl('service=', txt[1]))
if(length(txt) == 2 && txt[2] == '00000000'){
@jeroen
jeroen / build-r-arm.sh
Last active September 3, 2023 21:06
Build R-devel for aarch64 in msys2
#!/bin/sh
set -e
set -x
cd ~
export R_CRAN_WEB="https://cran.rstudio.com"
export CRAN_RSYNC='mirrors.nic.cz::CRAN'
# Some prereqs
pacman -S --needed --noconfirm wget git make perl curl texinfo texinfo-tex rsync unzip diffutils
if [ ! -d "aarch64-w64-mingw32.static.posix" ]; then
@jeroen
jeroen / fdtest.c
Last active June 20, 2023 12:42
Test number of file descriptors
#include <curl/curl.h>
#include <stdlib.h>
#include <string.h>
size_t do_nothing(void *contents, size_t sz, size_t nmemb, void *ctx){
return sz * nmemb;
}
CURL *make_handle(char *url){
CURL *handle = curl_easy_init();
@jeroen
jeroen / webr-csv.html
Created April 1, 2023 12:33
webr export csv file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hello World! Site Title</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/2.0.0/FileSaver.min.js"></script>
<script>
import('https://webr.r-wasm.org/latest/webr.mjs').then(function(x){
const webR = new x.WebR();
@jeroen
jeroen / Dockerfile
Last active January 17, 2023 21:14
Build libv8 on Fedora
FROM fedora:36
# Simulate the clang location from CRAN
RUN ln -s /usr /usr/local/clang15
RUN dnf install -y clang llvm lld
COPY script.sh .
RUN ./script.sh
@jeroen
jeroen / Dockerfile
Created January 15, 2023 15:14
libcxx / v8-devel linking error on Fedora
# syntax=docker/dockerfile:1.3-labs
FROM fedora:36
COPY <<EOF test.cpp
#include <libplatform/libplatform.h>
#include <v8.h>
using namespace v8;
int main(){
std::unique_ptr<Platform> platform = platform::NewDefaultPlatform();