Skip to content

Instantly share code, notes, and snippets.

@justusiv
justusiv / HASS_Gasst_config_generation.ps1
Last active November 12, 2021 02:44
If your HASS is setup for google assistant you can use this to generate the data for the configuration yaml files. This was quickly created for my own needs but thought i would share. paste into ISE and run. two questions are asked one for IP of wled to pull the json info and the second is for a room. I used Bedroom, not sure if it can handle sp…
if ($wledip -eq $null){$wledip = Read-Host -Prompt "Enter IP of wled"}
if ($location -eq $null){$location = Read-Host -Prompt "Enter location... For example Bedroom... Input"}
$data = (Invoke-WebRequest http://$wledip/json).content
$obj = ConvertFrom-Json -InputObject $data
$effects = $obj.effects
$effects = $effects -replace '&', ' '
$effects = $effects -replace '\+', ' plus'
$effects = $effects -replace ' ', ''
while($true){
$length = get-random -Minimum 1 -Maximum 15
$min = [Math]::Pow(10,$length) / 10
$max = [Math]::Pow(10,$length) - 1
$ran = [math]::Round((Get-Random -Minimum $min -Maximum $max))
write-host $ran -NoNewline -BackgroundColor (Get-Random -Minimum 0 -Maximum 16) -ForegroundColor (Get-Random -Minimum 0 -Maximum 16)
}
@justusiv
justusiv / CreateFiles.ps1
Last active January 16, 2019 18:49
Powershell Random Data Creation
Function CreateFiles(){
Param(
$bytes = 10MB,
$count = 10000,
$path = "e:\files",
$verbosecount = 10,
$verbose = $true,
$filename = ""
)
$silent = mkdir $path -ErrorAction SilentlyContinue
#requires -version 2
<#
.SYNOPSIS
Installs latest rclone
.INPUTS
-Location to install.
-exeonly If you only want to deal with the exe.
-Temp Location to use for temp.
-beta To download the latest beta
.OUTPUTS
#requires -version 2
<#
.SYNOPSIS
Installs latest rclone beta
.INPUTS
Location to install.
If you only want to deal with the exe.
Temp location to use.