Skip to content

Instantly share code, notes, and snippets.

@MafiaInc
Last active June 3, 2018 20:30
Show Gist options
  • Save MafiaInc/3c7ac065b3eae3f01b1c to your computer and use it in GitHub Desktop.
Save MafiaInc/3c7ac065b3eae3f01b1c to your computer and use it in GitHub Desktop.
Small snippets to remember that I use from time to time.
[[ "$(ps -o stat= -p $PPID)" = "Ss" ]] && echo "Executed in foreground" || echo "Executed in background"
# credit : https://stackoverflow.com/questions/4261876/check-if-bash-script-was-invoked-from-a-shell-or-another-script-application
echo -e "Use%\tAvail:\tMounted on:" ; df -hTP | sort -nr -k6 | grep -P '\d%' | awk '{ printf $6 ; printf "\t" ; printf $5 ; printf "\t" ; print $7 }'
for i in `find . -name "*.webm" -print`;
do
DIR=`dirname $i`;
NAME=`basename $i`;
ffmpeg -i $i -s 620x348 -ss 00:00:08.435 -vframes 1 ${DIR}/${NAME%.webm}.jpg;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment