Skip to content

Instantly share code, notes, and snippets.

View hanneshauer's full-sized avatar

Hannes Hauer hanneshauer

  • Vienna, Austria
View GitHub Profile
@hanneshauer
hanneshauer / .bashrc
Last active January 25, 2019 21:36
Automatically attach to a tmux-session if it exists
# Automatically attach to tmux
if [[ "$TMUX" == "" ]] && [[ "$SSH_CONNECTION" != "" ]]; then
WHOAMI=$(whoami)
if tmux has-session -t $WHOAMI 2>/dev/null; then
tmux -2 attach-session -t $WHOAMI
else
tmux -2 new-session -s $WHOAMI
fi
fi
# Get Title and file path for items in a specific section location (paths added to a library)
# Detailed version
SELECT metadata_items.title, media_items.section_location_id, media_parts.file
FROM metadata_items
JOIN media_items, media_parts
WHERE metadata_items.id = media_items.metadata_item_id AND media_parts.media_item_id = media_items.id AND media_items.section_location_id = "[WANTED_SECTION_LOCATION_ID]"
# Simpler version with less information
SELECT file FROM media_parts WHERE file LIKE "[PATH]/%"
@hanneshauer
hanneshauer / DisableMacPhotoImportAutoLaunch
Last active July 23, 2016 11:19
Disable automatic launch of Apple Photos upon plugging in any camera or camera media (Via: http://petapixel.com/2015/12/21/stop-apple-photos-from-auto-launching-in-os-x-with-one-command/)
defaults -currentHost write com.apple.ImageCapture disableHotPlug -bool YES

Keybase proof

I hereby claim:

  • I am hanneshauer on github.
  • I am hanneshauer (https://keybase.io/hanneshauer) on keybase.
  • I have a public key whose fingerprint is D12C 71DF 4C36 3D5A 4212 FA45 E0C2 A5A7 CAC3 B682

To claim this, I am signing this object: