This file contains hidden or 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
class OpenSSLContainer : GenericContainer<OpenSSLContainer>( | |
ImageFromDockerfile().withDockerfileFromBuilder { it | |
.from("ubuntu:20.04") | |
.env("DEBIAN_FRONTEND", "noninteractive") | |
.env("LC_ALL", "C.UTF-8") | |
.run("apt-get update && apt-get install -y openssl") | |
.run("openssl version") | |
//we need a running container to call `execInContainer` commands | |
.cmd("/bin/bash -c 'while true; do sleep 10; done'") | |
}) |
This file contains hidden or 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
plugins { | |
java | |
kotlin("jvm") version "1.4.10" | |
kotlin("kapt") version "1.4.10" | |
id("org.jetbrains.kotlin.plugin.allopen") version "1.4.10" | |
id("io.micronaut.application") version "1.1.0" | |
} | |
micronaut { | |
version("2.1.3") |
This file contains hidden or 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
class X | |
operator fun <Y> AtomicReference<Y>.getValue(x: Any?, p: KProperty<*>) : Y = this.get() | |
operator fun <Y> AtomicReference<Y>.setValue(x: Any?, p: KProperty<*>, value: Y) { this.set(value) } | |
val myStats by AtomicReference<X>(null) |
This file contains hidden or 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 com.intellij.codeInsight.daemon.ProblemHighlightFilter | |
import com.intellij.concurrency.JobLauncher | |
import com.intellij.openapi.application.ReadAction | |
import com.intellij.openapi.module.Module | |
import com.intellij.openapi.module.ModuleManager | |
import com.intellij.openapi.progress.ProgressIndicator | |
import com.intellij.openapi.progress.ProgressManager | |
import com.intellij.openapi.progress.Task | |
import com.intellij.openapi.project.Project | |
import com.intellij.openapi.project.ProjectCoreUtil |
This file contains hidden or 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 org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTargetWithTests | |
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform.getCurrentOperatingSystem | |
fun setupNative(name: String, | |
configure: KotlinNativeTargetWithTests.() -> Unit): KotlinNativeTargetWithTests { | |
val os = getCurrentOperatingSystem() | |
return when { | |
os.isLinux -> kotlin.linuxX64(name, configure) | |
os.isWindows -> kotlin.mingwX64(name, configure) |
This file contains hidden or 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 kotlin.properties.ReadOnlyProperty | |
import kotlin.reflect.KProperty | |
/** API **/ | |
data class ProcessorId(val name: String) | |
data class SourceId(val name: String) | |
interface ProcessorDelegate { | |
operator fun provideDelegate(thisRef: Any?, | |
prop: KProperty<*>) : ReadOnlyProperty<Any?, ProcessorId> |
This file contains hidden or 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
class Z { | |
operator fun plus(z:Z) = z | |
operator fun plusAssign(z:Z) = Unit | |
} | |
fun test() { | |
val x = Z() + Z() | |
x += Z() | |
} |
This file contains hidden or 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
fun callWithLambda(x: () -> Unit) = x() | |
inline fun callW(crossinline x: () -> Unit) { | |
callWithLambda { | |
x() | |
x() | |
} | |
} |
This file contains hidden or 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
inline fun catchAll(LOG: Logger, message: String, action: () -> Unit) { | |
try { | |
action() | |
} catch (t: Throwable) { | |
LOG.warn("Failed to $message. ${t.message}", t) | |
} | |
} |
This file contains hidden or 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
class GuardedByLock<out T>( | |
val lock : Lock, | |
val state : T | |
) { | |
inline fun <Y> withLock(action : T.() -> Y) = lock.withLock { state.action() } | |
} |
NewerOlder