Skip to content

Instantly share code, notes, and snippets.

View smohammadhn's full-sized avatar
👊
Achieving Goals ...

S.Mohammad Hosseininejad smohammadhn

👊
Achieving Goals ...
View GitHub Profile
rm -rf webp
mkdir webp
for img in *.png; do
echo $img
ffmpeg -i $img -vf scale=80:80 -compression_level 6 -q:v 80 "./webp/${img%.png}.webp"
done
aria2c -x 10 -s 10 -j 2 -c --file-allocation=none --dir=Files/Movies/house/S03 -i urls.txt
@smohammadhn
smohammadhn / gist:68ce19da49ffbc74abb787be105f104a
Created August 22, 2024 11:59
Chrome disable CORS commad on MacOS:
open -na Google\ Chrome --args --user-data-dir=/tmp/temporary-chrome-profile-dir --disable-web-security
@smohammadhn
smohammadhn / gist:256786b34756f691717c1bf0d5fbbd27
Created April 22, 2024 15:15
Git delete all merged branches locally (except main and develop)
git branch --merged | egrep -v "(^\*|main|develop)" | xargs git branch -d
@smohammadhn
smohammadhn / gist:6b33aa4664c1b6253337e2656156039f
Last active April 9, 2025 13:35
Useful `ffmpeg` commands
** ffmpeg command to convert any video to a format which is widely known by older devices (Tvs, etc ...)
ffmpeg -i input.mp4 -vf "fps=24" -c:v libx264 -crf 23 -maxrate 2M -bufsize 2M -c:a aac -b:a 192k output.mp4
** ffmpeg Command to reduce the file size of a video while preserving good quality
ffmpeg -i test.mov -vf "scale=-1:720" -r 24 -c:v libx264 -crf 28 -preset medium -c:a aac -b:a 128k output.mp4
** ffmpeg command to reduce the file size of an image, scale down the resolution to 480p, low quality
ffmpeg -i input.jpg -vf "scale=-1:480" -preset medium -q:v 4 output.jpg
def change(string):
arr = ""
for char in string:
if char == "0":
arr += "1"
else:
arr += "0"
return arr