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
# One Liner | |
find . -type d \( -name "thumbs" -o -name "list" \) -exec rm -rf {} + | |
# Array | |
#!/bin/bash |
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
#!/bin/bash | |
# Define the main images folder | |
main_images_folder="images" | |
# Define the desired width for the images | |
target_width=738 | |
# Find and process all image files recursively | |
find "${main_images_folder}" -type f \( -iname "*.jpg" -o -iname "*.jpeg" -o -iname "*.png" -o -iname "*.gif" -o -iname "*.tif" -o -iname "*.tiff" -o -iname "*.bmp" -o -iname "*.webp" \) | while read file; do |
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
/** | |
* Format numbers to their abbreviated form | |
* | |
* Converts the given number to an abbreviated string representation, adding a suffix of 'K', 'M', 'B', or 'T' | |
* to represent thousands, millions, billions, and trillions, respectively. | |
* | |
* @param float $number The number to format | |
* @param int $precision The decimal precision to use for the formatted number | |
* @return string The abbreviated string representation of the number | |
*/ |