Skip to content

Instantly share code, notes, and snippets.

View mdehaas's full-sized avatar

Marcel de Haas mdehaas

View GitHub Profile
mdehaas / applicance-started-andor-stopped.yaml Home Assistant Blueprint: Notify or do something when an appliance like a dishwasher or washing machine finishes
View applicance-started-andor-stopped.yaml
name: Appliance has started and/or finished
description: Do something when an appliance (like a washing machine or dishwasher) is started or has finished as detected by a power sensor based in the Watts consumed.
domain: automation
name: Power Sensor
description: Power sensor entity (e.g. from a smart plug device).
mdehaas / _template.ps1
Created October 21, 2021 12:18
My Powershell script starting point (template)
View _template.ps1
$WhatIf = $true
$Verbose = $true
$Debug = $false
$basePath = $MyInvocation.MyCommand.Path.Replace($MyInvocation.MyCommand.Name,"").SubString(0,($MyInvocation.MyCommand.Path.Replace($MyInvocation.MyCommand.Name,"").length-1))
$baseName = $MyInvocation.MyCommand.Name.Remove(($MyInvocation.MyCommand.Name.Length-4),4)
$Transcript = !$Whatif
if ($Transcript) {Start-Transcript -Path "$($basePath)\$($baseName)-$($env:USERNAME).transcript.txt"}
mdehaas / CreateAppointment.ps1
Last active July 8, 2021 07:01
Create Outlook Appointment
View CreateAppointment.ps1
$outlook = new-object -com Outlook.Application
$calendar = $outlook.Session.GetDefaultFolder(9) # == olFolderCalendar
$appt = $calendar.Items.Add(1) # == olAppointmentItem
$appt.Start = [datetime]$AppointmentTime
$appt.Subject = $subject
$appt.Location = $location
$appt.ReminderSet = $true
$appt.ReminderMinutesBeforeStart =$ReminderMinutesBeforeStart
mdehaas / Windows Hello Camera Switcher.ps1
Last active June 7, 2021 09:28
Powershell script to disable Windows Surface internal Hello camera when an external IR camera is present. I'm using this on a Surface Laptop. Use the XML to import a scheduled task (RunAs should be an Admin on the device).
View Windows Hello Camera Switcher.ps1
## Script Specific configuration
$ExternalCameraFriendlyName = "RGB-IR Camera"
## Generic configuration
$Verbose = $true
$Debug = $false
$WhatIf = $false
$basePath = $MyInvocation.MyCommand.Path.Replace($MyInvocation.MyCommand.Name,"").SubString(0,($MyInvocation.MyCommand.Path.Replace($MyInvocation.MyCommand.Name,"").length-1))
mdehaas /
Last active September 28, 2021 07:55

Keybase proof

I hereby claim:

  • I am mdehaas on github.
  • I am marceldehaas ( on keybase.
  • I have a public key ASD04EnpccHwAr1nlIbnzz_dG-NpW_jYXXeoJg9rLog3Qwo

To claim this, I am signing this object:

mdehaas / gist:9224830e5402d299405c
Created June 1, 2015 08:24
Test PATH for non-existing folders [Microsoft Operations Management Suite]
View gist:9224830e5402d299405c
ForEach ($pItem in ($env:Path.split(";"))) {Write-output $pItem;Test-Path $pItem}