Skip to content

Instantly share code, notes, and snippets.

View jcallaghan's full-sized avatar

James Callaghan jcallaghan

View GitHub Profile
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
# Connect to Power BI (Optional -UserName "")
## 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 / 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
# Let's keep this simple and assume the medicine was taken each day.
function Get-SPOHubSiteNavigation{
Exports the hub navigation for the SPO site provided to CSV.
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 / 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 based on Alexa routine turning on the light.
- platform: state
entity_id: light.alexa_virtual
to: 'on'
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 when the toilet is flushed usng a sensor on the cistern flush arm.
platform: state
entity_id: binary_sensor.toilet_flusher_contact
to: "on"
- trigger:
- platform: event
event_type: zha_event
device_id: 8f7901e0614a3cdc7eeb864e896efa87
- name: "Paw Button #1"
name: "#1 Announcement"
icon: mdi:bullhorn
max: 255
name: "#1 Notification"
icon: mdi:bullhorn
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
- platform: state
entity_id: binary_sensor.paw_button_1
to: 'on'