Skip to content

Instantly share code, notes, and snippets.

@akrabat
akrabat / no_automount
Created August 5, 2020 08:51
Add a volume to /etc/fstab to prevent auto-mounting. See http://akrabat.com/prevent-an-external-drive-from-auto-mounting-on-macos/
#!/usr/bin/env bash
# Usage: ./no_automount My\ Disk
NAME=$1
if [ -z "$NAME" ] ; then
echo "Usage: no_automount {Disk Name}"
exit 1
fi
FSTAB=/etc/fstab
@talkingmoose
talkingmoose / Change Jamf Pro Activation Code.sh
Created October 27, 2018 23:13
Programmatic method to change a Jamf Pro server's Activation Code via the Classic API.
#!/bin/bash
# server connection information
URL="https://jss.talkingmoose.net:8443"
userName="JSSAPI-Editor"
password="password"
# XML data to upload
THExml="<activation_code>
<organization_name>Talking Moose Industries</organization_name>
@mohanpedala
mohanpedala / bash_strict_mode.md
Last active June 1, 2024 08:46
set -e, -u, -o, -x pipefail explanation
@erikng
erikng / kextidentifiers.py
Last active April 19, 2021 22:51
kextidentifiers.py
#!/usr/bin/python
# For mojave only
# In order for this to work, you will need to go to System Preferences in Mojave -> Security & Privacy -> Privacy -> Full Disk Access and grant Terminal.app permissions
import sqlite3
conn = sqlite3.connect('/var/db/SystemPolicyConfiguration/KextPolicy')
c = conn.cursor()
query = 'SELECT * FROM kext_policy'
c.execute(query)
sysadminctl is a tool Apple introduced in 10.10 for working with system user accounts. In 10.13,
sysadminctl is Apple's recommended tool for working with user accounts in the CLI, replacing functionality
that has long been provided by dscl and adds new features available only in 10.13.
sysadminctl can be used to change user passwords, create new users (including automatically provisioning
the user home folder) or check the status of a new-to-10.13 security feature named SecureToken.
SecureToken is a user attribute like password type or user home location. SecureToken is not publicly
documented by Apple so it is not possible to provide a full technical description, but in practice one
needs only to know if a user has SecureToken or not. Having SecureToken set signifies that a user can
unlock a FileVault-encrypted volume. Without the SecureToken bit on a user account, that user will not
### Updated to reflect changes introduced with 10.13.4. Update to 10.13.4 if needed before attempting to make
SecureToken-related changes. ###
sysadminctl is a tool Apple introduced in 10.10 for working with system user accounts. In 10.13, sysadminctl is Apple's
recommended tool for working with user accounts in the CLI, replacing functionality that has long been provided by dscl
and adds new features available only in 10.13. sysadminctl can be used to change user passwords, create new users or
check the status of a new-to-10.13 security feature named SecureToken.
SecureToken is a non-visible APFS file system attribute, unlike the SIP protected flag or file creation date, that triggers
the creation of a new AuthenticationAuthority entry in a user's local account record
@michalczukm
michalczukm / Atom_export_settings.md
Last active September 23, 2023 12:32
Atom: Backup all settings

Export:

  1. Copy from ${user}/.atom:
  • config.cson
  • keymap.cson
  • snippets.cson
  • styles.less
  1. Save installed packages list apm list --installed --bare > packages.list
@derhuerst
derhuerst / intro.md
Last active May 13, 2023 17:56
Installing the Z Shell (zsh) on Linux, Mac OS X and Windows

Installing zsh – the easy way

The Z shell (zsh) is a Unix shell [...]. Zsh can be thought of as an extended Bourne shell with a large number of improvements, including some features of bash, ksh, and tcsh.

Z shell – Wikipedia

Read more about ZSH at An Introduction to the Z Shell.

Choose one of the following options.

@phillymjs
phillymjs / reposado_update_notification.sh
Last active July 31, 2019 20:13
I wrote this script for myself and thought others might find it useful. Run it on your Reposado server, and it will check for current Apple updates that are not assigned to any of your branches. If it finds any, it will send an email notification. If you also use Margarita to provide a web interface, you can have the email include a link to that…
#!/bin/sh
# File locations - Change as needed
list="/tmp/updatelist.txt" # List of updates not in any branches
email="/tmp/updatemail.txt" # Temp file to hold the email message
mailbinary="/usr/sbin/sendmail" # Location of the binary that sends mail
repoutil="/usr/local/reposado/repoutil" # Location of the repoutil binary
# Options for automatically adding new updates to a branch - Change as desired
autoadd=true
@zoocoup
zoocoup / Casper Packaging & Deployment
Last active October 8, 2018 20:46
Overview of packaging for Casper
Casper Packaging & Deployment
# This document was made for my coworkers as I was leaving a previous job. The content should
# be applicable in most environments.
# Last Edit 20131008 - jkb | @zoocoup
This document is an overview of packaging applications, plug-ins and files or deployment with Casper.
_Testing the Application_