Skip to content

Instantly share code, notes, and snippets.

@altbdoor
Last active November 19, 2020 07:39
Show Gist options
  • Save altbdoor/94a0e8c70b54f20071fc1faf8003c340 to your computer and use it in GitHub Desktop.
Save altbdoor/94a0e8c70b54f20071fc1faf8003c340 to your computer and use it in GitHub Desktop.
Bash scriptlets
# path adjust
CURRENT_DIR="$( cd "$(dirname "${BASH_SOURCE[0]}")" && pwd )"
cd "$CURRENT_DIR"
# compress all png to jpg with graphicsmagick
for i in *.png; do gm convert "$i" -quality 95 -strip "${i%.*}.jpg"; done
# or alternatively there's png2jpeg for windows
# https://sourceforge.net/projects/png2jpeg/
for i in *.png; do png2jpeg -q 95 -outfile "${i%.*}.jpg" "$i"; done
# get the basic file info
for i in *.png; do gm identify -format "%f %bb %P q%Q" "$i"; done
# download urls from text file
xargs -n 1 curl -OL# < list.txt
# mp3 to mono 16 bits wav with volume adjustment
ffmpeg -i "$i" -acodec pcm_s16le -ac 1 -ar 16000 -af "volume=0.4" -y "${i%.*}.wav"
# mysql dump
mysqldump -u {username} -p{password} {db_name} > output.sql
# perl to remove stupid huge sql table inserts
perl -i -0777pe 's/INSERT INTO \`table_name\`.*?\)\;//gs' file_to_trim.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment