Skip to content

Instantly share code, notes, and snippets.

View jcallaghan's full-sized avatar

James Callaghan jcallaghan

View GitHub Profile
@jcallaghan
jcallaghan / Export-PowerBIWorkspaceMembers.ps1
Last active March 5, 2024 12:30
Power BI Workspace Members Report
# Install the PowerBI module
# Install-Module -Name MicrosoftPowerBIMgmt
# Import the PowerBI module
Import-Module MicrosoftPowerBIMgmt
# Login to Power BI
Login-PowerBI
# Connect to Power BI (Optional -UserName "yourusername@yourdomain.com")
## The following four lines only need to be declared once in your script.
$yes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes","Description."
$no = New-Object System.Management.Automation.Host.ChoiceDescription "&No","Description."
$cancel = New-Object System.Management.Automation.Host.ChoiceDescription "&Cancel","Description."
$options = [System.Management.Automation.Host.ChoiceDescription[]]($yes, $no, $cancel)
## Use the following each time your want to prompt the use
$title = "Title"
$message = "Question?"
$result = $host.ui.PromptForChoice($title, $message, $options, 1)
@jcallaghan
jcallaghan / Automation.yaml
Last active May 17, 2022 20:05
Example #HomeAssistant automation for tracking my medicine to remind me to order more when low.
alias: 'Family - James - Track Medicine'
id: '4df574c4-bb48-4108-b679-76a47966af92'
description: 'Track medicine and order more when low.'
initial_state: true
mode: 'single'
max_exceeded: silent
trigger:
# Let's keep this simple and assume the medicine was taken each day.
function Get-SPOHubSiteNavigation{
<#
.SYNOPSIS
Exports the hub navigation for the SPO site provided to CSV.
.DESCRIPTION
This custom function gets the Hub site navigation links for the provided SPO site.
It then iterates through each of the links and builds a collection to export to CSV.
This collection can also be integrated using pipe functions.
@jcallaghan
jcallaghan / Home-Assistant - Alexa Automation.yaml
Last active October 27, 2021 07:59
This Home Assistant automation is trigger through an Alexa automation.
alias: Alexa - It's stinky
trigger:
# Trigger based on Alexa routine turning on the light.
- platform: state
entity_id: light.alexa_virtual
to: 'on'
condition:
@jcallaghan
jcallaghan / Home-Assistant - Toilet Flush Automation.yaml
Created March 13, 2020 18:40
This automation is triggered in Home Assistant when the toilet is flushed. It activates the air freshener and also nags through text-to-speech to close the seat lid if it is left open.
alias: 'Bathroom - Toilet flush air freshener + tts'
trigger:
# Trigger when the toilet is flushed usng a sensor on the cistern flush arm.
platform: state
entity_id: binary_sensor.toilet_flusher_contact
to: "on"
action:
template:
- trigger:
- platform: event
event_type: zha_event
event_data:
device_id: 8f7901e0614a3cdc7eeb864e896efa87
binary_sensor:
- name: "Paw Button #1"
input_text:
paw_button_1_tts:
name: "#1 Announcement"
icon: mdi:bullhorn
max: 255
paw_button_1_notification:
name: "#1 Notification"
icon: mdi:bullhorn
input_number:
paw_button_1_wait:
name: "#1 Wait"
min: 0
max: 300
step: 1
mode: box
unit_of_measurement: "mins"
icon: mdi:timer
alias: 'Paw Button 1'
id: '5c631613-1253-4b21-a342-ddea791e0000'
initial_state: true
mode: single
trigger:
- platform: state
entity_id: binary_sensor.paw_button_1
to: 'on'