Skip to content

Instantly share code, notes, and snippets.

View Kumquatum's full-sized avatar

Gwenaëlle Lemoine Kumquatum

View GitHub Profile

(French below)

Singularity rootless install

Not having the administrator rights, it is necessary to install most of the software locally and to think of putting the path redirections towards these installations.
Ideally create a folder on your home to put all the software. Example:

@Kumquatum
Kumquatum / multiple_note.tex
Created November 12, 2020 19:13
Function to create notes with different counters and refer to it
\documentclass{article}
\usepackage[utf8]{inputenc}
\newcommand\note[2]{\getid{#1}\label{note:#1:#2}\textsuperscript{\ref{note:#1:#2}}}
\makeatletter
\newcommand{\getid}[1]{%
\@ifundefined{c@#1}
{% the counter doesn't exist
\newcounter{#1}\setcounter{#1}{1}%
}
# ********************************************************************* #
# Quick script to find which example is the longest to run in a package #
# ********************************************************************* #
library(magrittr)
# Getting function name
functions <- list.files("man") %>%
strsplit(".Rd")

Personnal cgroup config

Based on paranoids blog article cgroup ubuntu 18.04 howto

Installing packages

sudo apt install cgroup-bin cgroup-lite cgroup-tools cgroupfs-mount libcgroup1

Config files

# Telling git to use a specific private key
Host github.com
HostName github.com
IdentityFile ~/.ssh/id_rsa_github
User git
@Kumquatum
Kumquatum / list.depth.R
Last active January 8, 2020 10:48
Get list depth
# Computes max depth of a list (recursively)
depth <- function(this) {
if (is.list(this)) {
ifelse(length(this) > 0, 1 + max(sapply(this, depth)), 0)
} else { 0 }
}
# Wrapping function to check if first point of entry is a list
list.depth <- function(my_list) {
ifelse(is.list(my_list), depth(my_list), stop("my_list have to be a list"))
@Kumquatum
Kumquatum / tree.sh
Last active March 29, 2019 12:49
tree without install
shopt -s globstar
for file in **/*
do
slash=${file//[^\/]}
case "${#slash}" in
0) echo "├── ${file}";;
1) echo "│ ├── ${file}";;
2) echo "│ │ ├── ${file}";;
esac
done
@Kumquatum
Kumquatum / nested_list_inside_out.R
Created September 17, 2018 17:52
Re-organising a nested list to a new list were inside lists are the outside list
library(dplyr)
library(purrr)
mini = list(
fpkm = list(
A = data.frame(x = c(1,3,4), y = c(23,634,12)),
B = data.frame(x = c(4,7,8), y = c(22,857,35))
),
counts = list(
A = data.frame(x = c(0.1,0.3,4), y = c(0.23,0.634,0.12)),
@Kumquatum
Kumquatum / restart_bluetooth.sh
Created July 31, 2018 17:43
Restart bluetooth service on ubuntu
# Restart bluetooth service on ubuntu when it can be toogle on/off
sudo /etc/init.d/bluetooth restart
library(ggplot2)
ggplot(data = data.frame(a = c(1,2,3), b=c(4,5,6)), aes(x=a, y=b)) + geom_point()