Skip to content

Instantly share code, notes, and snippets.

@brandonb927
brandonb927 / osx-for-hackers.sh
Last active May 2, 2024 03:13
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx
echo IzzyBoot for Fusion Drives
echo Version 1.0
echo
# Are we already encrypted?
if diskutil cs list | grep "Encrypted Extents" | grep -q "Yes"; then
echo It appears as though this drive is using FileVault2 encryption. This tool is too
echo simple to figure out what to do, but maybe you can use Disk Utility to repartition
echo the drive or remove the encryption first.
echo
@gregneagle
gregneagle / NSPredicateTester.py
Last active June 14, 2023 21:47
NSPredicateTester.py
#!/usr/local/munki/munki-python
import sys
import os
from Foundation import NSDate
from Foundation import NSPredicate
def doComparison(comp_string, obj):
print('Comparison: %s' % comp_string)
#!/usr/bin/python
#
# list_unused_munki_pkgs.py
# Tim Sutton
#
# Simple script to list all Munki pkgs not currently referenced in a specific list
# of catalogs.
# It does not delete anything.
#
# CATALOGS can be modified to a list of catalogs in your repo that should be indexed.
@timsutton
timsutton / autopkg_jenkins_check.py
Last active December 27, 2015 00:19
Basic AutoPkg Jenkins check script in Python.
#!/usr/bin/python
#
# This is a rough Python script that demonstrates running AutoPkg with Jenkins
# as only a "check" action, using the ScriptTrigger plugin. It's assumed
# that AutoPkg is running directly out of a Git checkout from somewhere, but
# this is not necessary.
#
# Also note that the the '-d' option is given to hardcoded recipe
# search directories.
#
@gregneagle
gregneagle / finish_jenkins_autopkg_run.py
Created January 3, 2014 19:00
Some scripts from my MacSysAdmin 2013 demo
#!/usr/bin/env python
# encoding: utf-8
"""
finish_jenkins_autopkg_run.py
Created by Greg Neagle on 2013-08-23.
"""
import os
import plistlib
@bruienne
bruienne / getosversionfromdmg.py
Last active April 16, 2021 05:29
Get OS X version from DMG
#!/usr/bin/python
#
# getosversionfromdmg.py
#
# Copyright (c) 2014 The Regents of the University of Michigan
#
# Retrieves the OS version and build from the InstallESD.dmg contained in
# a typical "Install (Mac) OS X <Name>.app" bundle.
#
# To run:
@groob
groob / README.md
Last active February 27, 2018 22:43
Puppet-Managedmac
@gregneagle
gregneagle / First run
Last active August 29, 2015 14:05
Autopkg .install recipe demo
% ./autopkg run Firefox.install -v
Processing Firefox.install...
MozillaURLProvider
MozillaURLProvider: Found URL http://ftp.mozilla.org/pub/mozilla.org//firefox/releases/latest/mac/en-US/Firefox%2031.0.dmg
URLDownloader
URLDownloader: Storing new Last-Modified header: Thu, 17 Jul 2014 03:38:41 GMT
URLDownloader: Storing new ETag header: "4b25e62-3c17d83-4fe5b607b1240"
URLDownloader: Downloaded /Users/gneagle/Library/AutoPkg/Cache/com.github.autopkg.install.Firefox_EN/downloads/Firefox.dmg
EndOfCheckPhase
AppDmgVersioner
# printers.rb
Facter.add('printers') do
confine :kernel => %w{Linux FreeBSD OpenBSD SunOS Darwin}
confine do
Facter::Core::Execution.which('lpstat')
end
setcode do
output = Array.new