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
# .SYNOPSIS | |
# Print a tree given a key property and parent property | |
# | |
# .PARAMETER InputObject | |
# | |
# The object to print. | |
# | |
# .PARAMETER KeyProperty |
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
param( | |
$etlFile = '.\perfviewdata.etl', | |
$scenario = 'echo 1', | |
$logFile = '.\perfview.log') | |
$perfViewArgs = @( | |
'/AcceptEula' | |
'/ThreadTime' | |
"/LogFile=$logFile" | |
"/DataFile:$etlFile" |
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
using System; | |
using System.Runtime.InteropServices; | |
using System.Reflection; | |
namespace App | |
{ | |
enum E1 : byte | |
{ | |
e1 = 5 | |
} |
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
using namespace System.Text.RegularExpressions | |
param([string[]]$extensions = 'ps1') | |
function Get-FileEncoding | |
{ | |
[CmdletBinding()] | |
param ( | |
[Parameter(Mandatory = $True, ValueFromPipelineByPropertyName = $True)] [string]$Path | |
) |
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
enum Color { Red; Green; Blue } | |
[System.Diagnostics.Tracing.EventSource(Name = "MyPSEventSource")] | |
class C : System.Diagnostics.Tracing.EventSource | |
{ | |
[System.Diagnostics.Tracing.Event(1)] | |
[void] SomeRandomEvent([string]$Message, [Color]$Color) | |
{ | |
$this.WriteEvent([int]1, [string]$Message, [int]$Color) |
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
[CmdletBinding(DefaultParameterSetName = 'FixedG')] | |
param( | |
[Parameter(ParameterSetName = 'FixedR', Mandatory)] | |
[ValidateRange(0, 255)] | |
$fixedR, | |
[Parameter(ParameterSetName = 'FixedG')] | |
[ValidateRange(0, 255)] | |
[int]$fixedG = 105, |
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
Add-Type @" | |
using System; | |
using System.Runtime.InteropServices; | |
public class NativeConsoleMethods | |
{ | |
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)] | |
public static extern IntPtr GetStdHandle(int handleId); |
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
using namespace System.Management.Automation.Language | |
function AnalyzeCurlUsage | |
{ | |
param([Parameter(ValueFromPipeline)][Alias('PSPath')][string]$path) | |
process { | |
$err = $null | |
$tokens = $null |
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
<Configuration> | |
<ViewDefinitions> | |
<View> | |
<Name>MatchInfo</Name> | |
<ViewSelectedBy> | |
<TypeName>Microsoft.PowerShell.Commands.MatchInfo</TypeName> | |
</ViewSelectedBy> | |
<CustomControl> | |
<CustomEntries> | |
<CustomEntry> |
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
<Configuration> | |
<ViewDefinitions> | |
<View> | |
<Name>Measure-Object-Output</Name> | |
<ViewSelectedBy> | |
<TypeName>Microsoft.PowerShell.Commands.GenericMeasureInfo</TypeName> | |
</ViewSelectedBy> | |
<ListControl> | |
<ListEntries> | |
<ListEntry> |