Skip to content

Instantly share code, notes, and snippets.

View mattghali's full-sized avatar

Matthew Ghali mattghali

View GitHub Profile
@mattghali
mattghali / OSX Automount.md
Last active May 22, 2017 23:26
Prevent OSX from automounting removable volumes

So I spent most of the mornings searching google for how to prevent Mac OSX from automounting removable volumes to no avail. The closest people seem to have come is hard-coding volume UUIDs in fstab; which presents a chicken-and-egg problem: how do you find the volume UUID to blacklist without (inadvertently) mounting it?

The answer is close by in the code to an option another people seem to be searching for frequently - how to get OSX to mount removable volumes at boot time instead of at login. The global preference key AutomountDisksWithoutUserLogin controls it, by setting several other hidden preference keys for diskarbitrationd. See the code here.

The hidden pref keys are at this line:

  • DAMountDeferExternal
  • DAMountDeferInternal
  • DAMountDeferRemovable
  • DAMountTrustExternal
  • `DA
@mattghali
mattghali / virustotal_upload
Created May 20, 2017 20:01 — forked from luca-m/virustotal_upload
Upload a sample to VirusTotal and pretty print the report. All in a handy alias.
#!/usr/bin/env bash
#
# Upload a sample to VirusTotal and pretty print the report.
# All in a handy alias.
#
# Dependencies:
#
# * curl
# * jq
# * VirusTotal API key
@mattghali
mattghali / gist:4b2e1327c9fbeb615cf3
Last active March 24, 2016 11:24
Dump iOS Passbook entries
# dumps all configured ios passbook entries into /tmp/passbook.
# happy dumping! matt ghali - @bizzyunderscore
def f(arg, dirname, files):
passfile = os.path.join(dirname, 'pass.json')
if os.path.exists(passfile):
with open(passfile, 'r') as pf:
j = json.load(pf)
passname = j['passTypeIdentifier']
outfile = os.path.join('/tmp/passbook', passname)
@mattghali
mattghali / gist:00b66ebc6e5b51ca144c
Last active March 24, 2016 09:21
browse osx defaults
# dumps all default domains visible from your user account.
# happy dumping! matt ghali - @bizzyunderscore
rm /tmp/stop
touch /tmp/defaults-read
defaults domains | tr , '\n' | sed 's/^ //' \
| while read pref; do
[ -f /tmp/stop ] && break
grep -q -- "$pref" /tmp/defaults-read || defaults read "$pref" \
| less -P "$pref" ; echo "$pref" >> /tmp/defaults-read