Skip to content

Instantly share code, notes, and snippets.

View biacz's full-sized avatar

Nikolas Beutler biacz

View GitHub Profile
@biacz
biacz / main.ps1
Created January 22, 2022 15:45
AzureFunction - Turn off inactive AVD SessionHosts
<#
.SYNOPSIS
Automated process to stop unused session hosts in a Azure Virtual Desktop (AVD) personal host pool.
.DESCRIPTION
This script is intended to automatically stop personal host pool session hosts in a Azure Virtual Desktop
host pool. The script will evaluate session hosts in a host pool and create a list of session hosts with
active connections. The script will then compare all session hosts in the personal host pool that are
powered on and not in drain mode. The script will shut down the session hosts that have no active connections.
.NOTES
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"artifactsLocation": {
"defaultValue": "https://wvdportalstorageblob.blob.core.windows.net/galleryartifacts/Configuration.zip",
"type": "String",
"metadata": {
"description": "The base URI where artifacts required by this template are located."
}
@biacz
biacz / slowAF.ps1
Last active August 16, 2019 11:20
SLOW AF
$output = get-childitem -force \\$computer\c$\users\$user -Directory |
foreach-object {
$len = 0
measure-childitem $_.FullName -ErrorAction SilentlyContinue | foreach-object { $len += $_.Size }
[pscustomobject]@{
Name = $_.FullName
SizeGB = [math]::round($len / 1Gb, 2)
}
}
@biacz
biacz / diskspace.ps1
Created August 15, 2019 12:05
Checking disk space
function CleanVariables { Get-Variable | Where-Object { $startupVariables -notcontains $_.Name } | ForEach-Object {
try { Remove-Variable -Name "$($_.Name)" -Force -Scope "global" -ErrorAction SilentlyContinue -WarningAction SilentlyContinue }
catch { }
}
}
CleanVariables
<# This form was created using POSHGUI.com a free online gui designer for PowerShell
.NAME
@biacz
biacz / asdf.ps1
Created August 14, 2019 12:57
diskspaceanalyzer
function CleanVariables { Get-Variable | Where-Object { $startupVariables -notcontains $_.Name } | ForEach-Object {
try { Remove-Variable -Name "$($_.Name)" -Force -Scope "global" -ErrorAction SilentlyContinue -WarningAction SilentlyContinue }
catch { }
}
}
CleanVariables
<# This form was created using POSHGUI.com a free online gui designer for PowerShell
.NAME
@biacz
biacz / helphelphelp.txt
Created August 13, 2019 09:44
help help help.txt
2019-08-08T22:47:43.993+02:00> LVL:1 RC: 0 VGMAC :Stat frms: R=000000/000000/002750 T=000000/001365/001098 (A/I/O) Loss=0.00%/0.00% (R/T)
2019-08-08T22:48:44.071+02:00> LVL:1 RC: 0 VGMAC :Stat frms: R=000000/000000/004875 T=000000/002682/002119 (A/I/O) Loss=0.00%/0.00% (R/T)
2019-08-08T22:49:44.328+02:00> LVL:1 RC: 0 VGMAC :Stat frms: R=000000/000000/008169 T=000000/004467/003477 (A/I/O) Loss=0.00%/0.00% (R/T)
2019-08-08T22:50:44.324+02:00> LVL:1 RC: 0 VGMAC :Stat frms: R=000000/000000/010081 T=000356/005626/004329 (A/I/O) Loss=0.00%/0.00% (R/T)
2019-08-08T22:51:44.569+02:00> LVL:1 RC: 0 VGMAC :Stat frms: R=000000/000000/012161 T=000356/006768/005296 (A/I/O) Loss=0.00%/0.00% (R/T)
2019-08-08T22:52:44.641+02:00> LVL:1 RC: 0 VGMAC :Stat frms: R=000000/000000/013773 T=000356/007559/005970 (A/I/O) Loss=0.00%/0.00% (R/T)
2019-08-08T22:53:44.899+02:00> LVL:1 RC: 0 VGMAC :Stat frms: R=000000/000000/015832 T=000356/009122/00685
Connect-VIServer asdf
Clear-Variable report
$report = Get-Datacenter -PipelineVariable datacenter |
ForEach-Object {
get-cluster -Location $_ -PipelineVariable cluster |
ForEach-Object { get-vmhost -Location $_ |
foreach-object {[pscustomobject]@{
Datacenter=$datacenter.Name;
@biacz
biacz / main.cpp
Created December 19, 2018 23:21
basic_mqtt_framework
#include <ESP8266WiFi.h>
#include <PubSubClient.h>
#include <ESP8266mDNS.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>
#include "secrets.h"
#define ROOM "what"
#define NAME "ever"
@biacz
biacz / servo_test.ino
Created July 25, 2018 10:09 — forked from col/servo_test.ino
A simple Arduino sketch that allows you to control a brushless motor via an ESC (or any servo really) using inputs from the Arduino IDE serial monitor.
#include <Servo.h>
Servo esc;
int escPin = 9;
int minPulseRate = 1000;
int maxPulseRate = 2000;
int throttleChangeDelay = 100;
void setup() {
#include <IRremote.h>
int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
IRsend irsend;
boolean recording = true;
decode_results results;