Shell Scripts

reMarkable Suspend Screen Script

# Your local path and IP address will vary.
# The suspend.png file should be 1872 x 1404 at 226 DPI.

alias setremarkablesleepscreen='scp ~/Documents/Drawings,\ Diagrams,\ and\ Art/reMarkable/suspended.png root@'

BASH to fix JPG timestamps

#! /usr/local/bin/bash

# November 23, 2019
# Downloading images from Shutterfly sets all of the file system attributes
# to the download time. This script pulls the createdate attribute from the
# EXIF data and touches the file appropriately. Empty EXIF createdate data
# is filtered.
# This script can obviously be used to change the timestamp of any file with
# EXIF data to the createdate.

for item in "$@"
timestamp=`exiftool -T -createdate "$item" | sed -e s/://g | sed -e "s/ //" | cut -c 1-12`
echo $item - $timestamp
if [ $timestamp != "-" ];
touch -t "$timestamp" "$item"

Shell Scripts for ProGallery Management


# Get the base name, create a _tn version, downsize the _tn to a max of 1280 pixels,
# and copy them to the target gallery. (Future: add a command line arg for gallery)

a=`basename -s .jpg $1`
cp $a.jpg ${a}_tn.jpg
sips -Z 1280 ${a}_tn.jpg
mv $a.jpg /Volumes/wwwroot/Pictures/Food
mv ${a}_tn.jpg /Volumes/wwwroot/Pictures/Food

# I use ProGallery -
# ProGallery uses a CSV file as the image directory source.
# The first line is labels: Title, ThumbnailPath, ImagePath.
# Images are displayed in order, so we need to add the labels
# and the
new images *at the top*. Also, Title can include HTML, so I do.

# Strip off the header of the existing file.
grep -v Thumbnail /Volumes/wwwroot/Albums/Food.csv > /Volumes/wwwroot/Albums/Food.csv.o
# Delete the existing file.
rm /Volumes/wwwroot/Albums/Food.csv
# Create the labels for the new file
echo \"Image\", \"Thumbnail\", \"Fullsize\" > /Volumes/wwwroot/Albums/Food.csv
# Add the new image
echo '"'${a}'
'${a}'"', ../Pictures/Food/${a}_tn.jpg, ../Pictures/Food/${a}.jpg >> /Volumes/wwwroot/Albums/Food.csv
# Concatenate the old list of images to the end
cat /Volumes/wwwroot/Albums/Food.csv.o >> /Volumes/wwwroot/Albums/Food.csv
# Delete the old image list
rm /Volumes/wwwroot/Albums/Food.csv.o
# Open the gallery file to edit the Title.
open -a /Applications/ /Volumes/wwwroot/Albums/Food.csv