Skip to content

Instantly share code, notes, and snippets.

View unabridgedxcrpt's full-sized avatar

Jonathan Bird unabridgedxcrpt

View GitHub Profile
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management

Last updated: 2015-08-11

Searching for Files

Find images in a directory that don't have a DateTimeOriginal

exiftool -filename -filemodifydate -createdate -r -if '(not $datetimeoriginal) and $filetype eq "JPEG"' .

###Output photos that don't have datetimeoriginal to a CSV### Note this can take a long time if you have a lot of jpgs

"""
You can download the flickr API by running
pip install flickrapi
Info here:
http://stuvel.eu/media/flickrapi-docs/documentation/2-calling.html
You'll need to create a Flickr API app here:
@unabridgedxcrpt
unabridgedxcrpt / EXIFdate2photo.sh
Created December 11, 2015 15:14
Grab the EXIF date from original date time field and overlay it on a photo with white text with black stroke font.
#!/bin/sh
#Credit: http://dptnt.com/2009/08/add-date-time-stamp-to-jpeg-photos-using-free-software-mac-linux-nix-edition/
# I added:
# 1. formatting the EXIF date to use the month name and remove the seconds from the time display
# 2. outline the text for lighter backgrounds and better contrast in more images.
#Dependencies: imagemagick, exiftool
# Change the font variable to point to your font location
##font="~/Library/Fonts/digital-7 (mono).ttf"
## digital 7 for to make date time like the *olden days*: http://www.dafont.com/digital-7.font
@unabridgedxcrpt
unabridgedxcrpt / filedate2touch.sh
Last active December 11, 2015 17:02
Grab date from filename (my photos are grabbed of camera with date as filename "ccyy-mm-dd hh.mm.ss{-x}" and I wanted to reset the file mod dates on original files after some script I used touched all the file mod dates.
#!/bin/bash
# find specific files
# should collect all files that want to work on
# I should probably make this generic for running on any arbitrary files, but I didn't need that for this simple fix
files=$(find . -type f -name '*_e.jpg')
# use newline as file separator (handle spaces in filenames)
IFS=$'\n'
@unabridgedxcrpt
unabridgedxcrpt / nozero.sh
Created December 11, 2015 15:49
remove leading zero. I used this for a bash script to remove the leading 0 from a month number
nozero=$(echo $number | sed 's/^0*//')
#!/bin/bash
# DESCRIPTION: Take filename in format "ccyy-mm-dd hh-mm-ss*" and use this to populate the exif Date/Time Original field
# USAGE: ./filedate2exiforiginal.sh file1, file2, etc. Can use bash file globbing
# FUTURE IMPROVEMENTS: 1. check if date-time-original field already populated and optionally skip or overwrite
# 2. sed command can be much more elegant have used the hammer method here :)
if [ $# -eq 0 ]
then
cat << _EOF_
#!/bin/bash
# DESCRIPTION: Use as a template for operations on files/directories sent to the script.
# USAGE:
# FUTURE IMPROVEMENTS:
if [ $# -eq 0 ]
then
cat << _EOF_
@unabridgedxcrpt
unabridgedxcrpt / build-python-2.7.9.sh
Created December 18, 2015 13:33
upgrade Python 2.7.6 -> 2.7.9 on Ubuntu 14.04
#!/bin/sh
#
# Installs Python 2.7.9 on Ubuntu 14.04 to include security updates
# Run this script with superuser privileges.
#
BASEDEPS="build-essential python-pip"
BUILDDEPS="libbz2-dev \
libc6-dev \
libgdbm-dev \