Skip to content

Instantly share code, notes, and snippets.

View luberan's full-sized avatar

Lukas Beran luberan

View GitHub Profile
@luberan
luberan / RevokeRefreshTokensGraph.ps1
Created June 5, 2024 11:23
Revoke all refresh tokens via Microsoft Graph
Revoke-MgUserSignInSession -UserId 'UserIdHere'
@luberan
luberan / RevokeAllEntraIDRefreshTokens.ps1
Created June 5, 2024 11:20
How to revoke all refresh tokens via PowerShell
Revoke-AzureADUserAllRefreshToken -ObjectId "UserIdHere"
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "ShowSyncProviderNotifications" -Value "0" -Type "dword"
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "RotatingLockScreenOverlayEnabled" -Value "0" -Type "dword"
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SubscribedContent-338387Enabled" -Value "0" -Type "dword"
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SubscribedContent-338393Enabled" -Value "0" -Type "dword"
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SubscribedContent-353694Enabled" -Value "0" -Type "dword"
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" -Name "SubscribedContent-353696Enabled" -Value "0" -Type "dword"
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Current
@luberan
luberan / ForcePasswordChangeOnLogOn.ps1
Created November 18, 2023 09:20
Enable temporary password on Microsoft Entra ID
Set-ADSyncAADCompanyFeature -ForcePasswordChangeOnLogOn $true
@luberan
luberan / enablePasswordExpirationEntraID.ps1
Created November 18, 2023 08:56
Enable password expiration for synchronized Microsoft Entra ID accounts
$OnPremSync = Get-MgDirectoryOnPremiseSynchronization
$OnPremSync.Features.CloudPasswordPolicyForPasswordSyncedUsersEnabled = $true
Update-MgDirectoryOnPremiseSynchronization `
-OnPremisesDirectorySynchronizationId $OnPremSync.Id `
-Features $OnPremSync.Features
@luberan
luberan / electricity_meter.yaml
Last active April 1, 2023 09:04
Template měřící cenu energie dodané do sítě
- trigger:
- platform: state
entity_id: sensor.celkova_energie_poslana_do_site
sensor:
- name: "Cena prodane elektriny celkem"
unique_id: electricity_sold_price_total
#device_class: monetary
unit_of_measurement: "CZK"
state: >
{% set price = float(states('sensor.current_spot_electricity_price'),0) %}
sensor.total_battery_out:
last_reset: '2021-10-10T00:00:00+00:00'
state_class: total
device_class: energy
value_template: '{{value|round(2)}}'
sensor.total_battery_in:
last_reset: '2021-10-10T00:00:00+00:00'
state_class: total
device_class: energy
value_template: '{{value|round(2)}}'
@luberan
luberan / celkova_vyroba_energie.yaml
Created November 18, 2022 15:45
Šablona měřící celkově vyrobenou energii ze Solax X3 Gybrid G4
- name: "Celková výroba energie"
state: "{{ states('sensor.solax_garage_total') }}"
availability: "{{ states('sensor.solax_garage_total') | float > 0 }}"
unit_of_measurement: "kWh"
state_class: total_increasing
device_class: energy
attributes:
last_reset: "1970-01-01T00:00:00+00:00"
@luberan
luberan / solax_homeassistant.yaml
Last active December 16, 2022 20:25
Vlastní senzor pro Home Assistant připojující se na API Solax Cloud
######## Solax
- platform: rest
scan_interval: 60
resource: https://www.solaxcloud.com/proxyApp/proxy/api/getRealtimeInfo.do?tokenId=VasTokenID&sn=SNVasehoInverteru
name: "Solax Garage"
json_attributes_path: "$.result"
json_attributes:
- yieldtoday
- yieldtotal
- powerdc1
@luberan
luberan / Zavrit-terasu-vecer.yaml
Created May 20, 2022 11:45
Zavření vrat pod terasu každý den v 22:00
alias: Zavrit terasu v 22:00
description: ''
trigger:
- platform: time
at: '22:00'
condition: []
action:
- scene: scene.zavrit_terasu_2
mode: single