Skip to content

Instantly share code, notes, and snippets.

@mattcuk
mattcuk / cpu-max.cmd
Created July 10, 2023 08:05
Scripts to allow you to easily switch between 100% of CPU, and 99% which will help prevent coil whine in some laptops. Be aware that setting it to 99% will disable clock boost, so your CPU won't be hitting it's full potential until you switch back to 100%..
powercfg /setacvalueindex SCHEME_BALANCED SUB_PROCESSOR PROCTHROTTLEMAX 100
powercfg /setactive SCHEME_BALANCED
@mattcuk
mattcuk / GitHubNotPushed.ahk
Created March 8, 2022 11:26
AutoHotKey script that alerts you if you have changes you need to push for a particular repository
#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 March 8, 2022 11:23
AutoHotKey script that brings the 'Do you want to stash pop now' dialog to the front (it will often get hidden behind other windows)
#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 February 18, 2022 16:35
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.
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 February 18, 2022 16:26
ESP8266 Wifi Connect & Ping to Azure-based Logic App URL over HTTPS
// 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 October 26, 2020 11:38
Example multi-line registry entry file for USB Detect & Launch
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 October 26, 2020 11:26
Example multi-line registry entry for USB Detect & Launch
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 April 12, 2020 15:42
Azure Logic App - Inline Code - Generate HTML for an Email Body
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 April 12, 2020 15:41
Azure Logic App - Inline Code - Multi Part Filter
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 April 12, 2020 15:38
Azure Logic App - Inline Code - Simple Text Filter
const filtered = workflowContext.actions.Current_JSON.outputs.filter(item => item.display_name=='My search string');
return filtered;