Skip to content

Instantly share code, notes, and snippets.

View jacobsalmela's full-sized avatar
:octocat:
To all that makes us unique

Jacob Salmela jacobsalmela

:octocat:
To all that makes us unique
View GitHub Profile
@jacobsalmela
jacobsalmela / bookmark-safari.sh
Last active August 20, 2022 13:57
Bookmark the current site
# Open real test site
killall Safari > /dev/null
osascript -e 'tell application "Safari"
activate
set the URL of the front document to "http://selfregister.testnav.com"
end tell'
sleep 10
# Bookmark site
@jacobsalmela
jacobsalmela / login-to-gui.sh
Last active August 20, 2022 13:57
Logs in a user to the GUI after access to assistive devices have been enabled for ARDAgent.app and SystemEvents.app
osascript -e 'tell application "System Events"
keystroke "username"
keystroke tab
keystroke "password"
keystroke return
keystroke return
end tell'
@jacobsalmela
jacobsalmela / timeSaver.sh
Last active August 20, 2022 13:57
(OS X) Enter the password repeatedly for multiple authentication windows
#!/bin/bash
# Change 60 to however many passwords you have to authenticate for
for s in {1..60}
do
sleep 1
# Enter your password below
osascript -e <<EOF 'tell application "System Events"
tell process "SecurityAgent"
set value of text field 1 of window 1 to "password"
end tell
@jacobsalmela
jacobsalmela / fix-paused-printers.sh
Created August 12, 2014 12:48
(OS X) Fix paused printers
#!/bin/bash
#----------AUTHOR------------
# Jacob Salmela
# 7 November 2013
# https://github.com/jakesalmela/
#----------RESOURCES---------
# You need terminal-notifier to be installed
# I used brew install terminal-notifier
# You could also get it at github
@jacobsalmela
jacobsalmela / script-performance-test.sh
Created August 12, 2014 12:26
Script performance test
#!/bin/bash
#----------AUTHOR------------
# Jacob Salmela
# 27 March 2014
# https://github.com/jakesalmela/
#---------DESCRIPTION--------
# Tests the performance of a script
#-----------USAGE------------
@jacobsalmela
jacobsalmela / app-versions-fast-but-not-error-free.sh
Created August 12, 2014 12:23
(OS X) Fast version check of Apps
#!/bin/bash
#----------AUTHOR------------
# Jacob Salmela
# 24 May 2013
#----------RESOURCES---------
# http://stackoverflow.com/questions/4128235/bash-shell-scripting-what-is-the-exact-meaning-of-ifs-n
#---------DESCRIPTION--------
# Attempts to list all apps in /Applications and their version numbers
@jacobsalmela
jacobsalmela / disable-bounjour.sh
Created August 12, 2014 12:21
(OS X) Disable Bonjour but not DNS
#!/bin/bash
# http://support.apple.com/kb/HT3789
# Jacob Salmela
# 2014-05-31
if [[ $(/usr/libexec/PlistBuddy -c Print /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist | grep 'NoMulticast') ]];then
echo "Boinjour is already disabled."
exit 1
else
launchctl unload -w /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist
@jacobsalmela
jacobsalmela / EA-MacintoshHD.sh
Created August 6, 2014 15:42
Extension Attribute to check if the root volume is named Macintosh HD
#!/bin/bash
volumeName=$(diskutil info / | awk '/Volume Name/ {print substr ($0, index ($0,$3))}')
if [ "$volumeName" != "Macintosh HD" ];then
echo "<result>Incorrect</result>"
else
echo "<result>Correct</result>"
fi
@jacobsalmela
jacobsalmela / os-x-login-user-to-gui-via-script.sh
Created June 11, 2014 19:10
(OS X) Enters a user's credentials into the GUI login window fields and logs them in (access to assistive devices needs to be enabled for osascript to work)
osascript -e <<EOF 'tell application "System Events"
tell process "SecurityAgent"
set value of text field 2 of window "Login" to "username"
set value of text field 1 of window "Login" to "password"
end tell
tell application "system events" to keystroke return
tell application "system events" to keystroke return
end tell'
EOF
@jacobsalmela
jacobsalmela / change-users-icon.sh
Last active August 20, 2022 13:56
Changes the /Users folder icon when it is on a separate partition
#!/bin/bash
#An icon file needs to exist in /usr/local/imaging
# Copy the users.icns file to the root of the the Users folder.
# Since it is a volume, if you name the file .VolumeIcon.icns, it will change the icon from the default hard drisk
# This is mostly to help the end users so they feel like it is a folder and not a hard drive
# The icon should also have a small badge to let the tech staff know that it is not a normal folder and that the workflow was successful
cp /usr/local/imaging/users.icns /Users/.VolumeIcon.icns