Skip to content

Instantly share code, notes, and snippets.

View bryanheinz's full-sized avatar

bryan heinz bryanheinz

View GitHub Profile
@bryanheinz
bryanheinz / 1p_postinstall.sh
Created October 13, 2021 20:02
pre and post-install scripts for 1Password; and their respective pkginfo.
#!/bin/sh
# get the console user, root if it's at the login window
theUser=$(/usr/bin/stat -f "%Su" /dev/console)
# check for and exit if root
[[ $theUser == "root" ]] && exit 0
# should be a logged in user, reopen 1Password
/usr/bin/su - $theUser -c "open -b com.agilebits.onepassword7"
#
# get all .mobileconfig profiles and add them to SimpleMDM as custom profiles
# using Lucas' fork of simpleMDMpy https://github.com/lucasjhall/simpleMDMpy
# dropped the SimpleMDMpy folder into /usr/local/lib/python3.9/site-packages/ (or whatever your Python 3 path is)
#
api_key = ''
mdm_dir = pathlib.Path('/Users/bryanh/Documents/dev/profiles/mdm/')
tcc_dir = mdm_dir / 'tcc'
@bryanheinz
bryanheinz / get_console_user.py
Last active August 21, 2020 13:53
Get's the current logged in user in macOS using Python.
#!/usr/local/bin/python3
import subprocess
def termy(cmd):
task = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = task.communicate()
return(out.decode('utf-8'), err)
user, err = termy(
['/usr/bin/stat', '-f', '"%Su"', '/dev/console']
@bryanheinz
bryanheinz / munki_eadir_patch.py
Created May 12, 2020 00:14
patches Munki's makecatalogs
#!/usr/bin/python3
# this script patches Munki's makecatalogslib.py file to skip over any files or
# folders containing @eaDir. if you're hosting your munki repo on a Synology,
# then you've likely seen the ton of noisy error output makecatalogs generates
# due to these @eaDir files. this patch skips those files thus silencing those errors.
import os
import shutil
import getpass
javascript:void(open('https://feedbin.me?subscribe='+location.href, 'FeedBin','toolbar=no,scrollbars=yes,width=750,height=700'));
"""
This script is used to check the status of character creation on specific worlds in Final Fantasy XIV.
To get a push notification you'll need to use Pushover (https://pushover.net) and include your user
and application keys.
You'll also want to update the world_name variable with the world you'd like to watch.
This script scrapes https://na.finalfantasyxiv.com/lodestone/worldstatus/ which is where you can find
the world names.
"""
import json
import requests
#!/usr/bin/python
# https://docs.gitlab.com/ee/api/README.html
import requests
from sys import argv
from pprint import pprint
switches = argv
private_token = "" # gitlab private token
base_url = ""

Keybase proof

I hereby claim:

  • I am bryanheinz on github.
  • I am bryanheinz (https://keybase.io/bryanheinz) on keybase.
  • I have a public key ASAyQNKuRBtINNYJ_acZe7pbsbNU59NNxMZD0-44gicaoAo

To claim this, I am signing this object:

@bryanheinz
bryanheinz / doNotUpdateSpotify.sh
Created June 14, 2018 18:39 — forked from AllanLRH/doNotUpdateSpotify.sh
Disable Spotify autoupdate on Mac OS X (testet on Yosemite).
# This script prevents Spotifys Autoupdating on OS X (testet on Yosemite)
# Based on this tutorial:
# http://supraliminal.net/blog/2013/4/21/how-to-revert-back-to-the-older-better-spotify-client
#
# This script must be run as root:
# sudo sh doNotUpdateSpotify.sh
#
FILE="/tmp/out.$$"
if [ "$(id -u)" != "0" ]; then
@bryanheinz
bryanheinz / csb_status_reset.sh
Last active May 1, 2018 22:17
Resets Synology Cloud Station Backup client backup status.
#!/bin/bash
if [ $(sw_vers -productVersion | awk -F. '{print $2}') -lt "11" ]; then
echo "This script only works on macOS 10.11 or newer."
exit
fi
# get user
theUser=$(/usr/bin/stat -f "%Su" /dev/console)