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
#![feature(const_trait_impl)] | |
fn extend_lifetime(x: &str) -> &'static str { | |
f::<S>(x) | |
} | |
const fn f<'a, T: Tr<'a> + ~const Drop>(x: &'a str) -> T::Ty { | |
// can call g with T: Drop bound, even though | |
// T: ~const Drop works for non-Drop-implementing types | |
g::<T>(x) |
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 StrLen<T extends string, R extends Array<string> = []> = T extends `${infer C}${infer P}` | |
? StrLen<P, [...R, C]> | |
: R['length'] | |
type StrSplit<T extends string, S extends string, R extends Array<string> = []> = T extends `${infer X}${S}${infer Y}` | |
? StrSplit<Y, S, StrLen<X> extends 0 ? R : [...R, X]> | |
: StrLen<T> extends 0 | |
? R | |
: [...R, T] |
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
# https://serverfault.com/questions/57529/how-do-i-get-the-md5-of-a-file-on-windows | |
CertUtil -hashfile yourFileName MD5 |
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
https://clients2.google.com/service/update2/crx?response=redirect&os=win&arch=x64&os_arch=x86_64&nacl_arch=x86-64&prod=chromiumcrx&prodchannel=beta&prodversion=79.0.3945.53&lang=ru&acceptformat=crx3&x=id%3D<ID>%26installsource%3Dondemand%26uc |
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 $env:USERPROFILE\.ssh\id_rsa.pub | ssh {IP-ADDRESS-OR-FQDN} "cat >> .ssh/authorized_keys" |
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
# Mac | |
NODE_OPTIONS="--openssl-legacy-provider" | |
# Windows ps | |
$env:NODE_OPTIONS="--openssl-legacy-provider" |
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
{ | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"name": "Example", | |
"type": "node", | |
"request": "launch", | |
"runtimeExecutable": "node", | |
"runtimeArgs": ["--nolazy", "-r", "ts-node/register/transpile-only"], |
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 Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false | |
// 条件判断 | |
type If<C extends boolean, T, F> = C extends true ? T : F | |
// 获取类型数组最后一个类型 | |
type LastEl<T extends string[]> = T extends [...infer _P, infer K] ? K : never | |
// 合法数字表达集合 |
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
mod test; | |
use std::{ | |
cell::RefCell, | |
collections::{hash_map::Entry, HashMap}, | |
fmt::{self, Debug}, | |
rc::Rc, | |
}; | |
#[derive(Debug)] |
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
#![allow(unused)] | |
pub fn add_big_num(num_1: &str, num_2: &str) -> String { | |
let to_u8_arr = |num: &str| { | |
num.split("") | |
.filter(|&n| !n.is_empty()) | |
.map(|n| n.parse::<u8>().unwrap()) | |
.collect::<Vec<_>>() | |
}; |
NewerOlder