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
#include <unistd.h> | |
#include <sys/mman.h> | |
// MEMORY_SANITIZER checks shamelessly stolen from Breakpad: src/common/memory_allocator.h | |
#if defined(MEMORY_SANITIZER) | |
#include <sanitizer/msan_interface.h> | |
#endif | |
#include "sigalloc.h" |
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
// JVM Delegate to expose a private field, and bypass any Kotlin getters & setters | |
// This is a horrible abuse of reflection and should never be used, unless you absolutely have to have it. | |
import java.lang.reflect.Field | |
import kotlin.reflect.KProperty | |
class ExposeDelegate<T> { | |
private fun field(thisRef: Any?, property: KProperty<*>): Field? { | |
if (thisRef == null) return null | |
val name = property.name |
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
import java.util.* | |
class HuffmanTree<T> { | |
private val root: Node<T> | |
constructor(vararg elements: Node<T>) : this(elements.toList()) | |
constructor(elements: Collection<Node<T>>) { | |
val queue = PriorityQueue(elements) | |
while (queue.size > 1) { |
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
#!/bin/bash | |
docker container rm `docker container ls -a | cut -d " " -f1 | tail -n +2`; docker volume prune -f |
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
// https://pl.kotl.in/rJgInO29m | |
class MyClass { | |
private fun doThing1(name: String) = | |
println("Thing1 says: Hello $name") | |
private fun doThing2(name: String) = | |
println("Thing2 says: Hi $name!") | |
private fun fail(name: String) = |