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 / .profile
Last active September 18, 2016 21:25
Bash Functions for quickly setting the appropriate user for the git repo
# GIT USER PROFILE SETTING / SWITCHING
# This will strip the current static User from the current repo and Include an external User profile.
# This function relies on: Git, A Git Repo, a config file located in ~/config/git/profilename.user.config
# Format must be profilename.user.config
# Usage: gituser home => ~/config/git/home.user.config
# Usage: gituser "Work GitHub" => ~/config/git/Work Github.user.config
gituser() {
# Sanity check
if [ -z "$(which git)" ]
then
@jwmann
jwmann / ToggleOutputDevice.scpt
Created March 3, 2016 02:03
This is an AppleScript to toggle between 2 Sound Output Devices. Set your own Devices to toggle on lines 32 and 33
# Tell our specifc panel options to wake up.
tell application "System Preferences"
reveal anchor "output" of pane id "com.apple.preference.sound"
end tell
# Save our Current Output Device as well as a List of Available Output Devices.
tell application "System Events"
tell process "System Preferences"
tell window "Sound"
tell tab group 1
@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
@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 / 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 / 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 <[email protected]>
##
## Notes: Minimum Idle time is set for 30 minutes ( 1800 seconds ) by default.
@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 / 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 / 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 / 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==