This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "context" | |
| "log" | |
| ) | |
| type Element[T any] interface{ element() } | |
| type Success[T any] struct { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| from keras import Layer, Model | |
| from sklearn.datasets import make_classification | |
| import keras | |
| from keras.src.layers import Dense, Input | |
| from sklearn.model_selection import GridSearchCV | |
| X, y = make_classification(10000, 20, n_informative=16, random_state=0) | |
| X = X.astype(np.float32) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import pandas as pd | |
| from matplotlib import pyplot as plt | |
| from sklearn.metrics import accuracy_score, precision_score | |
| from sklearn.model_selection import train_test_split | |
| from sklearn.tree import DecisionTreeClassifier | |
| from sklearn.naive_bayes import GaussianNB | |
| from sklearn.svm import SVC | |
| from sklearn.neighbors import KNeighborsClassifier |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val knownInvalidCpfs = | |
| (0..9) | |
| .map { i -> (1..11).map { i } } | |
| .map { it.joinToString("") } | |
| fun isValid(document: String): Boolean { | |
| if (document in knownInvalidCpfs) return false | |
| val numbers = document.mapNotNull { it.digitToIntOrNull() } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| POST /api/v1/payments | |
| { | |
| amount: { | |
| currency: BRL, | |
| value: 1000 // R$ 10,00 | |
| }, | |
| //more payment data depending on the payment type | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import library.* | |
| import library.headers.* | |
| import library.json.* | |
| class OrderControllerV1(repository: OrderRepository): | |
| @get( | |
| description = "Fetch user by id", | |
| path = "/api/v1/orders/{orderId}", | |
| produces = "application/json" | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| case class EdiLine(field1: String, field2: String, field3: String) | |
| object EdiLine { | |
| def fromLines(lines: List[String]): List[EdiLine] = { | |
| lines.map { line => | |
| EdiLine(line.substring(0, 10), line.substring(11, 15), line.substring(16, 20)) | |
| } | |
| } | |
| def fromFile(fileName: String): List[EdiLine] = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import akka.actor.{Actor, ActorRef, ActorSystem, Props} | |
| import akka.http.scaladsl.model.StatusCodes | |
| import akka.http.scaladsl.server.{HttpApp, Route} | |
| import scala.concurrent.duration._ | |
| import akka.pattern._ | |
| import akka.util.Timeout | |
| import de.heikoseeberger.akkahttpplayjson.PlayJsonSupport |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Source | |
| .unfoldAsync(1) { page => | |
| fetchHttpServicePage(page).map { | |
| case Nil => None | |
| case list => Some(page + 1, list) | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package utils | |
| import java.util.UUID | |
| import akka.actor.{Actor, ActorRef, ActorSystem, Props} | |
| import akka.util.Timeout | |
| import software.amazon.awssdk.services.sqs.SqsAsyncClient | |
| import akka.pattern.ask | |
| import scala.concurrent.Future |
NewerOlder