Skip to content

Instantly share code, notes, and snippets.

@rmanly
rmanly / qmaster_prefs-imac.sh
Created September 24, 2015 15:02
old qmaster setup - DEPRECATED
#!/bin/bash
name=$(scutil --get ComputerName)
qmasterprefs -stopSharing
qmasterprefs -allowBonjourDiscovery on
qmasterprefs -cluster off autorestart off servername "${name}" quickclusterservername "${name} Cluster" maxactivetargets 40 maxactivesegments 400 storagepath "/var/spool/qmaster" privatestorage off publishedstorage on storagecleanupthreshold 7 unmanagedservices on unmanagedmulticapturethreshold 0 networkinterface en0 log 3 truncate on
@rmanly
rmanly / rm_com.apple.quarantine.bash
Created September 24, 2015 14:58
remove quarantine attribute from things in /Applications
#!/bin/bash
while read -r -d $'\0' item; do
/usr/bin/xattr -s -d com.apple.quarantine "${item}"
done < <(/usr/bin/find /Applications -xattrname com.apple.quarantine -print0)
@rmanly
rmanly / flv_extension.bash
Created September 24, 2015 14:48
add flv extensions to files in a browser cache
#!/bin/bash
# put extensions on Flash vids in browser caches
for item in ./*; do
if $(file $item | grep -q Flash); then
mv $item $item.flv
fi
done
#!/bin/bash
[ -z "$1" ] && echo "This script requires a path to output the app icons in PNG format."
# Use /usr/bin/sips to copy the app icon out of the App bundle for each of the Adobe CC products
# and convert into png format
# Acrobat Pro 11
APP="/Applications/Adobe Acrobat DC/Adobe Acrobat.app"
APP_ICON="ACP_App.icns"
@rmanly
rmanly / uuid_notes.py
Last active August 29, 2015 14:26
first attempt at getting UUIDs in python
>>> import Foundation as F
>>> foo = F.NSUUID.UUID()
>>> print foo
<__NSConcreteUUID 0x7f9a78df73b0> 19AE1973-8C5C-40D7-BBE4-073F6EA3B0D5
>>> foo[-1]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: '__NSConcreteUUID' object does not support indexing
@rmanly
rmanly / remove_preferred_ssids.bash
Last active August 29, 2015 14:17
removes unwanted SSIDs from the preferred list in OS X.
#!/bin/bash
bad_ssids=(GBHSD-Guest GBHSD D225-Guest glenbrook)
port=$(/usr/sbin/networksetup -listallhardwareports | awk '/Ethernet/{flag=0}flag {print $2};/Airport|Wi-Fi/{flag=1}')
# stole this sweet function from patrik's answer here
# http://stackoverflow.com/questions/3685970/check-if-an-array-contains-a-value
contains_element () {
local e
for e in "${@:2}"; do [[ "$e" == "$1" ]] && return 0; done
@rmanly
rmanly / globbed_luggage_packing
Last active August 29, 2015 14:17
pack multiple files of a certain type using some make features not seen in a lot of luggage files
USE_PKGBUILD=1
include /usr/local/share/luggage/luggage.make
TITLE=icc_profiles
PACKAGE_VERSION=3.0
REVERSE_DOMAIN=org.glenbrook225.S607
profiles=$(wildcard *.icc)
PAYLOAD=$(foreach profile,$(profiles),pack-Library-ColorSync-Profiles-$(profile))
@rmanly
rmanly / download_file_via_munkilib.py
Last active August 29, 2015 14:15
uses munkilib's fetch to dl a file via gurl via NSURL
import sys
sys.path.append('/usr/local/munki/munkilib')
import fetch
fetch.get_url('http://www.irs.gov/pub/irs-prior/f1040ez--2014.pdf', '/Users/ryan/Desktop/1040ez.pdf')
fetch.get_url('https://www.gnu.org/software/wget/index.html', '/Users/ryan/Desktop/index.html')
@rmanly
rmanly / Makefile
Last active August 29, 2015 14:14
add to exception.sites via outset
USE_PKGBUILD=1
include /usr/local/share/luggage/luggage.make
TITLE=java_exceptions_A110
PACKAGE_VERSION=1.2
REVERSE_DOMAIN=org.glenbrook225.outset
PAYLOAD=pack-usr-local-outset-login-every-exception_sites.py
@rmanly
rmanly / unshare_all_printers.bash
Last active June 18, 2018 05:42
disables sharing on all printers.
#!/bin/bash
while read -r _ _ printer _; do
/usr/sbin/lpadmin -p "${printer/:}" -o printer-is-shared=false
done < <(/usr/bin/lpstat -v)