Skip to content

Instantly share code, notes, and snippets.

@tusharsnx
tusharsnx / tuple-of.ts
Created June 11, 2022 07:58
generate tuple of primitive-types from tuple of literal-types
type TypeOfLiteral<T> = T extends string
? string
: T extends number
? number
: T extends boolean
? boolean
: T extends bigint
? bigint
: T extends Symbol
? Symbol
@tusharsnx
tusharsnx / forward-wsl.ps1
Last active June 26, 2022 09:14
port forwarding to access wsl localhost from windows
# credit: https://github.com/edwindijas
$remoteport = bash.exe -c "ip a s eth0 | grep 'inet '"
$found = $remoteport -match '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}';
if( $found ){
$remoteport = $matches[0];
} else{
echo "The Script Exited, the ip address of WSL 2 cannot be found";
exit;