Skip to content

Instantly share code, notes, and snippets.

View bastistician's full-sized avatar

Sebastian Meyer bastistician

View GitHub Profile
@bastistician
bastistician / Rd2all
Last active March 4, 2026 09:47
R scripts
#!/bin/bash
## Convert an Rd file to all supported help formats.
## Copyright (C) 2025 Sebastian Meyer <seb.meyer@fau.de>
set -e
R=R
if [ -n "${R_HOME}" ]; then # R CMD Rd2all
R=${R_HOME}/bin/R
@bastistician
bastistician / advoptipng.sh
Last active June 15, 2024 08:40
bash scripts
#!/bin/bash
# use optipng followed by advdef for lossless compression of a set of png files
# or run this compression in parallel for all png files of a given directory
if [ $# -eq 0 ]; then
echo "usage: $0 <DIR|FILES...> " >&2
exit 1
fi
export OPTIOPTS="-quiet -preserve -i0 -zc4 -zm5 -zw32k -zs0 -f0"
@bastistician
bastistician / e2fsck.sh
Last active August 21, 2022 19:56
bash snippets
## check an ext file system with progress reporting
sudo e2fsck -v -p -f -C0 /dev/sdc3
## We could pass the -ck or -cck option to run a badblocks subprocess
## but that lacks progress information and takes very long.
## Alternatively, we can do a manual search for bad blocks.
## The default is read-only; recommended but slow is -n (non-destructive rw).
sudo fdisk -l /dev/sdc3 # find out block size, here 512
sudo badblocks -s -v -b 512 -o badblocks.txt /dev/sdc3