Skip to content

Instantly share code, notes, and snippets.

View acodega's full-sized avatar

Adam Codega acodega

View GitHub Profile
Get all feature options
lpoptions -p [printer] -l
Install a printer using generic driver
Install a printer
lpadmin -p "HP-576dw-3-S" -D "HP X576dw (3 South)" -E -v lpd://192.168.60.53 -P "/Library/Printers/PPDs/Contents/Resources/HP Officejet Pro X476-X576 MFP.gz" -o printer-is-shared=false
Make a printer default (use the name from -p)
lpoptions -d New_Printer_PPD
There's a way you can see what the naughty kernel_task is up to.
/Applications/Utilities/Activity Monitor.app
View -> All Processes
Select the `kernel_task` process in the list
<gear menu> Spindump
So if it says something like `45 samples (187-231)` you know that bit was short lived - but if it says `1000 samples (1-1000)` - either it was blocked during the 10 second run, or it might be a culprit chewing away at your machine
Long number of samples + high `cpu time` value for the thread = indicator it put a lot of load on your machine
#!/bin/bash
# run elevated (with sudo)
rm -f /.metadata_never_index
mdutil -i off /
rm -rf /.Spotlight*
mdutil -i on /
mdutil -E /
exit 0
#!/bin/sh
myIP=`curl -L -s --max-time 10 http://checkip.dyndns.org | egrep -o -m 1 '([[:digit:]]{1,3}\.){3}[[:digit:]]{1,3}'`
myLocationInfo=`curl -L -s --max-time 10 http://freegeoip.net/xml/$myIP`
myCountryCode=`echo $myLocationInfo|egrep -o '<CountryCode>.*</CountryCode>'| sed -e 's/^.*<CountryCode/<CountryCode/' | cut -f2 -d'>'| cut -f1 -d'<'`
myCity=`echo $myLocationInfo|egrep -o '<City>.*</City>'| sed -e 's/^.*<City/<City/' | cut -f2 -d'>'| cut -f1 -d'<'`
myRegionName=`echo $myLocationInfo|egrep -o '<RegionName>.*</RegionName>'| sed -e 's/^.*<RegionName/<RegionName/' | cut -f2 -d'>'| cut -f1 -d'<'`
echo "<result>$myCity, $myRegionName - $myCountryCode</result>"
/usr/sbin/softwareupdate --reset-ignored
/bin/rm -rf /Library/Preferences/com.apple.SoftwareUpdate.plist
/usr/bin/killall cfprefsd
Get-MailboxFolderStatistics bryanh -FolderScope Inbox | Select-Object Name, ItemsInFolderAndSubfolders
@acodega
acodega / Setting Mac hostnames
Last active March 22, 2019 13:33
Setting Mac hostnames
echo "Enter new name:"
read newmacname
sudo scutil --set ComputerName "$newmacname"
sudo scutil --set HostName "$newmacname"
sudo scutil --set LocalHostName "$newmacname"
@acodega
acodega / UMAD Identifier
Created October 11, 2018 03:52
Find your ProfileIdentifier to configure UMAD
profiles -C -o stdout-xml | grep -A 1 ProfileIdentifier
@acodega
acodega / macOS Recovery Mode in VMware Fusion
Created October 12, 2018 18:53
macOS Recovery Mode in VMware Fusion
1) Choose Power on to Firmware from the Virtual Machine menu
2) then Enter Setup
3) Boot from a file
4) Arrow down to Recovery HD
5) Hit enter until you can pick boot.efi
6) select boot.efi
7) hit enter
# Run in Terminal, no restart required.
sudo sysctl debug.lowpri_throttle_enabled=0
# Reverted at restart.