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
# Add this snippet to your $PROFILE to make Bash's autocompletion available to PowerShell on Linux. | |
# Warning: adds ~500ms initialization time. | |
# References: https://brbsix.github.io/2015/11/29/accessing-tab-completion-programmatically-in-bash/ | |
# https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/register-argumentcompleter | |
# Find all commands | |
$commands = bash -c 'source /usr/share/bash-completion/bash_completion && complete' | awk '{ print $NF }' | |
$commands += ls /usr/share/bash-completion/completions | |
$commands | ForEach-Object { |
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
param( | |
[Parameter(Mandatory)] [string] $Command, | |
[Parameter(Mandatory)] [string] $IconFile, | |
[string] $Output, | |
[switch] $Keep | |
) | |
(Get-Content -Encoding UTF8 template.c) -replace "COMMAND_PLACEHOLDER", ($Command -replace '\\', '\\') | Out-File -Encoding UTF8 temp.c | |
"icon ICON `"$($IconFile -replace '\\', '\\')`"" | Out-File -Encoding UTF8 temp.rc |
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
public class DynamicJsonConverter : JsonConverter<dynamic> | |
{ | |
public override dynamic Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) | |
{ | |
if (reader.TokenType == JsonTokenType.True) | |
{ | |
return 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
public class SandBox | |
{ | |
private ScriptState<object> _globalState; | |
public SandBox() | |
{ | |
// Create initial script | |
var script = CSharpScript.Create(string.Empty, ScriptOptions.Default); | |
{ | |
// Create an empty state |