Skip to content

Instantly share code, notes, and snippets.

View gabrielkirsten's full-sized avatar
🟪

Gabriel Kirsten Menezes gabrielkirsten

🟪
View GitHub Profile
for i in range(nb_epochs):
np.random.shufle(data)
for example in data:
params_grad = evaluete_gradient(loss_function, example, params)
params = params - learning_rate * params_grad
@gabrielkirsten
gabrielkirsten / sgd-mini-batch.py
Created February 17, 2019 22:08
SGD mini batch
for i in range(nb_epochs):
np.random.shufle(data)
for example in get(batches(data, batch_size=50):
params_grad = evaluate_gradient(loss_function, batch, params)
params = params - learning_rate * params_grad
@gabrielkirsten
gabrielkirsten / docker-helper.sh
Last active June 27, 2019 12:17
Docker helper
###############################
Install Docker
###############################
# get a docker instalation script
curl -fsSL https://get.docker.com -o get-docker.sh
# execute the instalation script
sudo sh get-docker.sh
@gabrielkirsten
gabrielkirsten / instalacao_docker_ubuntu.sh
Last active July 14, 2019 20:34
Script de instalação do Docker para Ubuntu
################################
# Instalação do Docker no Ubuntu
################################
# Verificar a versão do sistema
lsb_release -a
# Obter o script de isntação oficial do Docker
curl -fsSL https://get.docker.com -o get-docker.sh
@gabrielkirsten
gabrielkirsten / test.json
Created February 5, 2020 14:52
swagger example
{
"swagger": "2.0",
"info": {
"description": "Hello, This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.",
"version": "1.0.0",
"title": "Swagger Petstore",
"termsOfService": "http://swagger.io/terms/",
"contact": {
"email": "[email protected]"
},
@gabrielkirsten
gabrielkirsten / swagger.json
Last active February 11, 2020 13:53
swagger wallet
{
"swagger": "2.0",
"info": {
"description": "MovilePay Wallet API",
"version": "1.0.0",
"title": "MovilePay API"
},
"host": "internal-abc2a9727492711eab43e028429ac920-2080467542.sa-east-1.elb.amazonaws.com",
"basePath": "/v1",
"tags": [
@gabrielkirsten
gabrielkirsten / kotlin_thread_example.kt
Created June 21, 2020 21:48
Example Kotlin Thread
import kotlin.system.*
fun main() {
val executionTime = measureTimeMillis {
val task1 = addTen(1)
val task2 = addTen(2)
println("async task 1: ${task1}")
println("async task 2: ${task2}")
}
println("execution time: [$executionTime] ms")
}
import kotlinx.coroutines.*
import kotlin.system.*
fun main() = runBlocking {
val executionTime = measureTimeMillis {
val asyncTask1 = async{addTen(1)}
val asyncTask2 = async{addTen(2)}
println("task 1: ${asyncTask1.await()}")
println("task 2: ${asyncTask2.await()}")
}
println("execution time: [$executionTime] ms")
interface Continuation<in T> {
val context: CoroutineContext
fun resumeWith(result: Result<T>)
}
public static final Object addTen(int n, Continuation continuation) {
switch (continuation.label) {
case 0: {
continuation.n = n;
continuation.label = 1;
if (delay(1000L, continuation) == COROUTINE_SUSPENDED)
return COROUTINE_SUSPENDED;
}
case 1: {