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
# WSL2 network port forwarding script v1 | |
# for enable script, 'Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser' in Powershell, | |
# for delete exist rules and ports use 'delete' as parameter, for show ports use 'list' as parameter. | |
# written by Daehyuk Ahn, Aug-1-2020 | |
# Display all portproxy information | |
If ($Args[0] -eq "list") { | |
netsh interface portproxy show v4tov4; | |
exit; | |
} |
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
#!/usr/bin/env zsh | |
# Drop in xclip replacement for WSL | |
builtin emulate zsh -L | |
zparseopts -E -D -- {-help,h}=OPT_HELP {i,-in}=OPT_IN {o,-o}=OPT_OUT | |
local cmd=${0} | |
function xclip-help() |
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.Diagnostics; | |
using System.Runtime.InteropServices; | |
using System.Windows; | |
using System.Windows.Interop; | |
using System.Windows.Media; | |
public static class DisplayManager | |
{ |
I've been using Windows Terminal since the source code was released, and now that we have support for split panes, I wanted a way to easily create a tab with three panes (one for each version of PowerShell I want to test against).
Unfortunately, there's no support for opening tabs from the command-line yet, nor is there any support yet for specifying which profile to use in a new split terminal. There are open issues for those features, but although I've done a PR or two for it, I didn't think it would be an easy thing to pull together, but I knew that new tabs use the default profile.
Switching the default profile and then creating a new split with the hotkeys works great,
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 Show-JsonTreeView { | |
param ( | |
[Parameter(Mandatory)] | |
$Json | |
) | |
function Show-jsonTreeView_psf { | |
#---------------------------------------------- |
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
/** | |
* Builds css calc function expression literal for css property value. | |
* Gives ability to drop in variables at the cost of escaping operators, or | |
* get both with format string | |
*/ | |
calc() | |
unless length(arguments) > 0 | |
error('Calc wrapper requires at least one syntax element in `arguments`.') | |
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
// Type definitions for Opera Browser `opera` global object | |
// Because why not | |
// Definitions by: disk0 <https://github.com/disco0> | |
// This definition is based on various external documentation pages online | |
// https://web.archive.org/save/http://www.howtocreate.co.uk/operaStuff/operaObject.html | |
/** | |
* Opera browser specific global `opera` object. | |
*/ | |
declare interface OperaObject |
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
///<reference lib="dom"/> | |
//#region Implementation | |
type FieldType<Field> = | |
's' extends Field ? string : | |
'f' extends Field ? number : | |
'i' extends Field ? number : | |
'd' extends Field ? number : | |
'o' extends Field ? HTMLElement : |
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
// Don't ask about this one. I have no idea what this magic is. | |
// Copied from https://github.com/microsoft/TypeScript/issues/13298#issuecomment-724542300. | |
type UnionToIntersection<U> = | |
(U extends any ? (arg: U) => any : never) extends (arg: infer I) => void | |
? I | |
: never; | |
// Continuation of above. | |
type UnionToTuple<T> = | |
UnionToIntersection<(T extends any ? (t: T) => T : never)> extends (_: any) => infer W |