Skip to content

Instantly share code, notes, and snippets.

View gabrielkirsten's full-sized avatar
🟪

Gabriel Kirsten Menezes gabrielkirsten

🟪
View GitHub Profile
@gabrielkirsten
gabrielkirsten / loan.sol
Last active April 22, 2021 21:13
POC loan (solidity)
pragma solidity >=0.7.0 <0.9.0;
contract loan {
address payable lender;
address payable borrower;
uint totalcents;
uint payed;
uint interest;
suspend fun addTen(n: Int): Int {
delay(1000)
return n + 10
}
public final class MainKt {
public static final void main();
public static void main(java.lang.String[]);
public static final java.lang.Object addTen(int, kotlin.coroutines.Continuation<? super java.lang.Integer>);
}
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: {
interface Continuation<in T> {
val context: CoroutineContext
fun resumeWith(result: Result<T>)
}
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")
@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")
}
@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 / 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 / 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