This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage: chdir to parent directory & set target directory name to D | |
# (zsh pipe related -> https://stackoverflow.com/a/4995875/26736) | |
# (md5 creation -> https://serverfault.com/a/120597/70666) | |
# TODO: convert this one liner to function or shell script with options | |
tar cvSf - $D 2> >(xargs -I '{}' sh -c "test -f '{}' && md5sum '{}'" |tee $D.md5) | pv -pteb -s $(du -sB1 $D |awk '{print$1}') | nice -10 zstd -15 --sparse -T0 | tee ./$D.tar.zst | md5sum | sed "s/-/$D.tar.zst/" >> $D.md5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# how can a docker container check if it has a capability - Stack Overflow | |
# https://stackoverflow.com/questions/46702043/how-can-a-docker-container-check-if-it-has-a-capability | |
# need to install capsh (libcap2-bin for debian) | |
for i in $(capsh --print | grep "Current:" | cut -d ' ' -f3 | sed 's/,/ /g'); do | |
echo $i | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# https://gist.github.com/benok/c1342272108ec00ee4b78a69733a1a70 | |
# (just translated https://gist.github.com/moritzheiber/7b08e7c89508054f67f9 in English) | |
import csv, sys,os | |
try: | |
file = open(sys.argv[1], "rt") | |
reader = csv.DictReader(file) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# blink disk drive's led (useful for disk array using LSI Logic HBA to locate failed drive, etc.) | |
# https://gist.github.com/benok/c117badbfb6af744578d48e2ab1d4d4f | |
# (based from https://stackoverflow.com/a/4018229/26736) | |
# need blockdev(8) to clear disk cache on access | |
usage() { | |
echo "${0##*/} [-n] device(sda,sdb,etc.)" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# enable "ps [-p] PID" for /bin/ps from busybox (like Alpine) | |
# copy this script as /usr/local/bin/ps or /usr/bin/ps, and chmod 755 it. | |
if [ $# == 1 ]; then | |
echo $1 | grep -q -E '^[0-9]+$' # number only argument | |
if [ $? == 0 ]; then | |
OPT_P=1 | |
ARG_P=$1 | |
fi |
NewerOlder