Skip to content

Instantly share code, notes, and snippets.

View julian-wendt's full-sized avatar

Julian Wendt julian-wendt

  • glueckkanja
  • Germany
  • 20:24 (UTC +02:00)
View GitHub Profile
@julian-wendt
julian-wendt / Use-KeyVaultAsSecretContainer.ps1
Last active February 18, 2024 19:40
Use Azure KeyVault to host secrets for Get-Secret
Install-Module -Name Microsoft.PowerShell.SecretManagement
Install-Module Az.KeyVault
$VaultParameters = @{
AZKVaultName = <Your-Key-Vault-Name>
SubscriptionId = <Your-SubscriptionId-Hosting-Your-Key-Vault>
}
Register-SecretVault -Module Az.KeyVault -Name 'AzKeyVault' -VaultParameters $VaultParameters
@julian-wendt
julian-wendt / brew-upgrade-casks.md
Created January 16, 2024 06:37 — forked from chrishuan9/brew-upgrade-casks.md
brew - upgrade casks
for cask in $(brew list --cask); do brew upgrade --cask $cask; done;
@julian-wendt
julian-wendt / Find-ClosestDate.ps1
Created February 9, 2023 10:53
Function to find the closest date to a given date
function Find-ClosestDate {
param(
[Parameter(Mandatory)]
[DateTime]$GivenDate,
[Parameter(Mandatory)]
[DateTime[]]$CompareDates
)
$Result = $CompareDates | Select-Object -Property Date, @{ Name = "Index"; Expression = { [math]::abs($($_.Subtract($GivenDate)).TotalSeconds) } } |
@julian-wendt
julian-wendt / brew-install-script.sh
Last active April 10, 2024 00:15 — forked from CliffordAnderson/brew-install-script.sh
Brew script for installing packages and applications on OSX
#!/bin/sh
# Homebrew Script for OSX
# To execute: save and `chmod +x ./brew-install-script.sh` then `./brew-install-script.sh`
echo "Install brew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo "Install Rosetta 2..."
softwareupdate --install-rosetta
@julian-wendt
julian-wendt / Add-AlertEvidenceDetailsAsKeyValue.kusto
Created December 2, 2021 12:45
Add alert evidence details as key value pair
AlertEvidence
| mv-apply ParsedFields = parse_json(AdditionalFields) on
(
extend Key = tostring(bag_keys(ParsedFields)[0])
| project Key, Value = ParsedFields[Key]
)
| project-away AdditionalFields
function Remove-Properties {
<#
.SYNOPSIS
Remove a list of properties from an object.
.DESCRIPTION
Loops through a list of given properties and removes them from the object.
.PARAMETER Object
Object to update.
@julian-wendt
julian-wendt / Join-Object.ps1
Last active April 28, 2021 12:53
Join-Object
function Join-Object {
<#
.SYNOPSIS
Join properties of two objects into one.
.DESCRIPTION
Compare properties from two objects and join them into one.
If properties exist in both objects and their values are not equal, reference values will be replaced.
Properties which only exist in the difference object will be added to the reference object.
@julian-wendt
julian-wendt / Load-VsCodeWorkspaceProfile.ps1
Last active January 10, 2024 16:02
Load Visual Studio Code Workspace Profile
# Add this snippet to your PowerShell profile to detect if PowerShell is running in the integrated terminal of VS Code.
# If true, the snippet immports .vscode.ps1 from the root dir or profile.ps1 from your .vscode directory.
$ScriptRoot = [System.IO.Directory]::GetCurrentDirectory()
if ($env:TERM_PROGRAM -eq 'vscode') {
if ([System.IO.File]::Exists("$ScriptRoot/.vscode.ps1")) {
Import-Module -Name "$ScriptRoot/.vscode.ps1"
return "Successfully loaded workspace profile."
}
elseif ([System.IO.File]::Exists("$ScriptRoot/.vscode/profile.ps1")) {