Skip to content

Instantly share code, notes, and snippets.

View jwmann's full-sized avatar
🎯
Focusing

James W Mann jwmann

🎯
Focusing
View GitHub Profile
@jwmann
jwmann / getExifToolDSM.sh
Created August 1, 2023 17:46
Automatically download latest ExifTool and add it to the PATH on DSM
#!/bin/bash
# Function to get the latest version from the ExifTool website
get_latest_version() {
local latest_version=$(curl -s "https://exiftool.org/history.html" | grep -m 1 -oP "<a name='v\K[.0-9]+?(?='>)")
echo "$latest_version"
}
# Get the latest version
LATEST_VERSION=$(get_latest_version)
@jwmann
jwmann / garminAutoLike.js
Created July 20, 2023 06:09
Auto-Like Garmin Posts for TamperMonkey userscripts. Based on my stravaAutoLike.js
// ==UserScript==
// @name Auto-Like Garmin Posts
// @namespace http://tampermonkey.net/
// @version 0.1.0
// @description Like all the posts!
// @author James W Mann
// @match https://connect.garmin.com/modern/newsfeed
// @icon https://www.google.com/s2/favicons?sz=64&domain=connect.garmin.com
// @grant none
// ==/UserScript==
@jwmann
jwmann / stravaAutoLike.js
Last active July 20, 2023 06:07
Auto-Like Strava Posts for TamperMonkey userscripts
// ==UserScript==
// @name Auto-Like Strava Posts
// @namespace http://tampermonkey.net/
// @version 0.2.0
// @description Like all the posts!
// @author James W Mann
// @match https://www.strava.com/dashboard
// @icon https://www.google.com/s2/favicons?sz=64&domain=strava.com
// @grant none
// ==/UserScript==
@jwmann
jwmann / sortMedia.sh
Last active March 16, 2024 22:46
Use exiftool to recursively sort my images into a pre-defined folder structure. Source this file and call sortMedia
#! /bin/bash
sortMedia() {
EXIFTOOL=/opt/homebrew/bin/exiftool
DEFAULT_SOURCE_DIR_PATH="./" # Current Directory
DEFAULT_DESTINATION_DIR_PATH="/Volumes/home/Photos/" # NAS Photos
EXIFDATETAG="${3:-CreateDate}"
PREFIX="${4:-jwm}"
SORT_FILETYPE="${5:-true}"
ALLOW_DUPS="${6:-true}"
@jwmann
jwmann / toggleAudioOutput.sh
Last active September 18, 2020 19:26
Toggle between two audio devices on macOS as a shell script. Set the devices on line 11 and 12. Requires Homebrew to be installed in the usual directory.
#! /bin/bash
# Author: James W Mann (jwmann)
# Dependencies: homebrew, SwitchAudioSource (https://github.com/deweller/switchaudio-osx)
# Notes: If SwitchAudioSource, the script will install it automatically
# See all audio devices: $> SwitchAudioSource -a
# Manually switch with: $> SwitchAudioSource -s device_name
toggle_audio() {
brew=/usr/local/bin/brew
if [ -f $brew ]; then
@jwmann
jwmann / macos-init.sh
Last active January 21, 2023 03:11
Initialize & Install MacOS Dev Tools and Apps
#!/usr/bin/env sh
#
# Initialize & Install MacOS Dev Tools with Default Homebrew / Casks
# To execute: save and `chmod +x ./macos-init.sh` then `./macos-init.sh`
#
# MacVim Requires the entirety of XCode to install, so install XCode before.
# Then Run `sudo xcode-select -s /Applications/Xcode.app/Contents/Developer` to use those command-line tools.
# Modern Homebrew should be installing XCode commandline tools on its own if it's missing
# If it doesn't, `xcode-select --install` should install it.
#
@jwmann
jwmann / idleSleepDisplay.sh
Last active March 5, 2016 03:27
Sleep the Display if the user has been Idle for 30 minutes or more. Required: OS X 10.9+
#!/bin/sh
###########################################
##
## Name: idleSleepDisplay.sh
##
## Description: Sleep Display if Idle
## Author: James W Mann <me@jameswmann.com>
##
## Notes: Minimum Idle time is set for 30 minutes ( 1800 seconds ) by default.
@jwmann
jwmann / AddiTunesTrashFromVLC.scpt
Last active March 7, 2016 21:23
Select a song from VLC and run this Applescript to Add a song to iTunes, Trash it from its original location, and then removing it from the VLC Playlist. It has only been tested for a single song selection but can accomodate playlists of any size.
global songAdded
global songDeleted
global selectedSong
global safetyCheck
# This variable is used as a boolean to see if a file has been added to iTunes or not
set songAdded to false
# This variable is used as a boolean to see if a file has been deleted or not
set songDeleted to false
# This variable is used to store the alias location of the song to be deleted / added
@jwmann
jwmann / AddiTunesFromVLC.scpt
Created March 3, 2016 20:13
This is an AppleScript to allow the ability to select a song from a VLC playlist and Add the song to your iTunes Library.
global songAdded
global selectedSong
# This variable is used as a boolean to see if a file has been added to iTunes or not
set songAdded to false
# This variable is used to store the alias location of the song to be deleted / added
set selectedSong to false
getSong()
addSong(selectedSong)
@jwmann
jwmann / TrashSongFromVLC.scpt
Last active January 20, 2018 03:06
This is an AppleScript to allow the ability to select a song from a VLC playlist and Trash the song from your Disk and Remove it from the Playlist. It has only been tested for a single song selection but can accomodate playlists of any size.
global songDeleted
global selectedSong
global safetyCheck
# This variable is used as a boolean to see if a file has been deleted or not
set songDeleted to false
# This variable is used to store the alias location of the song to be deleted / added
set selectedSong to false
# This variable is used to track whether we've attempted a safe workaround to deleting a current song
set safetyCheck to false