Skip to content

Instantly share code, notes, and snippets.

View oliverlabs's full-sized avatar
💭
Focus.

Oliver Gulich oliverlabs

💭
Focus.
View GitHub Profile
@oliverlabs
oliverlabs / Program.cs
Created June 27, 2025 08:38
Azure AI Foundry Auth using Entra ID in C#
using Microsoft.Extensions.Configuration;
using Microsoft.SemanticKernel;
using Microsoft.SemanticKernel.ChatCompletion;
using Microsoft.SemanticKernel.Connectors.OpenAI;
using Azure.Identity;
string filePath = Path.GetFullPath("appsettings.json");
var config = new ConfigurationBuilder()
.AddJsonFile(filePath)
.Build();
@oliverlabs
oliverlabs / get-cpu-temperature-windows.ps1
Created August 8, 2024 14:54
Get CPU Temperature on Windows
Get-CimInstance -Namespace root/wmi -ClassName MsAcpi_ThermalZoneTemperature -Filter "Active='True' and CurrentTemperature<>2732" -Property InstanceName, CurrentTemperature |
Select-Object InstanceName, @{n='CurrentTemperatureC';e={'{0:n0} C' -f (($_.CurrentTemperature - 2732) / 10.0)}}
@oliverlabs
oliverlabs / windows_shortcuts.md
Last active January 18, 2024 14:21
Windows Shortcuts

List of Nifty Windows 11 Shortcuts

Win + Alt + S - Launch Sticky Notes sidebar and start capturing notes.

Win + C - Open Windows Copilot

Win + E - Open Windows Explorer

Win + I - Open Windows System Settings

@oliverlabs
oliverlabs / bluetooth.ahk
Created January 3, 2024 09:55
Open Bluetooth Settings using AutoHotkey
#SingleInstance, Force
SendMode Input
SetWorkingDir, %A_ScriptDir%
; Hotkeys
; if a single line, no need for a return at the end
; if multiple lines, use a return at the end of each line
#K::Run, ms-settings:connecteddevices ; Win+K - Open Windows Bluetooth Devices
@oliverlabs
oliverlabs / mcd.ps1
Created September 27, 2023 14:56
This function creates a folder and performs a cd operation into it with one command
# This function creates a folder and cd into it
function mcd {
param (
[Parameter(Mandatory = $true)]
[string]$folderName
)
New-Item -ItemType Directory -Force -Path $folderName
Set-Location -Path $folderName
@oliverlabs
oliverlabs / venv-functions.ps1
Created September 26, 2023 09:09
PowerShell Functions to activate and deactivate a Python virtual environment
## Activate a Python Virtual Environment
Function vea {
Get-ChildItem activate.ps1 -Recurse -Depth 2 | % { $_.FullName } | Invoke-Expression
}
## Deactivate a Python Virtual Environment
Function ved {
Invoke-Expression "deactivate -nondestructive"
}
@oliverlabs
oliverlabs / setx.ps1
Created August 14, 2023 14:19
Set a user environment variable in PowerShell
# Set a user environment variable in PowerShell
setx MACHINE Brand1
# echo $env:MACHINE
@oliverlabs
oliverlabs / gh-repo-rbac.sh
Created August 9, 2023 11:42
Check user permissions for a GitHub repository using GitHub CLI
# This command requires gh cli to be installed
OWNERORG="test"
REPOSITORY="test"
GHUSERNAME="test"
gh api repos/$OWNERORG/$REPOSITORY/collaborators/$USERNAME/permission | jq '.permission' -r
@oliverlabs
oliverlabs / subnet-array.bicep
Created August 8, 2023 15:27
Create new virtual network subnets from an array in Bicep
var addressSpace = [
'10.0.0.0/22'
]
var subnets = [
{
name: 'test1'
subnetPrefix: '10.0.3.0/26'
}
{