Skip to content

Instantly share code, notes, and snippets.

View phillip-boombox's full-sized avatar

Phillip Dodson phillip-boombox

View GitHub Profile
@phillip-boombox
phillip-boombox / mp4-to-sprite-sheet
Last active July 25, 2019 00:13
Create a sprite sheet in the terminal using FFmpeg and ImageMagick
ffmpeg -i video.mp4 %04d.png && montage -geometry $(identify -format '%wx%h' $(ls | sort | head -1)) -tile 8x *.png sprite.jpg && echo $(ls *.png | wc -l) "frames" && rm *.png
@phillip-boombox
phillip-boombox / img2datauri.sh
Last active August 5, 2019 17:42
Convert an image to base64 data URI that's then copied to the clipboard.
#!/bin/bash
# Create a base64 data URI from an image and copy it to clipboard.
# Uses OpenSSL to create the base64 representation.
the_mimetype=$(file -bN --mime-type "$1")
the_content=$(openssl base64 < "$1" | tr -d '\n')
# Use printf instead of echo to avoid the ending newline
printf "data:$the_mimetype;base64,$the_content" | pbcopy
@phillip-boombox
phillip-boombox / .htaccess
Created February 5, 2020 18:27
Download images from remote WordPress website
# Pull images from remote site instead of local
# only if file requested is from the uploads folder
# and if the file does not exist locally
RewriteCond %{REQUEST_URI} ^/wp-content/uploads/[^\/]*/.*$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ https://SOMESITE.com/$1 [QSA,L]
$ dig yourdomain.com ANY @8.8.8.8