Skip to content

Instantly share code, notes, and snippets.

chilcote / checkLoginItems.swift
Created Jun 23, 2022
Use this to list out all the launchd plists in LaunchDaemons and LaunchAgents, and report the SMAppService.statusForLegacyPlist status.
View checkLoginItems.swift
import Foundation
import ServiceManagement
func printStatus(plistPath: String) -> String {
let plistURL = URL(fileURLWithPath: plistPath)
let status = SMAppService.statusForLegacyPlist(at: plistURL)
switch status {
case .notRegistered:
return plistPath + " is not registered"
View gist:a00af7516d7a96c3aef927e94a35e840
import sys, datetime, time, subprocess
def apple_year_offset(dateobj, years=0):
# Convert to a maleable format
mod_time = dateobj.timetuple()
# Offset year by number of years
mod_time = time.struct_time(tuple([mod_time[0]+years]) + mod_time[1:])
# Convert back to a datetime obj
return datetime.datetime.fromtimestamp(int(time.mktime(mod_time)))
View gist:6dfcc86398a4fbf63155bff56b02fbab
until [[ -d "/Volumes/Deploy Studio Test" ]]; do
sleep 5
cp -r "/Volumes/Deploy Studio Test/Deploy/Workflows/High Sierra Install/Macintosh HD/copy" "~/Desktop"
Display CPU usage for a given process
emoji ref:
import subprocess
import time
import argparse
View gist:fb670103b8e90aaea67dee0ffc6cc983
import sys, os
import urllib, urllib2
import base64
import json
import requests
import xml.etree.ElementTree as ET
def requests_xml(jss_user, jss_pass, jss_url, category):
chilcote /
Last active Apr 17, 2018
Download MacSysAdmin2016 videos
#!/usr/bin/env python
download macsysadmin videos
pip install requests
pip install beautifulsoup4
chilcote / check-10.12-sierra-compatibility
Created Sep 10, 2016
Check 10.12 Sierra Compatibility EA
View check-10.12-sierra-compatibility
#!/usr/bin/env python
# encoding: utf-8
# ================================================================================
# This script checks if the current system is compatible with macOS 10.12 Sierra.
# These checks are based on the installCheckScript and volCheckScript in
# distribution file of OSInstall.mpkg installer package. The OSInstall.mpkg can be
# found in the root of InstallESD disk image.
View macos-netboot.json
"output_name": "macos-netboot",
"bridged": true,
"netboot": true,
"netboot_hdsize": 60,
"netboot_osvers": "10.12"
chilcote / gist:6649e2867e1a547f4a06
Created Oct 11, 2015
Get primary interface name and IP
View gist:6649e2867e1a547f4a06
from SystemConfiguration import SCDynamicStoreCreate, SCDynamicStoreCopyValue
net_config = SCDynamicStoreCreate(None, "net", None, None)
def get_primaryinterface():
states = SCDynamicStoreCopyValue(net_config, "State:/Network/Global/IPv4")
return states['PrimaryInterface']
View gist:56632c776efcf4b98c2d
#!/usr/bin/env python
# I got the meat of this script from somewhere but I can't remember where...
# if it was yours, let me know and I'll give credit.
download macsysadmin videos