Skip to content

Instantly share code, notes, and snippets.

View domnikl's full-sized avatar
💻

Dominik Liebler domnikl

💻
View GitHub Profile
@domnikl
domnikl / LICENSE
Last active September 20, 2023 11:58
C function to dump memory
Copyright 2018 Dominik Liebler
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR O
@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(),
@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 / 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 / .gitignore
Last active January 7, 2020 08:14
cURL example to post to make.ifttt.com
/*.o
/example
@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 / 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 / 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 / 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)