Skip to content
  • Home
  • WHOAMI
  • How-tos

G.Melikov's blog

Category: how-to

how-to February 27, 2018March 23, 2020 by gmelikov

Linux network: reply on same interface as incoming

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.

Continue Reading
how-to February 25, 2018April 25, 2021 by 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!

Continue Reading
how-to June 3, 2017January 6, 2019 by gmelikov

Add audio file to mkv

mkvmerge -o output-with-sound.mkv -A input-video.mkv soundfile.mp3
Continue Reading
how-to June 1, 2017January 6, 2019 by gmelikov

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 "{}" \;
Continue Reading
how-to June 1, 2017January 6, 2019 by gmelikov

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
Continue Reading
how-to December 19, 2016April 14, 2020 by gmelikov

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 {} \;
Continue Reading

Recent Posts

  • Linux network: reply on same interface as incoming
  • Debian Stretch diskless machine via PXE boot
  • Add audio file to mkv
  • Batch lossless optimize images in Linux, Mac OS and Windows
  • Batch resize images with different sizes for each orientation in Linux, Mac OS and Windows

Recent Comments

  • gmelikov on Change a File’s Last Modified and Creation Dates on Mac OS X and Linux
  • gmelikov on Debian Stretch diskless machine via PXE boot
  • Francesco on Debian Stretch diskless machine via PXE boot
  • Sam on Change a File’s Last Modified and Creation Dates on Mac OS X and Linux
  • D on Change a File’s Last Modified and Creation Dates on Mac OS X and Linux

Archives

  • February 2018
  • June 2017
  • December 2016

Categories

  • how-to

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
Copyright © 2023 G.Melikov's blog – Designed & Developed by ZThemes.