View CassandraSession.java
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
package com.waitingforcode; | |
import com.datastax.driver.core.Cluster; | |
import com.datastax.driver.core.Session; | |
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.stream.Collectors; |
View ArrayElementsCastExample.scala
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
case class ElementCaseClass(contrast_ratio: Double, error_text: String, error_x_position: Long, error_x_size: Long) | |
val dataset = Seq( | |
(Array( | |
ElementCaseClass(1.0d, "error1", 1L, 2L), | |
ElementCaseClass(2.0d, "error2", 100L, 101L), | |
ElementCaseClass(3.0d, "error3", 1000L, 1001L) | |
)) | |
).toDF("elements") |
View Airflow external triggers
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
curl -X POST http://localhost:8081/api/experimental/dags/hello_world_a/dag_runs -H 'Cache-Control: no-cache' -H 'Content-Type: application/json' -d '{"conf":"{\"task_payload\":\"payload1\"}"}' | |
curl -X POST http://localhost:8081/api/experimental/dags/hello_world_a/dag_runs -H 'Cache-Control: no-cache' -H 'Content-Type: application/json' -d '{"conf":"{\"task_payload\":\"payload2\"}"}' | |
curl -X POST http://localhost:8081/api/experimental/dags/hello_world_a/dag_runs -H 'Cache-Control: no-cache' -H 'Content-Type: application/json' -d '{"conf":"{\"task_payload\":\"payload3\"}"}' |
View CdcCommitLogReadHandler.java
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
package com.waitingforcode.cassandra_cdc; | |
import org.apache.cassandra.config.ColumnDefinition; | |
import org.apache.cassandra.db.Clustering; | |
import org.apache.cassandra.db.Mutation; | |
import org.apache.cassandra.db.commitlog.CommitLogDescriptor; | |
import org.apache.cassandra.db.commitlog.CommitLogReadHandler; | |
import org.apache.cassandra.db.partitions.PartitionUpdate; | |
import org.apache.cassandra.db.rows.Cell; | |
import org.apache.cassandra.db.rows.Row; |
View docker-compose.yaml
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.1' | |
services: | |
webserver: | |
image: puckel/docker-airflow:1.9.0-3 | |
environment: | |
- LOAD_EX=n | |
volumes: | |
- ./assets/dags:/usr/local/airflow/dags | |
ports: | |
- "8080:8080" |
View ByteBufferIOOps.scala
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
package com.waitingforcode | |
import java.nio.ByteBuffer | |
import java.nio.channels.SocketChannel | |
import java.nio.charset.StandardCharsets | |
object ByteBufferIOOps { | |
def writeToChannel(channel: SocketChannel, textToWrite: String, buffer: ByteBuffer) = { | |
buffer.clear() | |
buffer.put(textToWrite.getBytes()) |