Skip to content

Instantly share code, notes, and snippets.

View fbucek's full-sized avatar
🏠
Working from home

fbucek

🏠
Working from home
View GitHub Profile
@fbucek
fbucek / gist:918d9bc239090d586f730628af535f55
Created August 21, 2022 19:59
cpu sdd benchmark oneliner ( linux )
echo "CPU cores: " $(grep -c 'cpu[0-9]' /proc/stat);dd if=/dev/zero bs=1MB count=1024 | sha512sum;echo "Disk bench:";dd if=/dev/zero of=/tmp/test1.img bs=1G count=1 oflag=dsync
@fbucek
fbucek / run.sh
Last active July 28, 2021 11:55
default bash script
#!/usr/bin/env bash
# src: https://gist.github.com/fbucek/f986da3cc3a9bbbd1573bdcb23fed2e1
set -e # error -> trap -> exit
GC="\033[0;32m";BC="\033[0;34m";RC="\033[0;31m";YC="\033[0;93m";NC="\033[0m"
function info() { echo -e "[${BC} $@ ${NC}]"; } # blue: [ info message ]
function pass() { echo -e "[${GC}PASS${NC}] $@"; } # green: [PASS]
function warn() { echo -e "\033[0;93m$@${NC}"; } # green: [PASS]
function fail() { FAIL="true"; echo -e "[${RC}FAIL${NC}] $@"; } # red: [FAIL]
trap 'LASTRES=$?; LAST=$BASH_COMMAND; if [[ LASTRES -ne 0 ]]; then fail "Command: \"$LAST\" exited with exit code: $LASTRES"; elif [ "$FAIL" == "true" ]; then fail finished with error; else echo -e "[\033[0;32m Finished `date +"%Y-%m-%d %H:%M:%S"` took: $SECONDS s $@ \033[0m]";fi' EXIT