Skip to content

Instantly share code, notes, and snippets.

def readable_time(seconds):
"""Converts a number of seconds to a human-readable time in seconds, minutes, and hours."""
parts = []
if seconds >= 86400: # 1 day
days = seconds // 86400
if days == 1:
parts.append("{} day".format(int(days)))
else:
parts.append("{} days".format(int(days)))
#!/usr/local/autopkg/python
import os
import plistlib
from glob import glob
from Foundation import CFPreferencesCopyAppValue
# Input keys we don't care about comparing.
EXCLUDED_KEYS = (
@homebysix
homebysix / url_mover.py
Created January 4, 2021 02:11
URLMover
#!/usr/local/autopkg/python
# encoding: utf-8
# URLMover
# Copyright 2019-2021 Elliot Jordan
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
@homebysix
homebysix / GlobalProtectService keychain item removal.sh
Created November 16, 2020 19:45
GlobalProtectService keychain item removal.sh
#!/bin/bash
# Remove GlobalProtectService keychain item from all users' login keychains.
USER_LIST=$(/usr/bin/dscl . -list /Users UniqueID | awk '$2 > 500 {print $1}')
for THIS_USER in $USER_LIST; do
USER_HOME=$(/usr/bin/dscl . -read "/Users/$THIS_USER" NFSHomeDirectory | awk '{print $2}')
USER_KEYCHAIN="$USER_HOME/Library/Keychains/login.keychain-db"
if [[ -f "$USER_KEYCHAIN" ]]; then
if /usr/bin/security find-generic-password -s "GlobalProtectService" "$USER_KEYCHAIN" &>/dev/null; then
/usr/bin/security delete-generic-password -s "GlobalProtectService" "$USER_KEYCHAIN" &>/dev/null
echo "Deleted GlobalProtectService item from $THIS_USER login keychain."
@homebysix
homebysix / Eligible for AppPkgCreator.txt
Created February 5, 2020 15:33
Eligible for AppPkgCreator
Recipe ./aanklewicz-recipes/GameSalad/GameSalad.pkg.recipe is eligible for AppPkgCreator.
Recipe ./arubdesu-recipes/CharlesProxy/CharlesProxy.pkg.recipe is eligible for AppPkgCreator.
Recipe ./arubdesu-recipes/ClipMenu/ClipMenu.pkg.recipe is eligible for AppPkgCreator.
Recipe ./arubdesu-recipes/Google PythonAppEngineSDK/GoogleAppEngineLauncher.pkg.recipe is eligible for AppPkgCreator.
Recipe ./arubdesu-recipes/Isolator/Isolator.pkg.recipe is eligible for AppPkgCreator.
Recipe ./arubdesu-recipes/Pacifist/Pacifist.pkg.recipe is eligible for AppPkgCreator.
Recipe ./arubdesu-recipes/Reflector/Reflector.pkg.recipe is eligible for AppPkgCreator.
Recipe ./arubdesu-recipes/Sonos/Sonos.pkg.recipe is eligible for AppPkgCreator.
Recipe ./arubdesu-recipes/Synergy/Synergy.pkg.recipe is eligible for AppPkgCreator.
Recipe ./bochoven-recipes/JASP/JASP.pkg.recipe is eligible for AppPkgCreator.
@homebysix
homebysix / 2020-02-04 autopkg dupe recipe filenames.txt
Created February 4, 2020 18:00
AutoPkg duplicate recipes cleanup
adobeflashplayer.download
First commit 2013-08-25 20:54:44 -0700 for ./recipes/AdobeFlashPlayer/AdobeFlashPlayer.download.recipe
First commit 2015-01-18 22:52:12 +0000 for ./vmule-recipes/AdobeFlashPlayer/AdobeFlashPlayer.download.recipe
affinityphoto.download
First commit 2019-09-02 11:58:37 +0200 for ./peterkelm-recipes/Serif/AffinityPhoto.download.recipe
First commit 2019-09-05 16:45:32 +0200 for ./faumac-recipes/Affinity Photo/Affinity Photo.download.recipe
affinitypublisher.download
First commit 2019-09-05 16:45:32 +0200 for ./faumac-recipes/Affinity Publisher/Affinity Publisher.download.recipe
@homebysix
homebysix / convert_autopkg_recipes_to_yaml.py
Last active January 30, 2020 17:38
convert_autopkg_recipes_to_yaml.py
#!/usr/bin/python
import plistlib
from collections import OrderedDict
from glob import glob
import yaml
def represent_ordereddict(dumper, data):
value = []
@homebysix
homebysix / PkgCreator_to_AppPkgCreator.py
Last active July 5, 2021 00:42
Convert AutoPkg recipes to AppPkgCreator
#!/usr/local/autopkg/python
# encoding: utf-8
# PkgCreator to AppPkgCreator
# Copyright 2019-2021 Elliot Jordan
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
@homebysix
homebysix / .gitlab-ci.yml
Last active January 25, 2019 19:19
MunkiPkg linting
variables:
TZ: America/Los_Angeles
munkipkg_linting:
script: python munkipkg_linting.py
@homebysix
homebysix / delete_jamf_remote_policies.py
Last active December 20, 2023 18:51
delete_jamf_remote_policies.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""This script leverages the jamf-pro-sdk module to remove policies left over
from usage of the deprecated Jamf Remote app.
"""
import re
from jamf_pro_sdk import JamfProClient, PromptForCredentials