Skip to content

Instantly share code, notes, and snippets.

View RikoKami's full-sized avatar
:octocat:
I may be slow to respond.

William Dantas RikoKami

:octocat:
I may be slow to respond.
View GitHub Profile
@RikoKami
RikoKami / deeppick.ts
Created February 17, 2023 14:47
picking up the branches of an object
type ExtractKeys<T> = {
[K in keyof T & string]: T[K] extends any[]
? `${K}`
: T[K] extends object
?
`${K}` | `${K}.${ExtractKeys<T[K]>}`
: `${K}`;
}[keyof T & string];
type ExtractNonDateKeys<T> = {
@RikoKami
RikoKami / destroy_port.sh
Last active February 16, 2023 03:35
destroying ports in OS
# Windows
netstat -ano | findstr 8085
# Proto End Local End Externo Estado PID
TCP 0.0.0.0:8085 0.0.0.0:0 LISTENING 6000
TCP 127.0.0.0:8085 127.0.0.0:61588 CLOSE_WAIT 6000
TCP 127.0.0.0:8085 127.0.0.0:8085 FIN_WAIT_2 27340
TCP [::]:8085 [::]:0 LISTENING 6000
@RikoKami
RikoKami / zip.sh
Created February 1, 2023 17:59
Zipping and deleting folders recursively
# include with current commit filename
tar --exclude='*.git' --exclude='node_modules' -zcvf `git rev-parse HEAD`.tgz *
# simple
tar -zcvf filename.tgz *
@RikoKami
RikoKami / validateCpfOrCnpj.ts
Last active January 24, 2023 17:35
Validation of cpf and cnpj with formatting [typescript]
const regex = {
cnpj: /^(\d{2})(\d{3})?(\d{3})?(\d{4})?(\d{2})?$/u,
cpf: /^(\d{3})(\d{3})?(\d{3})?(\d{2})?$/u,
};
const replaceValue = {
cnpj: "$1.$2.$3/$4-$5",
cpf: "$1.$2.$3-$4",
};
@RikoKami
RikoKami / zshrc config.txt
Last active February 13, 2022 11:07
Zsh config && plugins
sudo apt install zsh
zsh --version
curl --version
sudo apt install curl
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
# selecione um tema legal aqui: https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
nano .zshrc
# trocar o ZSH_THEME="nomedotemaescolhido" salva, fecha e reinicia
sh -c "$(curl -fsSL https://raw.githubusercontent.com/zdharma/zinit/master/doc/install.sh)"
#or