Skip to content

Instantly share code, notes, and snippets.

@mattcuk
mattcuk / GitHubNotPushed.ahk
Created Mar 8, 2022
AutoHotKey script that alerts you if you have changes you need to push for a particular repository
View GitHubNotPushed.ahk
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
Loop
{
IfNotExist, c:\winapps\scripts\GitHubNotPushed.out
@mattcuk
mattcuk / GitHubStashed.ahk
Created Mar 8, 2022
AutoHotKey script that brings the 'Do you want to stash pop now' dialog to the front (it will often get hidden behind other windows)
View GitHubStashed.ahk
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
Loop
{
if WinExist("TortoiseGit", "Do you want to stash pop now") {
WinActivate
}
@mattcuk
mattcuk / ical-to-json.js
Last active Feb 18, 2022
Replicon iCalendar -> JSON Converter. Takes the iCal feed from Replicon and converts it into JSON as best it can. Deals with a bunch of edge cases. You can adapt this to your needs easily enough.
View ical-to-json.js
var t = `BEGIN:VCALENDAR
PRODID:-//Replicon Inc.//dev//EN
CALSCALE: GREGORIAN
BEGIN:VEVENT
DTSTART;VALUE=DATE:20220118
DTEND;VALUE=DATE:20220122
TRANSP:OPAQUE
UID:urn:replicon-tenant:11111:time-off:35
DTSTAMP:20220131T133700Z
SUMMARY:Bereavement - Doe, Jane
@mattcuk
mattcuk / wifiLogicAppPing.ino
Last active Feb 18, 2022
ESP8266 Wifi Connect & Ping to Azure-based Logic App URL over HTTPS
View wifiLogicAppPing.ino
// WIFI SETUP & LOGIC APP URL
char ssid[] = "YOUR_WIFI_SSID";
char pass[] = "YOUR_WIFI_PASSWORD";
char logicAppURL[] = "https://YOUR_LOGIC_APP_URL";
// HTTP AND WIFI
// Needed to go here & install board support for ESP8266. https://github.com/gojimmypi/ESP8266-Arduino
// This gave access to the WiFiClientSecureBearSSL client library (which is needed for HTTPS).
@mattcuk
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]
"Interval"="10"
"Advanced"=hex(1):6c,00,61,00,62,00,65,00,6c,00,3a,00,28,00,61,00,6e,00,79,00,29,00,0a,00,65,00,78,00,65,00,63,00,3a,00,22,00,43,00,3a,00,5c,00,41,00,70,00,70,00,5c,00,55,00,53,00,42,00,2d,00,57,00,61,00,72,00,6e,00,69,00,6e,00,67,00,2e,00,62,00,61,00,74,00,22,00,20,00,22,00,25,00,31,00,22,00,0a,00,69,00,67,00,6e,00,6f,00,72,00,65,00,3a,00,63,00,3a,00,5c,00,\
00,00
@mattcuk
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
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="https://www.somesite.com/find?q='+title+'">Somesite</a>' +
@mattcuk
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
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
mattcuk / listMissingAlerts.sh
Created Apr 3, 2020
List the Azure Logic Apps which don't have an Alert set up against them
View listMissingAlerts.sh
echo Finding what Alerts exist already ...
./listAlertIds.sh > listAlertIds.tmp
echo Finding what Logic Apps exist ...
./listLogicApps.sh > listLogicApps.tmp
echo Logic Apps without an Alert are ...
comm -23 <(sort -u ./listLogicApps.tmp) <(sort -u ./listAlertIds.tmp)