Skip to content

Instantly share code, notes, and snippets.

View vit0rr's full-sized avatar

vitor vit0rr

View GitHub Profile
module type T = sig
module type S
end
module T = struct
module type S = T
end
module type K_Bool = functor (X : T) (Y : T) -> T
@Grubba27
Grubba27 / cripto.go
Created June 21, 2023 20:31
Generate public address using message and private from metamask
package cripto
import (
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/crypto"
)
// from: https://gist.github.com/dcb9/385631846097e1f59e3cba3b1d42f3ed#file-eth_sign_verify-go
func VerifySig(from, sigHex string, msg []byte) bool {
@Grubba27
Grubba27 / get_url_params.ts
Created January 30, 2023 21:09
Get url params
type GetParams<
Text extends string,
Result extends string = ''
> =
Text extends `${ infer L }${ infer R }`
? L extends '/'
? Result
: GetParams<R, `${ Result }${ L }`>
: Result

Como Pensar

Ler e entender um pouco desse artigo. https://wiki.c2.com/?FeynmanAlgorithm

  • Reconhecer como você pensa
  • Descrever métodos que você usa para pensar
  • Entender métodos diferentes de pensar
  • Fazer perguntas sobre tudo(incluindo sobre perguntas)

Perguntas

type Eq<A, B> = <X>(a: A, eq: (x: A & B) => X) => X;
const refute = (x: never) => x;
const refl = <A, X>(a: A, eq: (x: A) => X) => eq(a);
const sickos = <A>(x: A, eq: Eq<A, number>) => eq(x, (x) => x);
const two = sickos(2, refl);
type Ty<A> =
| { tag: "number"; eq: Eq<A, number> }
| { tag: "string"; eq: Eq<A, string> };

Roadmap de estudos de SQL

Aviso: Muitas vezes detalhes de várias operações podem variar de banco para banco. Em questões onde fiquei em dúvida, este documento segue o funcionamento do PostgreSQL, pois é o banco que conheço melhor.

Pré-requisito: Álgebra Relacional básica

Antes de começar a escrever SQL, você precisa entender o modelo de como um banco de dados relacional funciona. Não precisa se aprofundar muito, mas você precisa entender como que dados e relacionamentos entre eles são representados. (Nota importante: Relacionamento e relação não são a

@Grubba27
Grubba27 / calculator.ts
Created May 5, 2022 21:10
Simple calculator made in ts
type Reverse<A> =
`${A}` extends `${infer AH}${infer AT}`
? `${Reverse<AT>}${AH}` : A
type Digs = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
type DigsNext<I = Digs, R = {}> =
I extends [infer Head, infer Next, ...infer Tail]
? DigsNext<[Next, ...Tail], R & Record<Head, Next>>
: { [K in keyof R]: R[K] }
@Grubba27
Grubba27 / fizzbuzz.ts
Created April 20, 2022 01:13
FizzBuzz made in typelevel
type Reverse<A> =
`${A}` extends `${infer AH}${infer AT}`
? `${Reverse<AT>}${AH}` : A
type Digs = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
type DigsNext<I = Digs, R = {}> =
I extends [infer Head, infer Next, ...infer Tail]
// based on https://github.com/vit0rr/jogo-da-adivinhacao
//extern crate rand;
//use rand::Rng;
use std::cmp::Ordering;
use std::io;
fn read_guess() -> u32 {
return loop {
let mut guess = String::new();