Skip to content

Instantly share code, notes, and snippets.

View fuzzylogiq's full-sized avatar

Ben Goodstein fuzzylogiq

View GitHub Profile
@fuzzylogiq
fuzzylogiq / network_location_discovery.sh
Created August 4, 2014 15:21
Script for setting network location and IP in a mixed static/dhcp environment so that imaging could take place.
#/bin/sh
function tryping {
ping -t 5 x.x.x.x > /dev/null 2>&1
if [ $? == 0 ]; then exit 0; fi
}
rm -rf /Library/Preferences/SystemConfiguration/NetworkInterfaces.plist
rm -rf /Library/Preferences/SystemConfiguration/preferences.*
networksetup -createlocation setup populate
@fuzzylogiq
fuzzylogiq / last_login_full_name.sh
Created August 4, 2014 15:27
Casper extension for full User Name
#!/bin/bash
# Script to return full AD user name of last logged in user
DOMAIN="enterdomainhere"
LASTLOGIN=`defaults read /Library/Preferences/com.apple.loginwindow lastUserName`
LASTUSERID=`id -u $LASTLOGIN`
if [ $LASTUSERID -gt "1000" ]
@fuzzylogiq
fuzzylogiq / postflight
Last active August 29, 2015 14:23
Pre & Postflights for munki to call jamf recon only if managedsoftwareupdate has installed or removed
#!/bin/bash
ORCHARD_DEFAULTS=/Library/Preferences/uk.ac.ox.it.orchard
MUNKI_DEFAULTS=/Library/Preferences/ManagedInstalls
LOG_FILE=$(defaults read "${MUNKI_DEFAULTS}" LogFile)
LOG_DIR=$(dirname "${LOG_FILE}")
INSTALL_LOG_MTIME=$(stat -f "%m" "${LOG_DIR}/Install.log")
# Only run jamf recon if an Install/Removal has taken place
if [ $(defaults read "${ORCHARD_DEFAULTS}" InstallLogMtime) -ne $INSTALL_LOG_MTIME ];then
@fuzzylogiq
fuzzylogiq / gist:2459d0a3fadc7ca3b36b
Created August 10, 2015 11:31
Camel case to Underscores
s/([a-z](?=[A-Z])|[A-Z](?=[0-9]))/$1_/g
#!/bin/bash
exec > >(logger -i -t autopkg-build) 2>&1
BUILD_RECIPE_DIR="/dir/with/autopkg/recipenames"
EMAIL_ERRORS_TO='blah@acme.com'
my_name=$(basename $0)
# Allows us to get exit code of autopkg and not tee
set -o pipefail
alias shame='say -v Bells --rate=5 dede dee; x=3; while [ $x -gt 0 ]; do say -v Fiona shame; ((x--)) ; sleep 0.5; done'
@fuzzylogiq
fuzzylogiq / NVivo_10-10.2.2.plist
Created February 23, 2016 13:44
NVivo 10 & 11 pkginfos
<?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>_metadata</key>
<dict>
<key>created_by</key>
<string>ouit0354</string>
<key>creation_date</key>
<date>2016-02-19T10:40:25Z</date>
@fuzzylogiq
fuzzylogiq / backup_home_dirs.sh
Last active April 28, 2016 11:35
Simple backup script for deploystudio running from external drive
#!/bin/sh
echo "backup_home_dirs.sh - v1.0 - ("`date`")"
set -e
TMPFILE="/tmp/Backup-${DS_SERIAL_NUMBER}-`date "+%Y%m%d"`.dmg"
DS_INTERNAL_DRIVE=`system_profiler SPSerialATADataType|awk -F': ' '/Mount Point/ {print $2}'|head -n1`
MOUNTPOINT="/Volumes/UserBackups-${DS_SERIAL_NUMBER}"
SPARSE="${TMPFILE}.sparseimage"
echo <Netboot Set Name> | perl -e 'while (<>){s/(.)/sprintf("%X:",ord($1))/ge;my $len=length()/3;s/:$//;print "\n Length (hex): ".sprintf("%02X",$len)."\n Name (hex): $_\n";}'
#!/usr/bin/python
# encoding: utf-8
"""
lightify.py
!!description goes here!!
Copyright (c) Ben Goodstein 2016
This program is free software: you can redistribute it and/or modify