Skip to content

Instantly share code, notes, and snippets.

@oPromessa
oPromessa / check_timezone.v2.py
Created May 15, 2025 19:21
Mac Photos: identify all pics with mismatched Timezone vs GPS Location and prepare commands to fix it: osxphotos timewarp and osxphotos push-exif. See https://github.com/RhetTbull/osxphotos/issues/1788
#!/usr/bin/env python3
"""This script checks and fixes timezone inconsistencies in photos
managed by the Photos app on macOS.
It uses the `osxphotos` library to access photo metadata and the
`timezonefinder` library to determine timezones based on GPS coordinates.
Use with Python 3.11 or later.
Required Python libraries: `pip install osxphotos pytz timezonefinder rich`
@oPromessa
oPromessa / ncheck_dst.py
Last active August 28, 2024 15:21
Compute UTC offset respecting DST for a GPS Location (latitude, Longitude) and a given date/time
"""
by oPromessa, 2024
Published on https://gist.github.com/oPromessa/85c2040a0187fe6868ead8a4b0ed912e
Based on Location (latitude, longitude) and date time (YYYY:MM:DD HH:MM:SS)
finds the corresponding Timezone and assocaited DST True/False and
returns UTS Offset in the format [+-]HH:MM
Usage: ncheck_dst.py [OPTIONS] LATITUDE LONGITUDE DATE_STR
@oPromessa
oPromessa / .bash-login.md
Last active January 16, 2023 23:17
exiftool related functions simplify repetitive tasks.

Place this on your ~/.bash_login file so that functions are available on your BASH upon every login.

###############################################################################
#
# Standard Alias: Uncomment the ALIASES entries you elect to use from this section
#
###############################################################################
#alias vibashl='vi ~/.bash_login'

#alias ll='ls -lisahG'
@oPromessa
oPromessa / .exiftool_bash_aliases
Last active October 20, 2018 15:33
Helpful bash exiftool related functions to set various EXIF and date/time values on pics and movies files.
###############################################################################
#
# EXIFTOOL related commands
#
###############################################################################
if [ ! -f ~/EXIF_format.fmt ]
then
cat > ~/EXIF_format.fmt << EOF
#[HEAD]Directory|FileName|Make|DateTimeOriginal|FileModifyDate|CreateDate|Keywords|Subject|ImageOrientation|Caption-Abstract|ModifyDate|Description
\$Directory|\$FileName|\$Make|\$DateTimeOriginal|\$FileModifyDate|\$CreateDate|\$Keywords|\$Subject|\$ImageOrientation|\$Caption-Abstract|\$ModifyDate|\$Description
#!/usr/bin/env python
"""
by oPromessa, 2018
flickrapi login example (python 2.7 and 3.6 compatible)
"""
import sys
import os
import logging
import flickrapi