Last active
July 7, 2023 18:56
-
-
Save phoenisx/f7825b3d621f015ec4600cf333a402fe to your computer and use it in GitHub Desktop.
Collection of useful Shell commands
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This helps to generate gif from any video file. | |
ffmpeg -i example.mov -ss 0 \ | |
-vf "fps=10,scale=320:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" \ | |
-loop 0 output.gif | |
# To stitch multiple videos together | |
# Ref: https://stackoverflow.com/a/7582140/2849127 | |
ffmpeg -i big.avi -vf "movie=small0.avi [small0]; [in][small0] overlay=10:10 [tmp];\ | |
movie=small1.avi [small1]; [tmp][small1] overlay=30:10 [out]" out.avi | |
# Command to download file using aria2c, which requires Auth Token for Download validation | |
aria2c \ | |
--header "Host: {host}" \ | |
--header "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" \ | |
--header "Upgrade-Insecure-Requests: 1" \ | |
--header "Cookie: {Token}" \ | |
--header "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Firefox/91.0" \ | |
--header "Accept-Language: en-us" -x 16 -s 16 {URL} | |
# RnR (Replace Names Recursively) | |
# Dry Run | |
rnr -r '(?P<name>.*?)\.(?P<ext>(css|scss))' '${name}.module.${ext}' ./* | |
# Force to commit renaming | |
rnr -r -f '(?P<name>.*?)\.(?P<ext>(css|scss))' '${name}.module.${ext}' ./* | |
############ | |
# | |
# Helpful Git commands, that are not used frequently. | |
# | |
############ | |
# Log commits since X date till Y date. | |
git log --since='Oct 20 2022' --until='Oct 25 2022' | |
########################## Convert Image to PDF ################################## | |
i=150; convert aadhaar-front-bw.jpg -compress jpeg -quality 70 \ | |
-density ${i}x${i} -units PixelsPerInch \ | |
-resize $((i*827/100))x$((i*1169/100)) multipage.pdf | |
########################## Helpful Docker Commands ################################## | |
# Remove any image with tag: | |
docker rmi image-name:latest | |
# Get a list of all Docker images | |
docker images --format '{{.ID}}:{{.Repository}}:{{.Tag}}' | |
# Get a list of all images linked to all running Docker containers | |
docker ps --format '{{.Image}}' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment