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
buildscript { | |
ext.kotlin_version = '1.1.3' | |
repositories { | |
mavenCentral() | |
} | |
dependencies { | |
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" | |
} |
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 com.github.benmanes.caffeine.cache.CacheLoader | |
import com.github.benmanes.caffeine.cache.Caffeine | |
var COMPILED_PATTERNS = Caffeine.newBuilder() | |
.maximumSize(10000) | |
.build(CacheLoader<String, Pattern> { | |
Pattern.compile(it) | |
}) |
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
fun main(args: Array<String>) { | |
val timeIn = System.currentTimeMillis() | |
val deferred: List<Deferred<Long>> = (1..1_000).map { | |
async(CommonPool) { | |
var count: Long = 0 | |
for (i in 1..1_000_000_000) | |
count++ | |
count | |
} | |
} |
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
<plugin> | |
<artifactId>kotlin-maven-plugin</artifactId> | |
<groupId>org.jetbrains.kotlin</groupId> | |
<version>${kotlin.version}</version> | |
<executions> | |
<execution> | |
<id>compile</id> | |
<goals> | |
<goal>compile</goal> | |
</goals> |
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
@Test | |
public void testBitGet() { | |
//redisTemplate.opsForValue().setBit("user2.flags",0,true); | |
BitSet value = redisTemplate.execute(new RedisCallback<BitSet>() { | |
public BitSet doInRedis(RedisConnection redis) throws DataAccessException { | |
return fromByteArrayReverse(redis.get("user.1.flags".getBytes())); | |
} | |
}); | |
System.out.println(value); | |
} |
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
for file in ~/.bashrc.d/*.bashrc; | |
do | |
source “$file” | |
done |
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 org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.boot.autoconfigure.web.ServerProperties; | |
import org.springframework.context.annotation.Configuration; | |
import javax.annotation.PostConstruct; | |
import java.net.Inet6Address; | |
import java.net.InetAddress; | |
import java.net.NetworkInterface; | |
import java.util.Arrays; | |
import java.util.Collections; |
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
public final class FilenameComparator implements Comparator<String> { | |
private static final Pattern NUMBERS = | |
Pattern.compile("(?<=\\D)(?=\\d)|(?<=\\d)(?=\\D)"); | |
private static final Pattern FILE_ENDING = | |
Pattern.compile("(?<=.*)(?=\\..*)"); | |
@Override | |
public final int compare(String o1, String o2) { | |
if (o1 == null || o2 == null) |
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
{ | |
"$schema": "http://json-schema.org/draft-07/schema#", | |
"title": "Envoy Proxy config schema", | |
"description": "JSON Schema for Envoy Proxy config", | |
"type": "object", | |
"properties": { | |
"admin": { | |
"type": "object", | |
"description": "Configuration for the local administration HTTP server", | |
"properties": { |
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
package org.mvnsearch.builder | |
class FoodOrder private constructor(builder: FoodOrder.Builder) { | |
val bread: String? | |
val meat: String? | |
init { | |
this.bread = builder.bread | |
this.meat = builder.meat |