Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
def create_encoder(latent_dim, cat_dim, window_size, input_dim): | |
input_layer = Input(shape=(window_size, input_dim)) | |
code = TimeDistributed(Dense(64, activation='linear'))(input_layer) | |
code = Bidirectional(LSTM(128, return_sequences=True))(code) | |
code = BatchNormalization()(code) | |
code = ELU()(code) | |
code = Bidirectional(LSTM(64))(code) | |
code = BatchNormalization()(code) | |
code = ELU()(code) |
This file contains 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
-- show running queries (pre 9.2) | |
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(clock_timestamp(), query_start), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
This file contains 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
object WordCount extends MapReduce[String, String, Int, Int] { | |
override def mapper(line: String): Seq[KeyValue[String, Int]] = | |
"""[\w']+""".r.findAllIn(line).map { word => KeyValue(word, 1) }.toVector | |
override def reducer(key: String, values: Seq[Int]): KeyValue[String, Int] = | |
KeyValue(key, values.sum) | |
} |
This file contains 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
@Component | |
class TickRepository( | |
@Value("\${db.influx.url}") val dburl : String, | |
@Value("\${db.influx.user}") val user : String, | |
@Value("\${db.influx.pw}") val pw : String, | |
@Value("\${db.influx.dbname}") val dbname : String | |
) { | |
private final val logger = LoggerFactory.getLogger(javaClass) | |
val influxDB = lazy { InfluxDBFactory.connect(dburl, user, pw).setDatabase(dbname) } |
This file contains 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
@Component | |
class TickRecordingService | |
@Autowired constructor(val socket: CoinbaseWebsocket, | |
val tickRepository: TickRepository) { | |
private val logger = LoggerFactory.getLogger(javaClass) | |
fun recordProducts(products: Array<String>): Flux<List<Message>> { | |
logger.info("Start Recording Tick Stream for Products: $products") |
This file contains 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
@Component | |
class CoinbaseWebsocket @Autowired constructor( | |
@Value("\${cbpro.websocket.baseurl}") val websocketUrl: String | |
) { | |
private final val mapper = ObjectMapper() | |
private final val logger = LoggerFactory.getLogger(javaClass) | |
private final val client = ReactorNettyWebSocketClient() | |
init { client.maxFramePayloadLength = Int.MAX_VALUE } |
This file contains 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
sealed class Try<T> { | |
companion object { | |
operator fun <T> invoke(func: () -> T): Try<T> = | |
try { | |
Success(func()) | |
} catch (error: Exception) { | |
Failure(error) | |
} |
This file contains 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
fun main() { | |
val lines = Try { | |
File("./my-pets.csv").readLines().map { it.split(',') } | |
} | |
val pets : Try<List<Pet>> = lines.map { it.map(::toPet) } | |
when (pets) { | |
is Success -> println(pets.value) |
This file contains 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
version: '3' | |
services: | |
#----------------- | |
#--- Influx DB --- | |
#----------------- | |
influx: | |
image: influxdb:alpine | |
ports: | |
- "8086:8086" | |
environment: |
NewerOlder