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
#if !NET7_0_OR_GREATER | |
namespace System.Runtime.CompilerServices | |
{ | |
/// <summary/> | |
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = false)] | |
internal sealed class RequiredMemberAttribute : Attribute | |
{ } | |
/// <summary/> |
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
# This is to replace PowerShell's 'cat' with 'bat'. Install from here: https://github.com/sharkdp/bat | |
# | |
# This code goes into my $profile. If you put this into a separate file, you will need to dot source | |
# that file so that the function shows up in the global namespace. I only replace the cat alias, | |
# so Get-Content still performs its standard behavior. | |
# | |
# I use a pipeline to capture all the file content (so you can do things like `dir *.ps1 | cat` as well | |
# as `cat *.ps1`). If there's a single file, then the contents are displayed raw; if there are multiple files, | |
# then it uses bat's header to discriminate the content of multiple files from each other. I also replicated | |
# a few of the more common (for me) command line switches that I'd want to use to influence bat's behavior, |
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( | |
[Parameter(ValueFromPipeline)]$values, | |
[switch]$All | |
) | |
# It's worth noting that this script is useful for me, because I speak English. So I show all audio | |
# tracks and just the English subtitle tracks, and just make note when one of my rips includes non- | |
# English subtitle tracks (usually indicting I forgot to reduce the things I ripped). | |
# | |
# This is a pipeline-compatible script, so my usage is typically: |
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.Collections.Generic; | |
using System.Diagnostics.CodeAnalysis; | |
using System.Threading.Tasks; | |
internal static class EnumerableExtensions | |
{ | |
public static IAsyncEnumerable<T>? ToAsyncEnumerable<T>(IEnumerable<T>? data) => | |
data == null ? null : ToAsyncEnumerableImpl(data); | |
async static IAsyncEnumerable<T> ToAsyncEnumerableImpl<T>(IEnumerable<T> data) |
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.Collections.Generic; | |
using System.Linq; | |
using BenchmarkDotNet.Attributes; | |
using BenchmarkDotNet.Engines; | |
using BenchmarkDotNet.Running; | |
public static class EnumerableExtensions | |
{ | |
static readonly Func<object, bool> notNullTest = x => x is not 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
Windows Registry Editor Version 5.00 | |
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters] | |
"DisabledComponents"=dword:000000ff |
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
pre, | |
pre code, | |
.blob-code, | |
.blob-code-content, | |
.blob-code-marker, | |
.cm-editor .cm-line, | |
.react-blob-print-hide, | |
.react-code-text { | |
font-family: 'MonaspiceNe NFM', monospace !important; | |
} |
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( | |
[string] $Folder = ".", | |
[string] $Filter = "*.*" | |
) | |
Get-ChildItem -Path $Folder -Recurse -File -Filter $Filter -Exclude @('obj','bin') | Foreach-Object { | |
$contents = [System.IO.File]::ReadAllBytes($_.FullName) | |
if ($contents.Length -gt 2 -and $contents[0] -eq 0xEF -and $contents[1] -eq 0xBB -and $contents[2] -eq 0xBF) { | |
Write-Host $_.FullName | |
[System.IO.File]::WriteAllBytes($_.FullName, $bytes[3..$($bytes.Length)]) |
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 SampleTests | |
{ | |
public bool SomeCondition => ...; | |
[Fact] | |
public void MySkipWhen() | |
{ | |
Assert.SkipWhen(SomeCondition, "This is dynamically skipped when SomeCondition is true"); | |
} |
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
{ | |
"$help": "https://aka.ms/terminal-documentation", | |
"$schema": "https://aka.ms/terminal-profiles-schema", | |
"actions": [ | |
{ | |
"command": "copy", | |
"keys": "ctrl+shift+c" | |
}, | |
{ | |
"command": "paste", |
NewerOlder