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 / fixMultipleRecoveryHDs.sh
Created July 11, 2014 13:16
(OS X) Merges multiple Recovery HDs back into Macintosh HD (JAMF Casper Suite Defect D-007146)
#!/bin/bash
# Jacob Salmela
# 2014-07-11
# Fix multiple Recovery HDs created by Casper Imaging from Defect D-007146
# Get last extra Recovery HD by parsing out the bootable Recovery HD, leaving only the extra partitions
lastExtraRecovery=$(diskutil list | awk "/Recovery HD/" | grep -v "Apple_Boot" | awk '{print $7}' | tail -n1)
# Get Macintosh disk ID
systemVolume=$(diskutil list | awk "/Macintosh HD/" | grep -v "Apple_Boot" | awk '{print $7}')
@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 / 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 / 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 / ryo-say-command.sh
Created August 12, 2014 12:24
(Linux) Roll-your-own say command
#!/bin/bash
#----------AUTHOR------------
# Jacob Salmela
# 12 August 2013
# https://github.com/jakesalmela/
#---------DESCRIPTION--------
# Say command for Linux
# Save as /usr/bin/say
@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 / speak-copy-serial.sh
Created August 12, 2014 12:27
(OS X) Speak and copy the serial number
#!/bin/bash
#----------AUTHOR------------
# Jacob Salmela
# 3 December 2013
#----------RESOURCES---------
# http://stackoverflow.com/questions/12230762/insert-characters-into-a-string-in-bash
#---------DESCRIPTION--------
# Copies the computers serial number into the clipboard and then speaks it aloud so you can write it down
@jacobsalmela
jacobsalmela / ssh-histmon.sh
Created August 12, 2014 12:47
Real-time SSH history monitor
#!/bin/bash
#----------AUTHOR------------
# Jacob Salmela
# 15 November 2013
# https://github.com/jakesalmela/
#----------RESOURCES---------
# http://askubuntu.com/questions/80371/bash-history-handling-with-multiple-terminals
# http://www.csgnetwork.com/epochtime.html
@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 / save-app-store-pkgs.sh
Created August 12, 2014 12:53
(OS X) Save Mac App Store downloads as .pkgs
#!/bin/bash
# Jacob Salmela
# 2014-06-01
#-------DESCRIPTION-----------
# smasp - Save Mac App Store Packages
#---------USAGE---------------
# Pause each app or update that you want to save a package for
# Run this script