Skip to content

Instantly share code, notes, and snippets.

View phillymjs's full-sized avatar

Michael Stango phillymjs

  • Philadelphia, PA
  • 00:20 (UTC -04:00)
  • X @PhillyMJS
View GitHub Profile
@phillymjs
phillymjs / Comment_Fixer.scpt
Last active February 2, 2017 17:34
AppleScript to fix issues where comments are missing from PDFs. It quits Acrobat Pro, kills the AdobeResourceSynchronizer process and clears some Acrobat caches, forcing comments to be downloaded fresh from the comment server. It is very polite and ensures users save/close any unsaved/open PDFs before it does its dirty work.
on is_running(appName)
tell application "System Events" to (name of processes) contains appName
end is_running
repeat while is_running("AdobeAcrobat")
try
tell application "Adobe Acrobat Pro"
set unsavedDocs to count of (documents where modified is true)
set openDocs to count of documents
end tell
@phillymjs
phillymjs / Get_My_IP.scpt
Last active March 30, 2017 17:12
Displays a dialog with the active network port and its IP address, or the IP in use by the Cisco AnyConnect VPN client.
try
--Check the Cisco AnyConnect client state
(do shell script "/opt/cisco/anyconnect/bin/vpn state | grep \"state: Connected\"") as string
--If we get here then we're connected, so return the Cisco IP information
set activeNetworkPortName to "Cisco AnyConnect VPN"
set currentIP to do shell script "/opt/cisco/anyconnect/bin/vpn stats | grep \"Client Address (IPv4):\" | awk '{print $4}'"
on error
@phillymjs
phillymjs / Get_Path.scpt
Last active March 30, 2017 17:20
Select a file/folder on a mounted server, then run this script. It will ask you if you need the Mac path, the Windows, path, or both, and then put the path(s) on the clipboard. Updated 7/25/2016 to correctly deal with paths for CIFS connections, instead of treating them as SMB.
global mac_path, win_path
tell application "Finder"
try
set theFilePOSIX to POSIX path of (selection as string)
on error
display dialog "Please select a file on a server volume before running this script." buttons {"OK"} default button "OK" with icon 0 with title "Error - Nothing Selected"
return
end try
set TempTID to AppleScript's text item delimiters

Keybase proof

I hereby claim:

  • I am phillymjs on github.
  • I am phillymjs (https://keybase.io/phillymjs) on keybase.
  • I have a public key ASDRM3S8o3Nk6_ZJPTMkpItmtiErV6m6CavPnr6PUxHPHgo

To claim this, I am signing this object:

@phillymjs
phillymjs / reposado_update_notification.sh
Last active July 31, 2019 20:13
I wrote this script for myself and thought others might find it useful. Run it on your Reposado server, and it will check for current Apple updates that are not assigned to any of your branches. If it finds any, it will send an email notification. If you also use Margarita to provide a web interface, you can have the email include a link to that…
#!/bin/sh
# File locations - Change as needed
list="/tmp/updatelist.txt" # List of updates not in any branches
email="/tmp/updatemail.txt" # Temp file to hold the email message
mailbinary="/usr/sbin/sendmail" # Location of the binary that sends mail
repoutil="/usr/local/reposado/repoutil" # Location of the repoutil binary
# Options for automatically adding new updates to a branch - Change as desired
autoadd=true
@phillymjs
phillymjs / orphan_killer.sh
Last active August 6, 2020 16:24
On macOS machines, this script finds orphaned server mounts in /Volumes and removes them. The presence of orphaned mounts can break links to files in Adobe Creative Suite documents and cause other annoyances. Some people in my environment had dozens of them. If you're having issues like this, run this script regularly with a launchdaemon.
#!/bin/bash
# Find directories in /Volumes with .DS_Store files
# See if each directory with a .DS_Store file is currently mounted
# If it is, skip it. If it's not, it's an orphaned mount, so increment the counter
# Fail on undefined variables, since we're running "rm" commands
set -u
orphanCount=0
@phillymjs
phillymjs / get_nudge_assets.sh
Last active February 19, 2024 19:02
This script will download remote assets for Nudge when needed. See first comment for more information.
#!/bin/bash
set -u
prefFile="com.github.macadmins.Nudge.plist"
tmpFile="/tmp/com.github.macadmins.Nudge.Settings.plist"
remoteAssetBaseURL="https://yourwebserver.com/nudge_assets"
# Assets we need to pull locally
declare -a valueArray=("iconDarkPath" "iconLightPath" "screenShotDarkPath" "screenShotLightPath")