Skip to content

Instantly share code, notes, and snippets.

View n8felton's full-sized avatar
🍎

Nate Felton n8felton

🍎
View GitHub Profile
@n8felton
n8felton / 0_reuse_code.js
Created January 4, 2017 15:12
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@n8felton
n8felton / autodmg_rss.py
Created October 27, 2016 03:48
My current progress of an attempt of updating autodmg-rss.py for https://github.com/MagerValp/AutoDMGUpdateProfiles
#!/usr/bin/env python
# _*_ coding:utf-8 _*_
"""Helper tool to generate AutoDMG profiles."""
import xml.etree.ElementTree as ET
import sys
import re
import argparse
import urllib2
import plistlib
@n8felton
n8felton / macOS_snippets.sh
Last active January 4, 2017 15:21
macOS Command Snippets
# Retrieve the Serial Number
ioreg -c IOPlatformExpertDevice -d 2 | awk -F\" '/IOPlatformSerialNumber/{print $(NF-1)}'
# Retrieve the Hardware UUID
ioreg -c IOPlatformExpertDevice -d 2 | awk -F\" '/IOPlatformUUID/{print $(NF-1)}'
# Retrieve the Model Identifier, e.g. iMac16,1; Macmini7,1' VMware7,1
sysctl -n hw.model
# Convert macOS SMB path to UNC path
@n8felton
n8felton / sshd_config
Created August 8, 2016 19:20
Default OS X 10.11.6 sshd_config
# $OpenBSD: sshd_config,v 1.95 2015/04/27 21:42:48 djm Exp $
# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.
# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin
# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options override the
_logger () {
echo "$(basename $0): ${1}"
# -i Log the process id of the logger process with each line.
# -t [tag] Mark every line in the log with the specified tag.
logger -i -t "$(basename $0) " "${1}"
}
# Turn off file globbing so we can pass asterisks as parameters
set -f
# Sets BASH to exit immediately if any command has a non-zero exit status.
@n8felton
n8felton / com.example.wireless_wpa2.mobileconfig
Created July 12, 2016 03:36
Example profile to use machine certificates to authenticate to WPA2-Ent
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadIdentifier</key>
<string>com.example</string>
<key>PayloadRemovalDisallowed</key>
<false/>
<key>PayloadScope</key>
<string>System</string>
@n8felton
n8felton / system.preferences.printing_allow_staff.sh
Last active July 6, 2016 01:55
Change system.preferences.printing authorization policy right to allow `staff` group
#!/bin/bash
# Read the current policy and save to a plist
/usr/bin/security \
authorizationdb \
read \
system.preferences.printing > "${TMPDIR}/system.preferences.printing.plist"
# Show the current policy saved to the plist
cat "${TMPDIR}/system.preferences.printing.plist" \
@n8felton
n8felton / system.preferences.printing.plist
Created July 6, 2016 01:39
Default system.preferences.printing authorization policy
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>allow-root</key>
<true/>
<key>authenticate-user</key>
<true/>
<key>class</key>
<string>user</string>
@n8felton
n8felton / printing_allow_staff.sh
Created July 5, 2016 04:15
Allow `staff` to manage printers.
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root."
exit 1
fi
GROUP="staff"
preferences=(
"system.preferences" \
"system.preferences.printing" \
@n8felton
n8felton / lpadmin_vs_lpadmin.txt
Created July 4, 2016 21:54
_lpadmin vs lpadmin
$ dscl . -read /Groups/_lpadmin
AppleMetaNodeLocation: /Local/Default
GeneratedUID: ABCDEFAB-CDEF-ABCD-EFAB-CDEF00000062
GroupMembership: itsadmin
NestedGroups: ABCDEFAB-CDEF-ABCD-EFAB-CDEF00000050
Password: *
PrimaryGroupID: 98
RealName:
Print Administrators
RecordName: