Skip to content

Instantly share code, notes, and snippets.

phillymjs

Block or report user

Report or block phillymjs

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@phillymjs
phillymjs / orphan_killer.sh
Last active Apr 9, 2019
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.
View orphan_killer.sh
#!/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
View keybase.md

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 / Get_My_IP.scpt
Last active Mar 30, 2017
Displays a dialog with the active network port and its IP address, or the IP in use by the Cisco AnyConnect VPN client.
View Get_My_IP.scpt
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 / Comment_Fixer.scpt
Last active Feb 2, 2017
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.
View Comment_Fixer.scpt
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_Path.scpt
Last active Mar 30, 2017
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.
View Get_Path.scpt
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
@phillymjs
phillymjs / Office 2011 First Run Handler
Created Dec 2, 2015
This gets rid of the annoying stuff Office asks you the first time you launch it. It was part of a larger Outlook setup assistant Applescript I wrote. The fullName and splashscreenCompany variables were pulled out of Active Directory elsewhere in the script.
View Office 2011 First Run Handler
on OfficeFirstRunHandler()
-- Take care of the Office first-run stuff so the user isn't asked about it
do shell script "defaults write \"/Users/${USER}/Library/Preferences/com.microsoft.office\" '14\\FirstRun\\SetupComplete' -int 1"
do shell script "defaults write \"/Users/${USER}/Library/Preferences/com.microsoft.autoupdate2\" 'HowToCheck' -string 'Manual'"
do shell script "defaults write \"/Users/${USER}/Library/Preferences/com.microsoft.autoupdate2\" 'LastUpdate' -date '2001-01-01T00:00:00Z'"
do shell script "defaults write \"/Users/${USER}/Library/Preferences/com.microsoft.error_reporting\" 'SQMReportsEnabled' -bool False"
do shell script "defaults write \"/Users/${USER}/Library/Preferences/com.microsoft.error_reporting\" 'ShipAssertEnabled' -bool False"
-- Set the values shown in the Office app splash screens
do shell script "defaults write com.microsoft.office '14\\UserInfo\\UserName' -string '" & fullName & "'"
@phillymjs
phillymjs / reposado_update_notification.sh
Last active Jul 31, 2019
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…
View reposado_update_notification.sh
#!/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
You can’t perform that action at this time.