I'm experimenting with collisions for the Env var RFC: PowerShell/PowerShell-RFC#384
Case: fails as expected
$h1 = @{ "path" = 'foo\bar' }
$h2 = @{ "path`u{0}" = '' }| using namespace System.Collections.Generic | |
| <# | |
| Using: Pwsh 7 | |
| Related: | |
| For parsing HTML with CSS Selector queries, see this template: <https://gist.github.com/ninmonkey/17f6a1f5b28249b6cb2ba8bc746ae4fb> | |
| #> | |
| function FindArchivedUrl { | |
| <# |
I'm experimenting with collisions for the Env var RFC: PowerShell/PowerShell-RFC#384
Case: fails as expected
$h1 = @{ "path" = 'foo\bar' }
$h2 = @{ "path`u{0}" = '' }| function InvokeWingetInstall { | |
| <# | |
| .synopsis | |
| example of using native commands with dynamic conditions. | |
| .example | |
| # example commands: Use -TestOnly and -Verbose to see cli arguments, without invoking it. | |
| InvokeWingetInstall -Verbose -Package 'Microsoft.PowerBI' -TestOnly -Silent | |
| VERBOSE: install --id Microsoft.PowerBI /silent | |
| # I'm explicitly unloading the module for each test | |
| Remove-Module ImportExcel -ea 'ignore' | |
| (Get-Module ImportExcel).IterCommands.count | |
| # out: 0 | |
| Remove-Module ImportExcel -ea 'ignore' | |
| (Get-Module ImportExcel).count | |
| # out: 0 | |
| Remove-Module ImportExcel -ea 'ignore' |
Compare if NaN fails a round trip in Powershell or when using System.Text.Json
Ran using: pwsh.exe 7.4. context
| @' | |
| There's a bunch of literals added in 6+ | |
| 7.1 added | |
| > using a type suffix on a hex literal now returns a signed value of that type | |
| https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_numeric_literals?view=powershell-7.5 | |
| '@ | |
| 100 - 93.79 | ty 'i int, i d' |
| $originalMessage = "hi 🐒 world" | |
| $enc = [Text.Encoding]::GetEncoding('utf-8') | |
| $bytes = $enc.GetBytes( $originalMessage) | |
| $hexStr = [Convert]::ToHexString( $bytes ) | |
| $asBytes = [Convert]::FromHexString( $hexStr ) | |
| $roundTrip = $enc.GetString( $AsBytes ) | |
| [pscustomobject]@{ |
| # This is a ps5 + ps7 script | |
| # ps5 writes errors when PBI refreshes, ps7 either never does, or its much, much more rare | |
| $dest = 'C:\Users\cppmo_000\AppData\Local\Temp\cults.csv' | |
| $iter = 0 | |
| while($true) { | |
| $iter++ | |
| $Last = [datetime]::Now | |
| $content = w32tm /stripchart /computer:time.google.com /samples:1 /dataonly | |
| Add-Content -Path $dest -Value ( |