Skip to content

Instantly share code, notes, and snippets.

@fcaylus
Last active February 23, 2017 18:29
Show Gist options
  • Save fcaylus/04e27c12b4836c9499fa80691d94a8a6 to your computer and use it in GitHub Desktop.
Save fcaylus/04e27c12b4836c9499fa80691d94a8a6 to your computer and use it in GitHub Desktop.
Usefull commands
#############################################
# Windows
#############################################
# Compute a MD5 Hash
certutil -hashfile C:\path\to\file MD5
#############################################
# Linux
#############################################
#
# Cette commande cherche toutes les images ayant les extensions .CR2 dans un dossier spécifique,
# pour les copier dans le dossier courant si la même image en .jpg existe. Le fichier .jpg est supprimé aprés la copie.
# Elle permet donc de remplacer touts les .jpg par des .CR2 depuis un dossier où les fichiers .CR2 sont "en vrac"
#
find ../banque-raw -name "IMG_*.CR2" -print0 | xargs -0rn 1 -I filename sh -c 'FL=$(basename filename .CR2); JPEGFL=$(find . -name $FL.jpg); if [ ! -z "$JPEGFL" ]; then echo $JPEGFL ; NEWDIR=$(dirname "$JPEGFL"); cp filename "$NEWDIR" && rm "$JPEGFL";fi'
#
# Optimize all jpeg files in current directory
#
IFS=$'\n';for f in $(find -name '*.JPG' -or -name '*.jpg' -or -name '*.jpeg'); do jpegoptim $f; done
#
# Convert all CR2 files to jpeg (and remove CR2 files after conversion)
#
IFS=$'\n';for f in $(find -name '*.CR2'); do ufraw-batch --out-type=jpg --compression=100 $f && rm $f; done
#
# Enable bluetooth on Ubuntu
#
sudo rfkill list
sudo rfkill unblock all
sudo hciconfig hci0 up
#
# List all dirs in the current dir
#
for DIR in $(find ./* -maxdepth 0 -type d ); do DIR_NAME=$(basename $DIR) && echo $DIR_NAME; done
#
# Rotate all images in the current dir by 90 degres
#
find . -name "*.jpg" | while read file; do convert "$file" -rotate 90 "$file"_rotated.jpg; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment