Skip to content

Instantly share code, notes, and snippets.

View SilvaEmerson's full-sized avatar
🏠
Working from home

Émerson Silva SilvaEmerson

🏠
Working from home
View GitHub Profile
@SilvaEmerson
SilvaEmerson / goodstein_sequence.jl
Last active December 17, 2023 18:54
A script which creates a Goodsten Sequence until 50th term
# Ref.: https://en.wikipedia.org/wiki/Goodstein%27s_theorem#Goodstein_sequences
@kwdef struct GoodsteinTerm
coefficient::Int
base::Int
exp::Int
value::Function = () -> coefficient * base ^ exp
end
function factorize(n::Int, base::Int, tmp_arr=[])
@SilvaEmerson
SilvaEmerson / ushallnotpass
Last active October 21, 2021 22:50
My Pi-hole sites blacklist
0koryu0.easter.ne.jp
109-204-26-16.netconnexion.managedbroadband.co.uk
1866809.securefastserver.com
2amsports.com
4dexports.com
50efa6486f1ef.skydivesolutions.be
61kx.uk-insolvencydirect.com
6b8a953b2bf7788063d5-6e453f33ecbb90f11a62a5c376375af3.r71.cf5.rackcdn.com
97b1c56132dfcdd90f93-0c5c8388c0a5897e648f883e2c86dc72.r54.cf5.rackcdn.com
999fitness.com
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@SilvaEmerson
SilvaEmerson / Julia lang - From Zero to Hero - Otsu Image Segmentation Method Implementation.ipynb
Last active September 5, 2023 19:10
Otsu Image Segmentation Method - Julia Implementation
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
def split_by_comma(fn):
def wrapper(sentence):
return fn(sentence).split(',')
return wrapper
@split_by_comma
def transform_content(content):
return content.swapcase()
@SilvaEmerson
SilvaEmerson / split_hof.py
Created June 5, 2019 11:41
Split function HOFed
def split_by(character):
return lambda content: content.split(character)
split_by_comma = split_by(', ')
split_by_comma('This, Is, A, Content, Example')
#result:
#['This', 'Is', 'A', 'Content', 'Example']

Usage

trans_func = {('q0', 'a,b') : 'q1',
	      ('q1','a,b'): 'q0'}

final_state = automata(organize_func(trans_func), 'aabb')
is_aceppeted(['q0'], final_state)
@SilvaEmerson
SilvaEmerson / LICA_ASCII
Last active May 25, 2019 23:52
LICA Custom virtualenv
____________________________
___ /____ _/_ ____/__ |
__ / __ / _ / __ /| |
_ /____/ / / /___ _ ___ |
/_____/___/ \____/ /_/ |_|
"""
Stratified K-Fold implementation
"""
def stratified_k_fold(arr, k=None, class_ratio=.5):
if k == None:
return None
number_elements_fold = len(arr) // k
folds = [[]] * k
import time
import random
comparison_num = 0
class Quick(object):
def particao(self, a, ini, fim):
global comparison_num
comparison_num += 1
pivo = a[fim-1]