Skip to content

Instantly share code, notes, and snippets.

View gist:4d66eb7ed4611755ae4bb859fce37016
curl -sku $apiUser:$apiPass $jpsURL/JSSResource/fileuploads/computers/id/$JSS_ID -F name=@${mylog} -X POST
View gist:53ab550a5568f873c973aac15d37da65
JSS_ID=$(curl -H "Accept: text/xml" -sfku "${jss_user}:${jss_pass}" "${jss_url}/JSSResource/computers/serialnumber/${serial}/subset/general" | xpath /computer/general/id[1] | awk -F'>|<' '{print $3}')
View gist:919c5d2d10eba4f306e57862f47a84f1
serial=$(system_profiler SPHardwareDataType | awk '/Serial\ Number\ \(system\)/ {print $NF}');
View gist:4dba9f36252552dca6b16c43464ab899
#!/bin/zsh
mylogpath=/tmp/mylog
mylog=$mylogpath/myawesomlog-$(date +%Y%m%d-%H%M).log
[[ ! -d ${mylogpath} ]]; mkdir -p $mylogpath
set -xv; exec 1> $mylog 2>&1
... do some stuff ...
@stevewood-tx
stevewood-tx / gist:b9fff8866c576c48dd14e00d4317e3f0
Last active Jan 9, 2019
Complete Node.js for AWS Lambda Webhook Relay
View gist:b9fff8866c576c48dd14e00d4317e3f0
var https = require('https');
exports.handler = (event, context, callback) => {
console.log("MYLOG" + JSON.stringify(event))
var body = JSON.parse(event.body);
var name = body.event.deviceName;
var sernum = body.event.serialNumber;
var user_name = body.event.username;
@stevewood-tx
stevewood-tx / gist:87269e1a2e5c6bdac5453245500f172c
Created Jan 9, 2019
Node.js https request for AWS Lambda
View gist:87269e1a2e5c6bdac5453245500f172c
const req = https.request(post_options,
(res) => res.on("data", () => callback(null, "OK")))
req.on("error", (error) => callback(JSON.stringify(error)));
req.write(post_data);
req.end();
View gist:79a34eead166eb4cd8689979c9f973b7
lpa='/usr/sbin/lpadmin'
${lpa} -p CopyThat -E -o printer-is-shared=false -v lpd://10.89.170.5 \
-P "/Library/Printers/PPDs/Contents/Resources/Xerox WorkCentre 7855.gz"
${lpa} -p CopyThat -o Duplex=DuplexNoTumble -o XROutputColor=PrintAsGrayscale
View gist:c990263d1dd37bd778c359c27aaa1426
lpa='/usr/sbin/lpadmin'
case $printer in
Printer1)
${lpa} -p Printer1 -E -o printer-is-shared=false -v ipp://10.1.1.1/ipp/print \
-D "Printer1" -P "/Library/Printers/PPDs/Contents/Resources/Xerox WorkCentre 5955.gz"
;;
Printer2)
${lpa} -p Printer2 -E -o printer-is-shared=false -v ipp://10.1.1.2/ipp/print \
View gist:57fa7a6861237d13d89ab5a3d12bec8e
if [[ ! -f "/Library/Printers/PPDs/Contents/Resources/Xerox WorkCentre 5955.gz" ]]; then
/usr/local/bin/jamf policy -trigger xeroxGenericDriver
fi
View addPackages.sh
#!/bin/sh
# Name: addPackages.sh
# Date: 27 Mar 2018
# Author: Steve Wood (steve.wood@omnicomgroup.com)
# Purpose: used to stub out packages in the Jamf Pro database
# The CSV file needs to be saved as a UNIX file with LF, not CR
# Version: 1.1
# Update: 27 Mar 2018 - fixing an error in the counter
# A good portion of this script is re-purposed from the script posted in the following JAMF Nation article:
You can’t perform that action at this time.