Add this file to your AI assistant's system prompt or context to help it avoid common AI writing patterns. Source: tropes.fyi by ossama.is
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
| //> using scala 3.7.3 | |
| //> using dep com.softwaremill.ox::core:1.0.0 | |
| import scala.concurrent.duration.* | |
| import java.time.Instant | |
| import ox.* | |
| import scala.util.boundary | |
| import java.util.ArrayList | |
| import java.util.concurrent.locks.LockSupport |
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
| package org.jetbrains.demo | |
| import io.ktor.server.application.* | |
| import io.ktor.server.engine.* | |
| import io.ktor.server.netty.* | |
| import io.ktor.server.response.* | |
| import io.ktor.server.routing.* | |
| fun main() { | |
| embeddedServer(Netty, configure = { |
Kotlin/Native requires that C libraries are compiled with a specific verison of GCC.
You can use the GCC used by Kotlin/Native itself. These Gradle tasks will help with this.
// build.gradle.kts
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
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
| ### Llama 2 Chat | |
| POST http://127.0.0.1:8080/completion | |
| Content-Type: application/json | |
| { | |
| "prompt": "What is Java Language?", | |
| "temperature": 0.7 | |
| } | |
| ### Llama 2 tokenize |
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.gradle.kotlin.dsl.* | |
| import org.gradle.plugin.use.* | |
| import org.slf4j.LoggerFactory | |
| /** Build source logger */ | |
| val logger = LoggerFactory.getLogger("build-logic") | |
| /** Dependency versions. */ | |
| object Deps { |
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
| Latency Comparison Numbers (~2012) | |
| ---------------------------------- | |
| L1 cache reference 0.5 ns | |
| Branch mispredict 5 ns | |
| L2 cache reference 7 ns 14x L1 cache | |
| Mutex lock/unlock 25 ns | |
| Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
| Compress 1K bytes with Zippy 3,000 ns 3 us | |
| Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
| Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
I had some historical key material data in pkcs#1 format that needed to be in pkcs#8 for input into another system. Here's how to do it, using BouncyCastle:
import org.bouncycastle.asn1.ASN1InputStream;
import org.bouncycastle.asn1.DERObject;
import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers;
import org.bouncycastle.asn1.pkcs.PrivateKeyInfo;
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
import java.security.PrivateKey;NewerOlder