Skip to content

Instantly share code, notes, and snippets.

created root /var/folders/f9/c2brg7yx24gftgpb49rpf3jw00p91s/T/kobalt-test7487693100456251204
created projectInfo file /var/folders/f9/c2brg7yx24gftgpb49rpf3jw00p91s/T/kobalt-test7487693100456251204/src/main/kotlin/A.kt
__ __ __ __ __
/ //_/ ____ / /_ ____ _ / / / /_
/ ,< / __ \ / __ \ / __ `/ / / / __/
/ /| | / /_/ / / /_/ // /_/ / / / / /_
/_/ |_| \____/ /_.___/ \__,_/ /_/ \__/ 1.1.8
Regular compilation time: 205 ms
Parallel build starting
@oshai
oshai / 2-way-sync.sh
Created October 13, 2020 22:52
2-way-sync
#!/bin/bash
set -e
echo 'commit all uncommited files'
ssh $P "cd $PROD_DIR; git add --all . ; git diff-index --quiet HEAD || git commit -m \"chore: periodic jenkins commit\""
echo 'check for additional changes'
ssh $P "cd $PROD_DIR; git diff --exit-code || 'git ls-files --other --directory --exclude-standard | sed q1'"
cd $I_WORK_DIR
echo "pull from $P"
git pull --rebase origin master:master
echo 'pull from $G'
public static boolean isSupported(String var0) {
return supportedParameters().contains(var0);
}
public static Set supportedParameters() {
if (supportedParams == null) {
supportedParams = new TreeSet();
supportedParams.add("a");
supportedParams.add("rf");
supportedParams.add("f");
java.lang.UnsupportedOperationException: datum parameter is not supported
at org.osgeo.proj4j.parser.Proj4Keyword.checkUnsupported(Unknown Source) ~[proj4j-0.1.0.jar:?]
at org.osgeo.proj4j.parser.Proj4Keyword.checkUnsupported(Unknown Source) ~[proj4j-0.1.0.jar:?]
at org.osgeo.proj4j.parser.Proj4Parser.parse(Unknown Source) ~[proj4j-0.1.0.jar:?]
at org.osgeo.proj4j.CoordinateSystemFactory.createFromParameters(Unknown Source) ~[proj4j-0.1.0.jar:?]
at org.osgeo.proj4j.CoordinateSystemFactory.createFromName(Unknown Source) ~[proj4j-0.1.0.jar:?]
request -> {
mySQLClient.getConnection(res -> {
if (res.succeeded()) {
SQLConnection connection = res.result();
// Got a connection
connection.query("SELECT 0", result ->
request.response().end("Got response " + result.result().getNumRows()));
} else {
@Test
fun `"Simple query with 1 nanosec timeout"`() {
withConfigurablePool(shortTimeoutConfiguration()) { pool ->
{
val connection = pool.take().get(10, TimeUnit.SECONDS)
assertThat(connection.isTimeout()).isEqualTo(false)
assertThat(connection.isConnected()).isEqualTo(true)
val queryResultFuture = connection.sendQuery("select sleep(1)")
verifyException(TimeoutException::class.java) {
queryResultFuture.get(10, TimeUnit.SECONDS)
@oshai
oshai / loadclass.kt
Created October 23, 2018 11:42
load a class from source code string
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments
import org.jetbrains.kotlin.cli.common.messages.MessageRenderer
import org.jetbrains.kotlin.cli.common.messages.PrintingMessageCollector
import org.jetbrains.kotlin.cli.jvm.K2JVMCompiler
import org.jetbrains.kotlin.config.Services
import java.io.File
import java.io.FileNotFoundException
import java.io.IOException
import java.io.PrintWriter
import java.net.URLClassLoader
import com.github.jasync.sql.db.Configuration
import com.github.jasync.sql.db.Connection
import com.github.jasync.sql.db.QueryResult
import com.github.jasync.sql.db.RowData
import com.github.jasync.sql.db.mysql.MySQLConnection
import com.github.jasync.sql.db.mysql.util.URLParser
import com.github.jasync.sql.db.util.head
import com.github.jasync.sql.db.util.map
import java.util.concurrent.CompletableFuture
@oshai
oshai / scala-to-kotlin.kts
Last active February 9, 2023 10:45
Stupid and simple convert a Scala file (already renamed to .kt extension) to Kotlin
#!/usr/bin/env kscript
import java.io.File
// usage - one argument a .kt file (Scala file that was only renamed)
// or a directory
try {
main(args)
} catch (e: Exception) {
e.printStackTrace()
// Table definition
object Cities : Table() {
val id = integer("id").autoIncrement().primaryKey()
val name = varchar("name", 50)
val create_date = datetime(name = "create_date")
}
// Entity definition
data class City(
val id: Int,
val name: String