Long story short: local corporate server have 2 interfaces: 1) Public Internet IP address (eth0) 2) Local network IP address (eth1) By default Linux tries to reply on interface with default route (eth0 in this case), even if request came from different iface (eth1). Let’s fix it.
Author: gmelikov
Debian Stretch diskless machine via PXE boot
Inspired by this article. Sometimes I use barebone machines to test or run something, and I already have a server machine, so it’s better to use diskless PXE boot. Enjoy!
Add audio file to mkv
mkvmerge -o output-with-sound.mkv -A input-video.mkv soundfile.mp3
Batch lossless optimize images in Linux, Mac OS and Windows
Linux and Mac OS:
find . -iname '*.png' -exec optipng -o7 -strip all "{}" \; find . -iregex '.*\.\(jpg\|jpeg\|jpe\|jif|jfif|jfi\)$' -exec jpegoptim --all-progressive --strip-all --strip-com --strip-exif --strip-iptc --strip-icc "{}" \;
Batch resize images with different sizes for each orientation in Linux, Mac OS and Windows
#!/bin/bash I=0 for f in *.jpg do (( I++ )) r=$(printf "%03d" $I) read w h <<< $(convert "$f" -ping -format "%w %h" info: ) if [ $w -gt $h ]; then echo "$f is $h tall and $w wide (landscape)" convert "$f[800x>]" $r.jpg else echo "$f is $h tall and $w wide (portrait)" convert "$f[395x>]" $r.jpg fi done
Change a File’s Last Modified and Creation Dates on Mac OS X and Linux
Mac os:
find ./folder/ -type f -exec touch -mt 07011200 {} \;
Linux:
find ./folder/ -type f -exec touch -mt 07011200 {} \;