Skip to content

Instantly share code, notes, and snippets.

Avatar

Marcel de Haas mdehaas

View GitHub Profile
@mdehaas
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
blueprint:
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
input:
power_sensor:
name: Power Sensor
description: Power sensor entity (e.g. from a smart plug device).
selector:
entity:
@mdehaas
mdehaas / _template.ps1
Created Oct 21, 2021
My Powershell script starting point (template)
View _template.ps1
$WhatIf = $true
$Verbose = $true
$Debug = $false
### END CONFIGURATION #####
$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
mdehaas / CreateAppointment.ps1
Last active Jul 8, 2021
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
$appt.Save()
$outlook.Quit()
@mdehaas
mdehaas / Windows Hello Camera Switcher.ps1
Last active Jun 7, 2021
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
### END CONFIGURATION #####
$basePath = $MyInvocation.MyCommand.Path.Replace($MyInvocation.MyCommand.Name,"").SubString(0,($MyInvocation.MyCommand.Path.Replace($MyInvocation.MyCommand.Name,"").length-1))
View keybase.md

Keybase proof

I hereby claim:

  • I am mdehaas on github.
  • I am marceldehaas (https://keybase.io/marceldehaas) on keybase.
  • I have a public key ASD04EnpccHwAr1nlIbnzz_dG-NpW_jYXXeoJg9rLog3Qwo

To claim this, I am signing this object:

@mdehaas
mdehaas / gist:9224830e5402d299405c
Created Jun 1, 2015
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}