Skip to content

Instantly share code, notes, and snippets.

View macabeus's full-sized avatar
:octocat:
⁽⁽٩(๑˃̶͈̀ ᗨ ˂̶͈́)۶⁾⁾

Bruno Macabeus macabeus

:octocat:
⁽⁽٩(๑˃̶͈̀ ᗨ ˂̶͈́)۶⁾⁾
View GitHub Profile
// This file is automatically generated.
// Please do not change this file!
type Message0<T extends MessagesKey0> = {
id: T
value: T
attributes: Record<string, T>
}
type Message1<T extends MessagesKey1> = {
@macabeus
macabeus / biggest-sequence.js
Last active November 13, 2019 00:01
This algorithm returns the biggest sequence from an array that repeats at least two times.
/**
* This algorithm returns the biggest sequence from an array that repeats at least two times.
*
* Example:
* - [1, 1, 2, 2, 1, 1] -> ['1,1', 2]
* - [1, 1, 1, 1, 1, 1, 1, 1] -> ['1,1,1,1,1,1,1', 2]
* - [1, 1, 1, 1, 2, 1, 1, 1, 2, 2, 2, 4, 5, 5, 5] -> ['1,1,1,2', 2]
*
* The idea is very simple:
* - firstly, we should split the array on all subsequences with at least two elements;
const Jimp = require('jimp')
const { drop, splitEvery } = require('ramda')
const binary = require('binary') // fiquei em duvida entre ela e a qunpack
const fs = require('fs')
const data = drop(3, fs.readFileSync('dump/level-1/tilemap'))
// const data = drop(3, fs.readFileSync('dump/level-2/tilemap'))
const globalOam = splitEvery(44, fs.readFileSync('dump/level-1/global-oam'))
const objectsPos = []
@macabeus
macabeus / test
Last active November 29, 2018 13:20
foo
bar
baz
@macabeus
macabeus / hangman.rs
Created November 3, 2018 22:11
A simple hangman game written in Rust
// cargo-deps: rand="0.5.5"
extern crate rand;
use std::io;
use std::collections::HashSet;
use rand::Rng;
use std::iter::FromIterator;
struct State {
life: i8,
@macabeus
macabeus / hangman.hs
Created September 2, 2018 15:01
Hangman game written in Haskell
import qualified Data.Set as Set
import Data.Random
import Data.Random.Extras
data State = State { word :: String, typed :: [Char] }
randomWords :: [String]
randomWords = ["banana", "uva", "abacaxi"]
getRandomWord :: IO String
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Regras Resumidas:
1 - Este é o grupo oficial (sério) gerido pelos membros do CA.
Não é permitido tópicos fora desse escopo:
1.1 - Informes, avisos, eventos da área, links de video aulas, cursos online, certificações, produtos/curso da área em promoções, link de matérias do curso ou pertinentes ao mesmo.
1.2 - Dúvidas ou questionamentos sejam sobre professores, disciplinas do curso, relatos de experiências no mesmo. Mas não fugindo do limite sobre falar algo pertinente e falar algo fora do contexto.
1.3 - Outras coisas relevantes, tudo com o bom e velho bom senso sobre o que vai compartilhar.
1.4 - Compartilhamento de videos permitido se for algo pertinente ao curso.(Recomendado links)
2 - Não uso de memes (mesmo que seja de professor).
3 - Proibido comentários racistas, homofóbicos, sexistas, condição social, etc.
4 - Discussão sobre política, religião, futebol.
# Download of captcha's image: https://www.dropbox.com/s/6dbo7k4vuqlqiqr/captchar.zip
# Post in my blog about this code (in Brazillian Portuguese): http://localhost:8000/output/estudo-de-caso-quebrando-um-captcha.html
import copy
import numpy as np
import cv2 as cv
import pyslibtesseract
tesseract_config = pyslibtesseract.TesseractConfig(psm=pyslibtesseract.PageSegMode.PSM_SINGLE_CHAR)
tesseract_config.add_variable('tessedit_char_whitelist', 'QWERTYUIOPASDFGHJKLZXCVBNM')
@macabeus
macabeus / listClasses.swift
Last active November 13, 2023 23:21
List all classes that subscribe a protocol
// Many thanks to Code Different: http://stackoverflow.com/a/42749141/3440266
import Foundation
struct ClassInfo : CustomStringConvertible, Equatable {
let classObject: AnyClass
let classNameFull: String
let className: String
init?(_ classObject: AnyClass?) {
guard classObject != nil else { return nil }