Skip to content

Instantly share code, notes, and snippets.

View ginolhac's full-sized avatar
🚲
graveling

Aurélien Ginolhac ginolhac

🚲
graveling
View GitHub Profile
@thesamesam
thesamesam / xz-backdoor.md
Last active May 4, 2024 09:26
xz-utils backdoor situation (CVE-2024-3094)

FAQ on the xz-utils backdoor (CVE-2024-3094)

This is a living document. Everything in this document is made in good faith of being accurate, but like I just said; we don't yet know everything about what's going on.

Background

On March 29th, 2024, a backdoor was discovered in xz-utils, a suite of software that

@jonocarroll
jonocarroll / copy_on_modify.R
Last active November 6, 2023 12:28
Understanding R's copy-on-modify semantics wrt the symbol table
## Modify a vector in the workspace; x is a user-accessible symbol
x <- 42
.Internal(inspect(x))
# @5631a3a19e20 14 REALSXP g0c1 [REF(5)] (len=1, tl=0) 42
x[1] <- 43 # modification causes a copy (address changes)
.Internal(inspect(x))
# @5631a36c1cb8 14 REALSXP g0c1 [REF(4)] (len=1, tl=0) 43
## Modify a vector inside a function; user cannot access y
f <- function() {
@nanxstats
nanxstats / check-url.R
Last active January 23, 2024 09:37
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,
#### ---------------------------------------------
## Edit via: RStudio > Tools > Edit Code Snippets
# Released under a MIT license
snippet fragment
[${1:text}]{.${2:type}}
snippet aside
[${1:text}]{.aside}
@linderd
linderd / README.md
Last active March 13, 2024 19:06 — forked from timlinux/README.md
Linux on Thinkpad P14s Gen2 AMD / T14 Gen2 AMD

Linux (Fedora 35) on a Thinkpad P14s [T14] Gen2 AMD

These are my installation-tricks and notes for running Linux on a 2021 Thinkpad P14s Gen2 with AMD Ryzen 7 5850U. It should also be suitable for the Thinkpad T14 Gen2 AMD as they are technically the same modell.
Meanwhile there is also a good test on youtube and an entry in the arch-wiki, which also comments some points mentioned here.

Detailed specs

Shipped:

@statnmap
statnmap / vscode_r_users_extensions.md
Last active December 12, 2021 19:53
VSCode R users extensions
@timlinux
timlinux / README.md
Last active April 10, 2024 19:28
Linux on Lenovo Thinkpad P14s with AMD Processor

Thinkpad P14s AMD Edition Review (Running Fedora)

These are my installation etc. notes for running Linux on my new Thinkpad P14s laptop with 32GB RAM, 1TB SDD and 8 Core, 16 Thread AMD CPU.

Detailed specs

Here is what they quoted as the specs after I confirmed my order:

# This script is quick and dirty code. It is very preliminary and may be improved one day ;)
library("jsonlite")
library("tidyverse")
library("httr")
library("WikidataR")
paste0(
"https://www.wikidata.org/w/api.php?action=wbgetentities&",
"ids=Q6581097|Q6581072",
"&languages=fr&props=labels&format=json"
@gadenbuie
gadenbuie / xaringan-chromote-print.R
Last active November 16, 2023 16:49
Print xaringan slides to PDF, even the complicated ones
#' Print xaringan slides to PDF
#'
#' Prints xaringan slides to a PDF file, even complicated slides
#' with panelsets or other html widgets or advanced features.
#' Requires a local installation of Chrome.
#'
#' @param input Path to Rmd or html file of xaringan slides.
#' @param output_file The name of the output file. If using NULL then
#' the output filename will be based on filename for the input file.
#' If a filename is provided, a path to the output file can also be provided.
write.csv(iris, "iris.csv")

read_csv_filtered <- function(file, ..., select_vars = NULL, chunk_size = 10) {
  stopifnot(requireNamespace("dplyr", quietly = TRUE),
            requireNamespace("readr", quietly = TRUE))
  
  filter_by_id <- function(..., select_vars) {
    function(.data, pos) {
      if (!is.null(select_vars)) .data <- dplyr::select(.data, !!!select_vars)