Skip to content

Instantly share code, notes, and snippets.

View guissalustiano's full-sized avatar
🧙‍♂️
wizard trainee

Guilherme Salustiano guissalustiano

🧙‍♂️
wizard trainee
View GitHub Profile
@guissalustiano
guissalustiano / test_numerico.py
Created January 27, 2022 11:21
Testes para o EP1 de numerico da Comp EPUSP
import numpy as np
from numpy import isclose
from ex1 import eig_pot
from ex2 import crit_sassenfeld, solve_sor, eig_potinv
def assertVector(a, b, **kwargs):
for exp, act in zip(a, b):
assert isclose(exp, act, **kwargs)
import numpy as np
from math import ceil
from sympy import Symbol
from prettytable import PrettyTable
# [a0, a1, a2, ...]
k = Symbol('k')
# coef = [1, 2, 3, 4, 5]
coef = [1, 8, 32, k]
@guissalustiano
guissalustiano / copy-of-atividademapreduce-1.ipynb
Last active July 25, 2023 23:26
AtividadeMapReduce-1.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# Based in https://github.com/cuducos/chunk
from asyncio import Semaphore, gather, run
import httpx
from loguru import logger
url = "https://dadosabertos.rfb.gov.br/CNPJ/Empresas1.zip"
default_chunk_size = 2**20 # 1MB
# DefaultMaxRetries sets the maximum download attempt for each chunk
@guissalustiano
guissalustiano / chunkedBy.kt
Last active January 8, 2024 16:01
Naive `Iterable<T>.chunkedBy` implemention to Kotlin
inline fun <T> Iterable<T>.chunkedBy(
predicate: (T) -> Boolean
): List<List<T>> {
val iterator = this.iterator()
if (!iterator.hasNext()) {
return emptyList()
}
var lastElem = iterator.next()
var lastList = mutableListOf(lastElem)
@guissalustiano
guissalustiano / gtag.diff
Last active May 10, 2024 21:30
Add google analytics 4 (gtag) in liveview
diff --git a/assets/js/app.js b/assets/js/app.js
index ad4168c..74b2716 100644
--- a/assets/js/app.js
+++ b/assets/js/app.js
@@ -32,7 +32,20 @@ let liveSocket = new LiveSocket("/live", Socket, {
// Show progress bar on live navigation and form submits
topbar.config({barColors: {0: "#29d"}, shadowColor: "rgba(0, 0, 0, .3)"})
window.addEventListener("phx:page-loading-start", _info => topbar.show(300))
-window.addEventListener("phx:page-loading-stop", _info => topbar.hide())
+window.addEventListener("phx:page-loading-stop", info => {