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
<Query Kind="Program"> | |
<Reference><RuntimeDirectory>\System.Messaging.dll</Reference> | |
<Reference><RuntimeDirectory>\System.DirectoryServices.dll</Reference> | |
<Reference><RuntimeDirectory>\System.Configuration.Install.dll</Reference> | |
<Reference><RuntimeDirectory>\System.Windows.Forms.dll</Reference> | |
<Namespace>System.Messaging</Namespace> | |
</Query> | |
void Main() | |
{ |
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-StartProgram { | |
param([IO.FileInfo] $CsprojFile) | |
[xml]$projectXml = Get-Content $CsprojFile.FullName | |
$ns = @{ defaultNamespace = "http://schemas.microsoft.com/developer/msbuild/2003" } | |
$configuration = $projectXml | | |
Select-Xml '//defaultNamespace:PropertyGroup/defaultNamespace:Configuration' -Namespace $ns | | |
select -ExpandProperty Node | | |
where { $_.Condition -and $_.Condition.Trim() -eq "'`$(Configuration)' == ''" } | |
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
# SplitFile.ps1 - Split large files for use with Kiwix | |
[CmdletBinding()] | |
param( | |
[Parameter(Mandatory = $true)] | |
[string]$Path, | |
[int] $ChunkSizeMb = 1024 | |
) |
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
public class ArtificialStackTraceException : Exception | |
{ | |
public ArtificialStackTraceException( | |
bool shouldIncludeFileInfo = true, | |
string message = "Artificial exception used to generate a stack trace." | |
) : base(message) | |
{ | |
var stackTrace = new System.Diagnostics.StackTrace(shouldIncludeFileInfo); | |
StackTrace = stackTrace.ToString(); | |
} |
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
cinst -y 7zip | |
cinst -7 googlechrome |
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
// Simple wrapper for the https://wzrd.in/ service so you can experiment with | |
// npm modules in the browser dev console | |
function require(moduleName, version) { | |
version = version || 'latest'; | |
let oldExports = window.exports; | |
window.exports = {}; | |
let oldModule = window.module; | |
window.module = { | |
exports: exports, |
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
@for /d %%d in (%~dp0\*) do @if exist "%%~fd\.git" mklink /d "%%~fd\packages" "..\packages" | |
@pause |
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
public class ProjectionEqualityComparer | |
{ | |
public static IEqualityComparer<T> Create<T, TProperty>(Func<T, TProperty> projection, IEqualityComparer<TProperty> propertyComparer = null) | |
where T: class | |
{ | |
return new ProjectionEqualityComparer<T, TProperty>(projection, propertyComparer); | |
} | |
} | |
public class ProjectionEqualityComparer<T,TProperty> : IEqualityComparer<T> where T: class |
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
^!r::Reload | |
RunOrRaise(caption) { | |
r := ComObjGet("winmgmts:") | |
.ExecQuery("SELECT Handle FROM Win32_Process WHERE Caption='" . caption . "'") | |
If r._NewEnum()[proc] | |
{ | |
;WinGet, windows, list | |
;Loop, %windows% |
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-DateRange { | |
param( | |
[Parameter(Mandatory = $true)] | |
[ValidateNotNull()] | |
[datetime] $StartDate, | |
$EndDate, | |
[timespan] $Duration, | |
[ValidateNotNull()] |