This file contains hidden or 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
Write-Host "ConsoleColor.Black:`t" -NoNewline; Write-Host "TESTING" -ForegroundColor Black | |
"x1b[30m:`t`t`e[30mTESTING`e[0m" | |
Write-Host "ConsoleColor.Gray:`t" -NoNewline; Write-Host "TESTING" -ForegroundColor Gray | |
"x1b[37m:`t`t`e[37mTESTING`e[0m" | |
Write-Host "ConsoleColor.Red:`t" -NoNewline; Write-Host "TESTING" -ForegroundColor Red | |
"x1b[91m:`t`t`e[91mTESTING`e[0m" | |
Write-Host "ConsoleColor.Green:`t" -NoNewline; Write-Host "TESTING" -ForegroundColor Green |
This file contains hidden or 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.Collections.Generic; | |
using System.Management.Automation; | |
public class RunspaceSynchronizer | |
{ | |
public static bool SourceActionEnabled = false; | |
private static bool TargetActionEnabled = false; | |
// 'moduleCache' keeps track of all modules imported in the source Runspace. |
This file contains hidden or 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 FindProxyForURL(url, host) { | |
if ( host == "www.msn.com" ) { | |
return "PROXY 10.10.10.10"; | |
} | |
else { | |
return "DIRECT"; | |
} | |
} |
This file contains hidden or 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; | |
// A test process that write stdout and stderr. | |
namespace ConsoleApp { | |
public class Outter { | |
private static string[] outputs = new string[] { "Hello world", | |
"This is me", | |
"I'm here", | |
"You are awesome", | |
"Me too", |
This file contains hidden or 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 Add-LinkElement | |
{ | |
param( | |
[Parameter(Mandatory=$true)] | |
[string]$csprojPath, | |
[Parameter(Mandatory=$true)] | |
[string]$projectName, | |
[Parameter(Mandatory=$true)] |
This file contains hidden or 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
## A helper to check the memory limit of a PS remote session | |
function Consume-Memory | |
{ | |
## Get the total physical memory size | |
$totalPhysicalMem = get-ciminstance -class "cim_physicalmemory" | Measure-Object -Sum -Property Capacity | % Sum | |
Write-Host "Total Free Physical Memory: $($totalPhysicalMem / 1gb) GB" -ForegroundColor Green | |
## Create a two-dimensional array (20, N) | |
$array = @(,@(1)) * 20 |
This file contains hidden or 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 | |
param([string]$Path) | |
$Path = Resolve-Path $Path | % Path | |
function AnalyzeSelectObjectUsage | |
{ | |
param( | |
[Parameter(ValueFromPipelineByPropertyName)] |
This file contains hidden or 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 the diff content of a Github PR, and analyze if the diffs are only caused by the string replacement. | |
## [Interesting exercise] | |
## | |
param( | |
[Parameter(Mandatory=$true)] | |
[string] | |
$PRUrl, |