Skip to content

Instantly share code, notes, and snippets.

@numpde
numpde / fdr.py
Last active November 9, 2020 11:32
Visualization of the FDR and estimates by Benjamini-Hochberg and Storey-Tibshirani
# RA, 2020-10-16
"""
Visualization of the FDR and estimates by Benjamini-Hochberg and Storey-Tibshirani.
[1] Benjamini Y and Hochberg Y.
Controlling the false discovery rate: a practical
and powerful approach to multiple testing.
J R Statist Soc B, 1995.
@numpde
numpde / pdf_trick_2x1.sh
Last active November 3, 2020 12:10
Make PDF 2x1 for printing
# Make PDF 2x1 for printing
pdftk $FILE cat 1-end output - | pdfjam --nup 2x1 --landscape --outfile /dev/stdout | pdfjam --angle=90 /dev/stdin --outfile /dev/stdout | okular -
@numpde
numpde / Terminal
Last active November 29, 2020 18:10
Nautilus script: open terminal
#!/bin/bash
gnome-terminal
# Put in ~/.local/share/nautilus/scripts/
@numpde
numpde / CompressMP4
Last active October 6, 2021 08:26
Nautilus script: compress mp4 file
#!/bin/bash
function x {
mv "$1" "$1.original.mp4"
ffmpeg -i "$1.original.mp4" -vcodec libx264 -crf 40 "$1" -vf scale=640:-1 -preset veryslow \
&& mv "$1.original.mp4" "$1.done.mp4"
notify-send "$1 compression done."
}
# https://stackoverflow.com/questions/11003418/calling-shell-functions-with-xargs
@numpde
numpde / cleanup.sh
Last active March 14, 2021 21:11
Clean Ubuntu: logs, trash, snaps, etc.
#!/bin/bash
# From
# https://itsfoss.com/free-up-space-ubuntu-linux/
# APT
sudo apt-get autoremove
sudo apt-get clean
@numpde
numpde / model_to_html.m
Created May 22, 2021 11:41
Export SimBiology model as HTML
% model_to_html(m)
% Usage:
%
% fid = fopen('model.html', 'wt');
% fprintf(fid, evalc("model_to_html(sbioloadproject('model.sbproj').m1)"));
% fclose(fid);
%
% RA, 2021-05-22, The Unlicense
function model_to_html(m)
@numpde
numpde / hashing.py
Created June 17, 2021 20:19
Hash stuff
# SOURCE: https://home.cc.umanitoba.ca/~psgendb/doc/spades/joblib3/hashing.py
"""
Fast cryptographic hash of Python objects, with a special case for fast
hashing of numpy arrays.
"""
# Author: Gael Varoquaux <gael dot varoquaux at normalesup dot org>
# Copyright (c) 2009 Gael Varoquaux
# License: BSD Style, 3 clauses.
@numpde
numpde / sorcery_param_logger.py
Last active June 20, 2021 19:51
Parameter logger with sorcery
# RA, 2021-06-20
import executing
import inspect
import sorcery
class Memo(dict):
"""
Example:
@numpde
numpde / rCRS.fasta
Created April 26, 2022 09:27
rCRS for MT
>MT
GATCACAGGTCTATCACCCTATTAACCACTCACGGGAGCTCTCCATGCATTTGGTATTTT
CGTCTGGGGGGTATGCACGCGATAGCATTGCGAGACGCTGGAGCCGGAGCACCCTATGTC
GCAGTATCTGTCTTTGATTCCTGCCTCATCCTATTATTTATCGCACCTACGTTCAATATT
ACAGGCGAACATACTTACTAAAGTGTGTTAATTAATTAATGCTTGTAGGACATAATAATA
ACAATTGAATGTCTGCACAGCCACTTTCCACACAGACATCATAACAAAAAATTTCCACCA
AACCCCCCCTCCCCCGCTTCTGGCCACAGCACTTAAACACATCTCTGCCAAACCCCAAAA
ACAAAGAACCCTAACACCAGCCTAACCAGATTTCAAATTTTATCTTTTGGCGGTATGCAC
TTTTAACAGTCACCCCCCAACTAACACATTATTTTCCCCTCCCACTCCCATACTACTAAT
CTCATCAATACAACCCCCGCCCATCCTACCCAGCACACACACACCGCTGCTAACCCCATA
@numpde
numpde / webui-user.sh
Last active January 19, 2023 12:40
Settings for the SD server (CPU)
#!/bin/bash
# MODIFIED FROM
# https://raw.githubusercontent.com/AUTOMATIC1111/stable-diffusion-webui/master/webui-user.sh
# Install directory without trailing slash
install_dir="/home/$(whoami)/apps/1111"
# Name of the subdirectory
clone_dir="sd-webui"