Skip to content

Instantly share code, notes, and snippets.

Avatar

Bartosz Konieczny bartosz25

View GitHub Profile
View ByteBufferIOOps.scala
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())
View docker-compose.yaml
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"
@bartosz25
bartosz25 / CdcCommitLogReadHandler.java
Created May 28, 2019
Cassandra CDC idempotent consumer
View CdcCommitLogReadHandler.java
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;
@bartosz25
bartosz25 / Airflow external triggers
Last active May 24, 2021
Apache Airflow external trigger example
View Airflow external triggers
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\"}"}'
@bartosz25
bartosz25 / ArrayElementsCastExample.scala
Created Mar 28, 2019
renaming Array struct columns
View ArrayElementsCastExample.scala
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")
@bartosz25
bartosz25 / CassandraSession.java
Created Oct 9, 2018
Apache Cassandra wide rows vs skinny rows micro-benchmark
View CassandraSession.java
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;