Skip to content

Instantly share code, notes, and snippets.

View ginolhac's full-sized avatar
🚲
graveling

Aurélien Ginolhac ginolhac

🚲
graveling
View GitHub Profile
@ginolhac
ginolhac / install-arch.md
Created April 18, 2024 07:04 — forked from mjnaderi/install-arch.md
Installing Arch Linux with Full Disk Encryption (LVM on LUKS)

Installing Arch Linux with Full Disk Encryption

If you're aiming for a seamless Arch Linux installation in UEFI mode, follow along as this guide will walk you through the process step by step. We'll be using LUKS (Linux Unified Key Setup) and LVM (Logical Volume Manager) partitions on LUKS to achieve full disk encryption.

Note: I have updated this doc for UEFI mode. For those with BIOS/MBR systems, you can refer to the previous version, but keep in mind that it might be outdated and no longer accurate.

If you're only interested in installing Linux and not setting up dual boot with Windows, feel free to skip the Windows-related sections.

@ginolhac
ginolhac / check-url.R
Created September 19, 2023 08:41 — forked from nanxstats/check-url.R
A general-purpose link checker for R Markdown and Quarto projects https://nanx.me/blog/post/rmarkdown-quarto-link-checker/
#' Flatten copy
#'
#' @param from Source directory path.
#' @param to Destination directory path.
#'
#' @return Destination directory path.
#'
#' @details
#' Copy all `.Rmd`, `.qmd`, and `.md` files from source to destination,
#' rename the `.qmd` and `.md` files with an additional `.Rmd` extension,
@ginolhac
ginolhac / tsne_anim.R
Last active June 15, 2018 09:07
gganimate tSNE
library(gganimate)
# rds object comes from this tutorial
# https://ulhpc-tutorials.readthedocs.io/en/latest/maths/R/#parallel-computing-using-hpc
res_tib <- read_rds("tsne_future.rds")
res_tib %>%
unnest(tsne) %>%
select(-output) %>%
group_by(perplexities) %>%
#include <Rcpp.h>
using namespace Rcpp;
// [[Rcpp::export]]
SEXP with_string(CharacterVector names) {
int size = names.size();
std::vector<String> tmp;
String strtmp;
CharacterVector out_vec(tmp.begin(), tmp.end());
#include <Rcpp.h>
using namespace Rcpp;
int vector_sign(IntegerVector x) {
bool pos = false, neg = false;
int n = x.size();
for (int i = 0; i < n; ++i) {
if (x[i] < 0) neg = true;
if (x[i] > 0) pos = true;
@ginolhac
ginolhac / gather_gaming_dude.R
Created March 3, 2017 19:47
tidyverse gather
#testdata
v1<-c("color", "red", "red", "red", "red", "green", "green", "green", "green", "yellow", "yellow", "yellow", "yellow", "blue", "blue", "blue", "blue")
v2<-c("year", "2015", "2014", "2013", "2012", "2015", "2014", "2013", "2012", "2015", "2014", "2013", "2012", "2015", "2014", "2013", "2012")
v3<-c("UK", "23", "34", "34", "11", "45", "32", "11", "76", "90", "13", "24", "12", "34", "23", "43", "28")
v4<-c("GER", "95", "43", "21", "43", "57", "22", "52", "34", "52", "56", "76", "90", "23", "78", "4", "12")
v5<-c("POL", "56", "78", "32", "56", "1", "8", "55", "45", "87", "12", "99", "66", "11", "45", "32", "11")
v6<-c("US", "56", "76", "90", "13", "11", "45", "32", "11", "11", "45", "38", "16","54","4","71","67")
df<-as.data.frame(rbind(v1,v2,v3,v4,v5,v6))

To -> or not to ->

In the blog post "A Step to the Right in R Assignments", by @hrbrmstr, and in later twitter discussions (e.g. here), it is argued that <- (and %<>% for that matter) is "illogical" and feels awkward.

Although I can see where the temptation comes from, I consider -&gt; to be

@ginolhac
ginolhac / qPCR_multiplot.R
Last active June 8, 2016 06:49
gridExtra::marrangeGrob
library("ggplot2")
library("dplyr", warn.conflicts = FALSE)
library("gridExtra")
plot_id <- function(df, df2, type) {
df %>%
filter(`2^-ddCt` > 2, id == type) %>%
mutate(analysis = "HKgenorm:arith") %>%
ggplot(aes(x = ID, y = log2(`2^-ddCt`), colour = analysis))+
geom_pointrange(aes(ymin = log2(`2^-ddCt.min`), ymax = log2(`2^-ddCt.max`)),
library("dplyr")
library("readr")
library("stringi")
# load file with names absolute paths
file.list <- list.files("/Volumes/gaia/", pattern='*.txt', full.names = TRUE)
# read them all as a list
df.list <- lapply(file.list, read_tsv)
# name list with correct id extracted from filenames
names(df.list) <- stri_extract_first(basename(file.list), regex = "patient_\\d")