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
#!/bin/bash | |
# Bridge two network interfaces together | |
ip_address="192.168.2.1" | |
netmask="255.255.255.0" | |
dhcp_range_start="192.168.2.2" | |
dhcp_range_end="192.168.2.100" | |
dhcp_time="12h" | |
ifaceA="eth0" |
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
type Head<T extends any[]> = | |
T extends [any, ...any[]] | |
? T[0] | |
: never | |
type Tail<T extends any[]> = | |
((...t: T) => any) extends ((_: any, ...tail: infer TT) => any) | |
? TT | |
: [] |
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
type Head<T extends any[]> = | |
T extends [any, ...any[]] | |
? T[0] | |
: never | |
type Tail<T extends any[]> = | |
((...t: T) => any) extends ((_: any, ...tail: infer TT) => any) | |
? TT | |
: [] |
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
type Head<T extends any[]> = | |
T extends [any, ...any[]] | |
? T[0] | |
: never | |
type Tail<T extends any[]> = | |
((...t: T) => any) extends ((_: any, ...tail: infer TT) => any) | |
? TT | |
: [] |
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
type Head<T extends any[]> = | |
T extends [any, ...any[]] | |
? T[0] | |
: never | |
type Tail<T extends any[]> = | |
((...t: T) => any) extends ((_: any, ...tail: infer TT) => any) | |
? TT | |
: [] |
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
type Head<T extends any[]> = | |
T extends [any, ...any[]] | |
? T[0] | |
: never | |
type Tail<T extends any[]> = | |
((...t: T) => any) extends ((_: any, ...tail: infer TT) => any) | |
? TT | |
: [] |
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
type Head<T extends any[]> = | |
T extends [any, ...any[]] | |
? T[0] | |
: never | |
type Tail<T extends any[]> = | |
((...t: T) => any) extends ((_: any, ...tail: infer TT) => any) | |
? TT | |
: [] |
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
declare function curry<F extends (...args: any) => any>(f: F): void | |
class Test { | |
a?: string | |
b?: object | |
c?: number | |
d?: [string, Test] | |
e?: [object, Test] | |
f?: [number, Test] |
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
import {Object, Tuple, Number} from 'ts-toolbelt' | |
// Merge two types together | |
type merge = Object.MergeUp<{name: string}, {age?: number}> | |
// Update the type of a field | |
type update = Object.Update<{age: string}, 'age', number> | |
// Make some fields optional | |
type optional = Object.Optional<{name: string, age: number}, 'age'> |
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
import {Any, Number} from 'ts-toolbelt' | |
/** 512000 Minus Operations | |
* 80 * 80 * 80 Operations | |
* ~ 10 240 000 Iterations | |
* ~ 1.30sec | |
* @ 3.80GHz | |
* typescript@3.8.0 | |
*/ | |
type test = NestNestTest<'-20'> // 1.3s |
OlderNewer