Skip to content

Instantly share code, notes, and snippets.

View mdehaas's full-sized avatar

Marcel de Haas mdehaas

View GitHub Profile
@mdehaas
mdehaas / gist:9224830e5402d299405c
Created June 1, 2015 08:24
Test PATH for non-existing folders [Microsoft Operations Management Suite]
ForEach ($pItem in ($env:Path.split(";"))) {Write-output $pItem;Test-Path $pItem}
@mdehaas
mdehaas / keybase.md
Last active September 28, 2021 07:55

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 / 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).
## 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))
@mdehaas
mdehaas / CreateAppointment.ps1
Last active July 8, 2021 07:01
Create Outlook Appointment
$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 / _template.ps1
Created October 21, 2021 12:18
My Powershell script starting point (template)
$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 / applicance-started-andor-stopped.yaml Home Assistant Blueprint: Notify or do something when an appliance like a dishwasher or washing machine finishes
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: