This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
comp_name=$(scutil --get ComputerName) | |
if [[ "$comp_name" = *[![:ascii:]]* ]]; then | |
echo "Error: Computer name contains non-ASCII characters. Please modify with the command \`scutil --set ComputerName <value>\` before running this script" | |
exit 1 | |
else | |
host_name=$(echo "$comp_name" | sed -e "s/'//g;s/ /-/g;s/\///g" | awk '{print tolower($0)}') | |
echo "Changing hostname and Bonjour name to $host_name ..." | |
scutil --set LocalHostName "$host_name" | |
scutil --set HostName "$host_name" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sh -c 'echo "===> Launch Daemons <==="; sudo launchctl list | sed 1d | awk '"'"'!/0x|com.apple/{print $3}'"'"' | grep -Ev '"'"'(cups|ntp|ssh|cron)'"'"'; \ | |
echo "\n===> Launch Agents <==="; launchctl list | sed 1d | awk '"'"'!/0x|com.apple/{print $3}'"'"'; \ | |
echo "\n===> Kernel Extensions <==="; kextstat -kl | awk '"'"'!/com.apple/{print $6}'"'"'; \ | |
[ -f $HOME/Li*/Preferences/com.apple.loginitems.plist ] && { echo "\n===> Login Items <==="; /usr/libexec/PlistBuddy -c "Print :SessionItems:CustomListItems" $HOME/Library/Preferences/com.apple.loginitems.plist | awk -F'"'"'= '"'"' '"'"'/Name/{print $NF}'"'"'; }; \ | |
echo "\n===> Privileged Helper Tools <==="; ls -1A /Li*/PrivilegedHelperTools; \ | |
echo "\n===> PreferencePanes <==="; ls -1A /Li*/PreferencePanes; \ | |
echo "\n===> Internet Plug-Ins <==="; ls -1A /Li*/Internet\ Plug-Ins | grep -v Disabled; \ | |
echo "\n===> Total Loaded Fonts <==="; echo $(( $(wc -l <<< "$(ls -1A /Li*/Fonts)" | tr -d '"'"' '"'"') + $(wc -l <<< "$(ls -1A $HOME/Li*/Fonts)" | tr -d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_progressBar() { | |
local pid="$1" | |
if ps -p "$pid" &>/dev/null; then | |
loop='▁▃▄▅▆▇█' | |
while kill -0 "$pid" &>/dev/null; do | |
printf "%b\r" "${loop:$((RANDOM%${#loop})):1}${loop:$((RANDOM%${#loop})):1}${loop:$((RANDOM%${#loop})):1}" | |
sleep 0.1 | |
done | |
fi | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set subShell1 to "(your_command1)" | |
set subShell2 to "(your_command2)" | |
set yourScript to subShell1 & " & " & subShell2 | |
do shell script yourScript |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
setlocal enableextensions | |
for /F "usebackq" %%x in (`hostname`) do ( | |
set COMPUTERNAME=%%x | |
) | |
msiexec /i <Path>\AppleApplicationSupport.msi /q /norestart && | |
msiexec /i <Path>\AppleApplicationSupport64.msi /q /norestart && | |
msiexec /i <Path>\AppleMobileDeviceSupport6464.msi /q /norestart && |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yourcommand && history -d $((HISTCMD-1)) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find /Applications -name *.app -maxdepth 2 -exec \ | |
bash -c '[[ ! $(defaults read "{}"/Contents/Info.plist CFBundleIdentifier) =~ "com.apple" ]] \ | |
&& echo "$(basename "{}" | sed 's/.app.*//')-$(defaults read "{}"/Contents/Info.plist CFBundleShortVersionString)"' \; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# geoff repoli | |
# customize this variable with relatively unique + identifiable string that matches the process(es) | |
# you want to terminate. not case-sensitive. for example: | |
# for all microsoft applications + background services: application="microsoft" | |
# for microsoft outlook: application="outlook" OR application="microsoft outlook" | |
application="your string goes here" | |
# get pids of any running microsoft processes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
getUserInput() | |
{ | |
launchctl asuser $(stat -f %u /dev/console) osascript <<-APPLESCRIPT | |
tell app "System Events" | |
text returned of (display dialog "$1" default answer "" buttons {"OK"} default button 1) | |
end tell | |
APPLESCRIPT | |
} | |
var=$(getUserInput "type string:") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
parse_array() { | |
FS=':' | |
key=(); val=() | |
for (( i=0 ; i < $(eval echo \${#$1[@]}) ; i++ )); do | |
key+=( "$(eval echo \${$1[$i]} | awk -F${FS} '{print $1}')" ) | |
val+=( "$(eval echo \${$1[$i]} | awk -F${FS} '{print $2}')" ) | |
done | |
} | |
# Assuming script contains myarray=( "key1:value1" "key2:value2" ) | |
parse_array myarray |
OlderNewer