cheat-sheet articles are about code
snippets that I need every once in a while, and which I constantly forget
about.
The transpose
video filter of ffmpeg allows rotating a video by 90 degrees:
ffmpeg -i in.mp4 -vf 'transpose=1' out.mp4
Specify a value from 0–3 as transpose
’s argument:
Value |
Description |
0 |
Rotate by 90 degrees counterclockwise and flip vertically (default) |
1 |
Rotate by 90 degrees clockwise |
2 |
Rotate by 90 degrees counterclockwise |
3 |
Rotate by 90 degrees clockwise and flip vertically |
cheat-sheet articles are about code
snippets that I need every once in a while, and which I constantly forget
about.
You can use inotifywait from inotify-tools to automatically run commands,
for example whenever a file is written to.
The following shell loop runs xelatex
whenever ~/input.tex
changes:
inotifywait -m -e close_write ~/input.tex | while read line
do
xelatex -interaction nonstopmode ~/input.tex
done
It is also possible to watch more than one file. Additionally, if using the
-r
switch, any specified directory will be watched recursively:
inotifywait -m -e close_write -r locale/ | while read line
do
python manage.py compilemessages
done
Update: December 19, 2015
The previous version of this article did not make use of inotifywait’s -m
option:
while inotifywait -e close_write -r locale/
do
python manage.py compilemessages
done
This way, inotify’s watches are re-setup after each single run of the
specified command. If watching large directory trees, this is a pretty
expensive operation.
In contrast, the -m
option activates inotifywait’s “monitor” mode—the
necessary watches are set up only once, and inotifywait runs indefinitely.
cheat-sheet articles are about code
snippets that I need every once in a while, and which I constantly forget
about.
Use zmv
to recursively convert the names of all files and (sub-) directories
within the current directory to lower case:
autoload zmv
zmv '(**/)(*)' '$1${2:l}'
If you want to convert to upper case instead of lower case, use :u
instead
of :l
.