Skip to content

Instantly share code, notes, and snippets.

mattcuk / wifiLogicAppPing.ino
Created Feb 16, 2021
ESP8266 Wifi Connect & Ping to Azure-based Logic App URL over HTTPS
View wifiLogicAppPing.ino
char ssid[] = "YOUR_WIFI_SSID";
char pass[] = "YOUR_WIFI_PASSWORD";
char logicAppURL[] = "https://YOUR_LOGIC_APP_URL";
// Needed to go here & install board support for ESP8266.
// This gave access to the WiFiClientSecureBearSSL client library (which is needed for HTTPS).
mattcuk / usb-dal-multiline-registry.reg
Created Oct 26, 2020
Example multi-line registry entry file for USB Detect & Launch
View usb-dal-multiline-registry.reg
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\VB and VBA Program Settings]
[HKEY_CURRENT_USER\Software\VB and VBA Program Settings\USBDetector]
[HKEY_CURRENT_USER\Software\VB and VBA Program Settings\USBDetector\Settings]
mattcuk / usb-dal-multiline-registry.vbs
Created Oct 26, 2020
Example multi-line registry entry for USB Detect & Launch
View usb-dal-multiline-registry.vbs
set ShellObj = CreateObject("WScript.Shell")
ShellObj.RegWrite "HKCU\Software\VB and VBA Program Settings\USBDetector\Settings\Advanced", "label:(any)" & vbCrLf & "exec:""C:\App\USB-Warning.bat"" ""%1""" & vbCrLf & "ignore:c:\", "REG_SZ"
ShellObj.RegWrite "HKCU\Software\VB and VBA Program Settings\USBDetector\Settings\Interval", "10", "REG_SZ"
mattcuk / emailBody.js
Created Apr 12, 2020
Azure Logic App - Inline Code - Generate HTML for an Email Body
View emailBody.js
var titles = workflowContext.actions.Execute_JavaScript_Code.outputs.body;
var html = '';
titles.forEach(function(fulltitle) {
var title = fulltitle.substr(5); // Strip off the first 5 characters.. '12 - Headline' becomes 'Headline'
html += fulltitle +
' | <a href="'+title+'">Somesite</a>' +
mattcuk / multiFilter.js
Created Apr 12, 2020
Azure Logic App - Inline Code - Multi Part Filter
View multiFilter.js
var titles = workflowContext.actions.Filter_array_on_year.outputs.body;
var newTitles = [];
const regex = /(.*)(2019|2020|2021).*/i; // Regex for year filtering
titles.forEach(function(item) {
// Additional filter for titles containing 1080p only
if (item.title.indexOf('1080p') > -1) {
// Extract the title and year only
var titleMatch = regex.exec(item.title);
mattcuk / simpleTextFilter.js
Created Apr 12, 2020
Azure Logic App - Inline Code - Simple Text Filter
View simpleTextFilter.js
const filtered = workflowContext.actions.Current_JSON.outputs.filter(item => item.display_name=='My search string');
return filtered;
mattcuk /
Created Apr 3, 2020
List the Azure Logic Apps which don't have an Alert set up against them
echo Finding what Alerts exist already ...
./ > listAlertIds.tmp
echo Finding what Logic Apps exist ...
./ > listLogicApps.tmp
echo Logic Apps without an Alert are ...
comm -23 <(sort -u ./listLogicApps.tmp) <(sort -u ./listAlertIds.tmp)
mattcuk /
Created Apr 3, 2020
Simple script to list out all Logic Apps in a subscription.. one per line
logicapps=$(az resource list --output tsv --resource-type "Microsoft.Logic/workflows" --query [].id)
for logicapp in $logicapps
echo "$logicapp"
mattcuk /
Created Apr 3, 2020
List out all Azure resources that have Alerts set up (escapes Alert ID to get around issue with spaces)
alerts=$(az resource list --output tsv --resource-type "Microsoft.Insights/metricAlerts" --query [].id)
alerts=${alerts// /SPACEFIX}
for alert in $alerts
az resource show --ids "${alert//SPACEFIX/ }" --query properties.scopes[0] --output tsv
mattcuk / led-ring-backlight.ino
Created Feb 25, 2019
Arduino code to create an ambient backlight using an RGB LED ring
View led-ring-backlight.ino
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#define PIN 6 // pin on the Arduino is connected to the LED ring
#define NUMPIXELS 24 // Number of pixels on the LED ring
#define POT_PIN 0 // Potentiometer pin
#define BUTTON_PIN 2 // Button pin