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 kotlinx.coroutines.FlowPreview | |
import kotlinx.coroutines.delay | |
import kotlinx.coroutines.flow.* | |
import kotlinx.coroutines.runBlocking | |
import kotlin.random.Random | |
@FlowPreview | |
fun main() = runBlocking { | |
val events = eventStoreProducer() | |
val messages = kafkaProducer() |
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 infrastructure.Json | |
import io.javalin.Javalin | |
import io.javalin.http.Context | |
import io.javalin.http.HandlerType | |
import io.javalin.plugin.json.FromJsonMapper | |
import io.javalin.plugin.json.JavalinJson | |
import io.javalin.plugin.json.ToJsonMapper | |
fun main() { | |
val app: Javalin = Javalin.create().start(7000) |
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 infrastructure.Json | |
import io.javalin.Javalin | |
import io.javalin.plugin.json.FromJsonMapper | |
import io.javalin.plugin.json.JavalinJson | |
import io.javalin.plugin.json.ToJsonMapper | |
sealed class Device { | |
data class Laptop(val model: String) : Device() | |
data class Phone(val model: String, val carrier: String): Device() | |
} |
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 akka.actor.ActorSystem | |
import eventstore.core.* | |
import eventstore.j.EsConnectionFactory | |
import eventstore.j.SettingsBuilder | |
import kotlinx.coroutines.future.await | |
import kotlinx.coroutines.runBlocking | |
import scala.compat.java8.FutureConverters | |
import scala.concurrent.Future | |
import java.net.InetSocketAddress | |
import java.util.* |
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 Retry.retry | |
import Retry.retryForever | |
import kotlinx.coroutines.* | |
import kotlin.math.pow | |
import kotlin.math.roundToLong | |
import kotlin.random.Random | |
private fun funcThatFails(i: Int): Int { | |
if (i > 100 || Random.nextBoolean()) |
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 com.google.gson.Gson | |
import com.google.gson.GsonBuilder | |
import com.google.gson.TypeAdapter | |
import com.google.gson.TypeAdapterFactory | |
import com.google.gson.reflect.TypeToken | |
import com.google.gson.stream.JsonReader | |
import com.google.gson.stream.JsonWriter | |
import kotlin.jvm.internal.Reflection | |
import kotlin.reflect.KClass |
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
git log --pretty=format:"%ad - %an: %s" --after="2018-01-01" --until="2019-01-31" --author="Krishna Vangapandu" --date=format:'%Y-%m' > c:\temp\krishna-prs.txt |
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
bin\windows\kafka-topics.bat --create --topic consumer-topic --partitions 3 --replication-factor 1 --zookeeper localhost | |
bin\windows\kafka-server-start.bat config\server.properties | |
bin\windows\zookeeper-server-start.bat config\zookeeper.properties | |
bin\windows\kafka-producer-perf-test.bat --topic joker-walmart-order-injection --payload-file "C:\\temp\\small.json" --num-records 200 --throughput 100 --producer-props acks=1 bootstrap.servers=localhost:9092 | |
bin\windows\kafka-consumer-groups.bat --bootstrap-server shared.kafka.eastus2.qa.jet.network:9092 --group mytopic-consumer-group --reset-offsets --to-earliest --topic mytopic --execute |
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
let path r c = | |
[ | |
sprintf "http://apscert.gov.in/ebookapp/NewServlet?name=/home/wscontent/apscert/ebooks/pdf/English/%s/maths/Mathematics%%20%d/cover.pdf" r c, sprintf "%s-cover.pdf" r | |
sprintf "http://apscert.gov.in/ebookapp/NewServlet?name=/home/wscontent/apscert/ebooks/pdf/English/%s/maths/Mathematics%%20%d/introduction.pdf" r c, sprintf "%s-intro.pdf" r | |
] @ | |
(['a'..'z'] | |
|> List.take 15 | |
|> List.map (fun ch -> | |
sprintf "http://apscert.gov.in/ebookapp/NewServlet?name=/home/wscontent/apscert/ebooks/pdf/English/%s/maths/Mathematics%%20%d/unit%%20%c.pdf" r c ch, | |
sprintf "%s-unit-%c.pdf" r ch)) |
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
type ValidationResult<'a> = | |
| Success of 'a | |
| Failure of string array //you can also make a ValidationFailure DU which is more "typesafe" | |
type Validate<'a> = ValidationResult<'a> -> ValidationResult<'a> | |
module Validators = | |
let bind<'a,'b> (f : 'a -> ValidationResult<'b>) = | |
function | |
| Success x -> |
NewerOlder