Skip to content

Instantly share code, notes, and snippets.

View motionbug's full-sized avatar

Rob P motionbug

View GitHub Profile
#!/bin/zsh
#################################################
# Date: 05.12.23
#
# version 1.0
# Written by: Rob Potvin | Senior Consulting Engineer | Jamf
#
# DESCRIPTION
# Enable or Disable macOS Onboarding within the currenly logged in user.
#
@motionbug
motionbug / sips-icns-png.sh
Last active October 9, 2018 14:00
Create png from icns file
#!/bin/bash
#great little script to just use system icons for scripts
ICNS="/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/Sync.icns"
LOGO="/private/tmp/logo.png"
convertlogo=$(sips -z 512 512 -s format png ${ICNS} --out ${LOGO})
@motionbug
motionbug / png2icns
Created October 9, 2018 13:51 — forked from djhaskin987/png2icns
Convert PNG file to ICNS file
# Stolen from here: http://stackoverflow.com/a/20703594/850326
#!/bin/sh
export POSIXLY_CORRECT=1
if [ -z "${1}" -o -z "${2}" ]
then
echo "Usage: ${0} <name> <original-png-location>"
fi
name=$1
@motionbug
motionbug / logged-bash-script-example.sh
Created August 9, 2018 12:28 — forked from benbuckman/logged-bash-script-example.sh
tee stdout to log inside bash script
#! /bin/bash
# concept from http://stackoverflow.com/a/3403786/267224
#############
# log to file
LOGFILE=/home/user/log/script.log
exec > >(tee -a $LOGFILE)
exec 2>&1
############
on replace_chars(this_text, search_string, replacement_string)
set AppleScript's text item delimiters to the search_string
set the item_list to every text item of this_text
set AppleScript's text item delimiters to the replacement_string
set this_text to the item_list as string
set AppleScript's text item delimiters to ""
return this_text
end replace_chars
@motionbug
motionbug / gist:3085136
Created July 10, 2012 17:55 — forked from jamesez/gist:3085058
Build Chrome dmg
#!/bin/bash -ex
# Mount disk image on temp space
mountpoint=`hdiutil attach -mountrandom /tmp -nobrowse googlechrome.dmg | awk '/private\/tmp/ { print $3 } '`
echo Mounted on $mountpoint
# Determine version number
version=`defaults read "$mountpoint/Google Chrome.app/Contents/Info.plist" CFBundleShortVersionString`
echo Google Chrome version $version
@motionbug
motionbug / com.adobe.Acrobat.Pro.plist
Created June 17, 2012 05:53 — forked from timsutton/com.adobe.Acrobat.Pro.plist
Suppress updates, offer to associate PDFs with Acrobat, EULA
<?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>10</key>
<dict>
<key>AVAlert</key>
<dict>
<key>Checkbox</key>
<array>
@motionbug
motionbug / postflight
Created June 15, 2012 18:53 — forked from rockpapergoat/postflight
create a recovery partition using apple's tools
#!/bin/bash
hdiutil attach -nobrowse -noverify /tmp/RecoveryHDUpdate.dmg
hdiutil attach -nobrowse -noverify /Volumes/RecoveryHDUpdate/RecoveryHDUpdate.pkg/RecoveryHDMeta.dmg
/tmp/RecoveryHDUpdate/RecoveryHDUpdate.pkg/Scripts/Tools/dmtest ensureRecoveryPartition / /Volumes/Recovery\ HD\ Update/BaseSystem.dmg 0 0 /Volumes/Recovery\ HD\ Update/BaseSystem.chunklist
hdiutil eject /Volumes/Recovery\ HD\ Update
hdiutil eject /Volumes/RecoveryHDUpdate
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" \
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- Contains a unique string that identifies your daemon to launchd.
This key is required. -->
<key>Label</key>
<string>com.gocongress.backup</string>
@motionbug
motionbug / launchdexample.xml
Created June 15, 2012 18:17 — forked from chrishulbert/launchdexample.xml
launchd example plist
<?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>Label</key>
<string>com.mycompanyname.mydepartment.mytaskname</string>
<key>ProgramArguments</key>
<array>
<string>/Users/myuser/Dashboard/mytask.sh</string>
</array>