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
# $PSStyle polyfill for Windows PowerShell: | |
# When run on a PS v7.2+ system, generates source code for Windows PowerShell | |
# that creates a nested ordered hashtable that mimics the v7.2+ $PSStyle object, | |
# albeit only with respect to the properties with general-purpose ANSI (VT) | |
# escape sequences, such as $PSStyle.Italic and $PSStyle.Foreground.Yellow | |
# | |
# Simply copy and paste this snippet and execute it in a PowerShell 7.2+ session, | |
# and it will output source code for Windows PowerShell that defines $PSStyle. | |
@" | |
if (`$null -eq `$PSStyle) { |
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
// Content for a Visual Studio Code "keybindings.json" file. | |
// To open your file for editing, use the command palette's "Preferences: Open Keyboard Shortcuts (JSON)" command. | |
// CAVEAT: You can copy and paste this file's content as-is to REPLACE your file's existing content | |
// but in doing so you'll lose any PREEXISTING definitions. | |
// To preserve any existing definitions, append everything *inside* "[" and "]" below to the *preexisting* | |
// top-level "[" and "]" enclosure (a JSON array), and be sure to append a "," to the last preexisting object | |
// inside the array before appending (or place the new objects at the top and append a "," to the second of | |
// the two new objects). | |
[ | |
// General definition for all shells *except* PowerShell. |
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
# Benchmarks for the answers at https://stackoverflow.com/q/75174855/45375. | |
# Specify how many sample data rows to use (use multiples of 10) | |
$totalRowCount = 1000 | |
# How many runs to average. | |
# Note: With values above 15 you'll start to see the effects of on-demand compilation. | |
$runCount = 10 | |
# Download and define function `Time-Command` on demand (will prompt). | |
# To be safe, inspect the source code at the specified URL first. |
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
<# | |
Prerequisites: Window PowerShell v5.1 and PowerShell (Core), on all supported platforms. (May work in earlier versions.) | |
License: MIT | |
Author: Michael Klement <[email protected]> | |
DOWNLOAD and INSTANT DEFINITION OF THE FUNCTION: | |
irm https://gist.github.com/mklement0/209a9506b8ba32246f95d1cc238d564d/raw/ConvertTo-BodyWithEncoding.ps1 | iex |
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
<# | |
Prerequisites: Windows PowerShell v5.1 or PowerShell Core (v6+) | |
License: MIT | |
Author: Michael Klement <[email protected]> | |
DOWNLOAD and INSTANT DEFINITION OF THE FUNCTION: | |
irm https://gist.github.com/mklement0/0fc086da1af9a72a94cbdb4a59d55230/raw/Get-WinError.ps1 | iex |
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
<# | |
Prerequisites: Windows PowerShell v5.1 (possibly earlier; untested) or PowerShell (Core) | |
License: MIT | |
Author: Michael Klement <[email protected]> | |
DOWNLOAD and INSTANT DEFINITION OF THE FUNCTION: | |
irm https://gist.github.com/mklement0/a700e598b615a1d432cc87e7291cdfec/raw/ConvertTo-IntegerUnchecked.ps1 | iex |
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
<# | |
Prerequisites: PowerShell v5.1 and above (verified; may also work in earlier versions) | |
License: MIT | |
Author: Michael Klement <[email protected]> | |
DOWNLOAD and DEFINITION OF THE FUNCTION: | |
irm https://gist.github.com/mklement0/7436c9e4b2f73d7256498f959f0d5a7c/raw/Add-NuGetType.ps1 | iex |
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
<# | |
Prerequisites: PowerShell v5.1 and above (verified; may also work in earlier versions) | |
License: MIT | |
Author: Michael Klement <[email protected]> | |
DOWNLOAD and DEFINITION OF THE FUNCTION: | |
irm https://gist.github.com/mklement0/880624fd665073bb439dfff5d71da886/raw/Show-Help.ps1 | iex |
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
<# | |
License: MIT | |
Author: Michael Klement <[email protected]> | |
See https://stackoverflow.com/a/67266971/45375 for more information. | |
#> | |
# The printable characters to respond to. |
NewerOlder