Skip to content

Instantly share code, notes, and snippets.

@stevewood-tx
stevewood-tx / gist:b9fff8866c576c48dd14e00d4317e3f0
Last active January 9, 2019 03:45
Complete Node.js for AWS Lambda Webhook Relay
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 January 9, 2019 03:23
Node.js https request for AWS Lambda
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();
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
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 \
if [[ ! -f "/Library/Printers/PPDs/Contents/Resources/Xerox WorkCentre 5955.gz" ]]; then
/usr/local/bin/jamf policy -trigger xeroxGenericDriver
fi
#!/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:
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<a:fontScheme name="Arial" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">
<a:majorFont>
<a:latin typeface="Montserrat"/>
<a:ea typeface="" />
<a:cs typeface="" />
</a:majorFont>
<a:minorFont>
<a:latin typeface="Montserrat"/>
<a:ea typeface="" />
/path/to/script/addPackages.sh <jssuser> <jsspass> /path/to/textfile.csv
#!/bin/sh
# Name: addPackages.sh
# Date: 3 nov 2017
# Author: Steve Wood (swood@integer.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.0
#
# A good portion of this script is re-purposed from the script posted in the following JAMF Nation article:
aws s3 ls s3://<yourbucketaddress> >> ~/mypackages.txt