Skip to content

Instantly share code, notes, and snippets.

View mfansler's full-sized avatar
🧫
aroundish

Mervin Fansler mfansler

🧫
aroundish
View GitHub Profile
@laggardkernel
laggardkernel / chpwd-equivalent-in-bash.md
Last active September 5, 2024 20:11
Create chpwd Equivalent Hook in Bash #bash #hook #zsh

There's not a complete hook system designed in Bash when compared with other modern shells. PROMPT_COMMAND variable is used as a hook in Bash, which is equivalent to precmd hook in ZSH, fish_prompt in Fish. For the time being, ZSH is the only shell I've known that has a chpwd hook builtin.

PROMPT_COMMAND

If set, the value is interpreted as a command to execute before the printing of each primary prompt ($PS1).

https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Bash-Variables

chpwd Hook in Bash

@tomsing1
tomsing1 / subsample_bam.sh
Created June 7, 2021 21:58
Shell script to sub-sample a BAM file
# Shell function to subsample to a fixed number of alignments,
# requiring the sambamba and samtools suites to be available.
# see https://www.biostars.org/p/76791/
function SubSample {
local FACTOR=$(samtools idxstats $1 | cut -f3 | \
awk -v COUNT=$2 'BEGIN {total=0} {total += $1} END {print COUNT/total}')
if [[ $FACTOR > 1 ]]
then
echo '[ERROR]: Requested number of reads exceeds total read count in' $1 '-- exiting' && exit 1
@mfansler
mfansler / LICENSE-CC0
Last active October 7, 2025 07:23
Conda Forge R Team Scraps
Creative Commons Legal Code
CC0 1.0 Universal
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
@hpages
hpages / blas_benchmarks.md
Last active October 16, 2025 13:39
BLAS benchmarks

BLAS benchmarks

WORK IN PROGRESS!

1. The operations that we benchmarked

We benchmarked the following operations (all operations got timed with system.time()):