Skip to content

Instantly share code, notes, and snippets.

View Tsugami's full-sized avatar

Yslan Ramos Tsugami

  • Brazil
  • 17:13 (UTC -03:00)
View GitHub Profile
import { useCallback, useEffect, useMemo, useReducer } from 'react';
import { io, Socket } from 'socket.io-client';
export enum SocketStatus {
CONNECTING = 'CONNECTING',
CONNECTED = 'CONNECTED',
DISCONNECTED = 'DISCONNECTED',
ERROR = 'ERROR',
RECONNECT = 'RECONNECT',
CONNECT_ERROR = 'CONNECT_ERROR',
@Tsugami
Tsugami / .prettierrc
Created May 14, 2022 14:06
Setup my prettier config
{
"semi": true,
"tabWidth": 2,
"useTabs": false,
"printWidth": 100,
"singleQuote": true,
"trailingComma": "all",
"jsxSingleQuote": true,
"jsxBracketSameLine": true,
"arrowParens": "always",
@Tsugami
Tsugami / README.md
Last active June 3, 2022 19:35
Change MHFrontier hosts Batch file

Batch file to update the hosts file with MHF addresses

How to use:

  1. Copy this file to your machine
  2. open cmd in the folder you pasted the file
  3. Run the below command in cmd to setup your a server
setup.bat 26.220.184.112 pewpewdojo-server
@Tsugami
Tsugami / binary-tree-type.ts
Created June 13, 2022 21:33
binary tree in typescript type system
type Equal<L, R> = L extends R ? true : false;
type GreaterThan<L, R, C extends number[] = []> = L extends R
? false
: C["length"] extends L
? false
: C["length"] extends R
? true
: GreaterThan<L, R, [...C, 1]>;
interface INode<V extends number | null, L, R> {
Write-Output "Teste teste" >> teste.txt
function Write-Log {
param(
[Parameter()]
[ValidateNotNullOrEmpty()]
[string]$Message,
[Parameter()]
[ValidateNotNullOrEmpty()]
[ValidateSet("Info", 'Warn', 'Error', 'Success')]
[string]$Type = 'Info'
@Tsugami
Tsugami / install.ps1
Created June 17, 2022 06:39
Powershell script to download and unzip a github repository
function Download-File {
param (
[string]$Url,
[string]$File
)
Write-Host "Downloading $Url to $File"
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-WebRequest -Uri $url -OutFile $File
}
@Tsugami
Tsugami / bot.rs
Last active June 29, 2022 21:34
events in poise
use poise::serenity_prelude::{self as serenity};
extern crate dotenv;
use dotenv::dotenv;
struct Data {}
type Error = Box<dyn std::error::Error + Send + Sync>;
type Context<'a> = poise::Context<'a, Data, Error>;
// Atividade 1 do livro - Pg126
// O problema consiste em elaborar um cadastro para 20 livros, contendo as seguintes informações: código, título, autor, área, ano e editora. Desenvolver um menu com as seguintes opções:
// 1. Cadastrar os livros.
// 2. Imprimir as informações dos livros.
// 3. Pesquisar livros por código.
// 4. Ordenar os livros por ano.
// 5. Sair do programa.
// No Quadro 11, temos o programa para o problema descrito. Na solução, empregamos o conceito de struct para criar a ficha do livro, vetor de struct para armazenar as informações dos 20 livros,
// o método de pesquisa sequencial para efetuar a busca de um livro por código e o método de ordenação da bolha para classificar os livros de acordo com o ano.