Skip to content

Instantly share code, notes, and snippets.

View domnikl's full-sized avatar
💻

Dominik Liebler domnikl

💻
View GitHub Profile
@domnikl
domnikl / build.yml
Last active March 24, 2023 04:42
GitHub Action Workflow to build a Rust project with tests and clippy
name: main
on:
push:
branches: [ main ]
env:
CARGO_TERM_COLOR: always
jobs:
@domnikl
domnikl / ParquetWriter.kt
Created March 1, 2023 09:25
Parquet Writer
class ParquetWriter<T : SpecificRecord>(private val outputFile: String, schema: Schema, conf: Configuration) {
private var closed = false
private val writer by lazy {
val timeSupport = GenericData().also {
it.addLogicalTypeConversion(TimeConversions.DateConversion())
}
AvroParquetWriter.builder<T>(HadoopOutputFile.fromPath(Path(outputFile), conf))
.withSchema(schema)
@domnikl
domnikl / animation.css
Created February 7, 2022 20:48
CSS animation to sweep background-colors
.whatever {
animation-name: color-transition;
animation-duration: 25s;
animation-direction: alternate;
animation-iteration-count: infinite;
animation-timing-function: linear;
}
@keyframes color-transition {
0% {
@domnikl
domnikl / consumer.kt
Last active January 17, 2022 10:10
Blogpost: Integrating Confluent Schema Registry with Apache Spark applications
fun main() {
val config = mapOf(
"bootstrap.servers" to "localhost:9092",
"schema.registry.url" to "http://localhost:8081",
"key.serializer" to "org.apache.kafka.common.serialization.StringSerializer",
"value.serializer" to "io.confluent.kafka.serializers.KafkaAvroSerializer",
)
val consumer = KafkaConsumer<String, Cats>(config)
consumer.subscribe(listOf("cats"))
@domnikl
domnikl / cloudSettings
Last active October 26, 2021 13:10
VSCode Settings Sync
{"lastUpload":"2021-10-26T13:10:18.801Z","extensionVersion":"v3.4.3"}
@domnikl
domnikl / .gitignore
Last active January 7, 2020 08:14
cURL example to post to make.ifttt.com
/*.o
/example
@domnikl
domnikl / primes.kts
Last active December 30, 2021 11:25
Kotlin Prime number sequence
fun primes(): Sequence<Long> {
var i = 0L
return sequence {
generateSequence { i++ }
.filter { n -> n > 1 && ((2 until n).none { i -> n % i == 0L }) }
.forEach { yield(it) }
}
}
@domnikl
domnikl / build.gradle.kts
Last active April 12, 2024 22:34
Gradle Kotlin DSL: set main class attribute for jar
tasks.withType<Jar> {
manifest {
attributes["Main-Class"] = "com.example.MainKt"
}
}
@domnikl
domnikl / mix.exs
Created April 7, 2018 15:06
mix ensure_consistency
def aliases do
[
"ensure_consistency": ["test", "dialyzer", "credo --strict", "inch", "coveralls"]
]
end
def project do
[
app: :belief_structure,
aliases: aliases(),