Random Linux stuff
This is a growing collection of handy one liners that I've used from time to time but can never remember the syntax for
Slideshow one liner with ffmpeg
Create a slideshow in mp4 format from a bunch of images
ffmpeg -y -r 1/3 -framerate 1 -i %1d.jpg -c:v libx264 -vf fps=5 -pix_fmt yuv420p out.mp4
Summary: String Manipulation and Expanding Variables
Generic bash syntas stuff that I often need to look up
${parameter:-defaultValue} Get default shell variables value
${parameter:=defaultValue} Set default shell variables value
${parameter:?"Error Message"} Display an error message if parameter is not set
${#var} Find the length of the string
${var%pattern} Remove from shortest rear (end) pattern
${var%%pattern} Remove from longest rear (end) pattern
${var:num1:num2} Substring
${var#pattern} Remove from shortest front pattern
${var##pattern} Remove from longest front pattern
${var/pattern/string} Find and replace (only replace first occurrence)
${var//pattern/string} Find and replace all occurrences
${!prefix*} Expands to the names of variables whose names begin with prefix.
${var,}
${var,pattern} Convert first character to lowercase.
${var,,}
${var,,pattern} Convert all characters to lowercase.
${var^}
${var^pattern} Convert first character to uppercase.
${var^^}
${var^^pattern} Convert all character to uppercase..
Copying with tar
Copy from cwd to destination using tar
tar cvf - . | (cd /<destination path>/; tar xvf -)
Quick Directory Count
Get a quick summary of the number of dirs and files under a path using dents rather than statting recursively