This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# works with both Get-AzAks cluster object and az aks list | ConvertFrom-Json PSCustomObjects | |
function Get-AKSHotfixVersion { | |
param($AKSCluster) | |
$hotfixVersions = @{'12'='1.12.5'; '11'='1.11.7'; '10'='1.10.12'; '9'='1.9.11'} | |
foreach ($cluster in $AKSCluster) { | |
$currentVersion = $cluster.KubernetesVersion | |
[string]$majorRelease = $currentVersion.split('.')[1] | |
$hotfixVersion = $hotfixVersions.$majorRelease | |
$hotfixVersion | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$mySubscriptions = $(az account list --query [].id -o tsv) | |
foreach ($subscription in $mySubscriptions) { | |
$clusters = $(az aks list --subscription $subscription) | ConvertFrom-Json | |
foreach ($cluster in $clusters) { | |
"$($cluster.name) in resource group $($cluster.resourceGroup) in subscription $subscription" | |
az aks get-credentials --resource-group $($cluster.resourceGroup) --name $($cluster.name) --subscription $subscription --overwrite-existing | |
kubectl get nodes -o custom-columns=NAME:.metadata.name,VERSION:.status.nodeInfo.containerRuntimeVersion | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Prompt { | |
try { | |
$history = Get-History -ErrorAction Ignore -Count 1 | |
if ($history) { | |
$ts = New-TimeSpan $history.StartExecutionTime $history.EndExecutionTime | |
Write-Host "[" -NoNewline | |
switch ($ts) { | |
{$_.TotalSeconds -lt 1} { | |
[decimal]$d = $_.TotalMilliseconds |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$response = invoke-webrequest "https://www.slickcharts.com/sp500" | |
$table = $response.parsedhtml.body.childnodes[6].childnodes[1].childnodes[0].childnodes[0].childnodes[1].childnodes[0] | |
# Column Headers | |
$columns = foreach ($node in $table.childnodes[0].childnodes[0].childnodes) {$node.innertext} | |
$stockrows = $table.childnodes[1].childnodes | |
$stocks = foreach ($row in $stockrows) { | |
$attributes = @{} | |
for ($i=0; $i -lt $($columns.count); $i++) { | |
$attributes.Add($columns[$i],$row.childnodes[$i].innertext.trim()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-Portfolio { | |
[CmdletBinding()] | |
param ( | |
$amount, | |
$transactionCost = 5, | |
$maxCostRatio = 0.02 | |
) | |
begin { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ConvertTo-Base64 { | |
Param( | |
$Text | |
) | |
$Bytes = [System.Text.Encoding]::Unicode.GetBytes($Text) | |
[System.Convert]::ToBase64String($Bytes) | |
} | |
function ConvertFrom-Base64 { | |
Param( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
Get-CsTopologyFixed.ps1 v1.0 | |
Last updated 2015-02-27 by Amanda Debler, https://mandie.net | |
Please let me know about any improvements you've made or mistakes you've found! | |
#> | |
OlderNewer