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
@ExperimentalCoroutinesApi | |
public fun <E> CoroutineScope.produce( | |
context: CoroutineContext = EmptyCoroutineContext, | |
capacity: Int = 0, | |
@BuilderInference block: suspend ProducerScope<E>.() -> Unit | |
): ReceiveChannel<E> |
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 kotlinx.coroutines.channels.Channel | |
val channel = Channel<Int>() |
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 interface Channel<E> : SendChannel<E>, ReceiveChannel<E> |
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 fun <E> Channel(capacity: Int = RENDEZVOUS): Channel<E> |
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 fun openSubscription(): ReceiveChannel<E> | |
public fun cancel(cause: CancellationException? = 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
public fun <E> BroadcastChannel(capacity: Int): BroadcastChannel<E> |
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 ru.tetraquark.kexperiments.callbacktosuspend.SomeJavaApi | |
import kotlinx.coroutines.* | |
import kotlin.Exception | |
import kotlin.coroutines.Continuation | |
import kotlin.coroutines.resume | |
import kotlin.coroutines.resumeWithException | |
import kotlin.coroutines.suspendCoroutine | |
fun main() = runBlocking { |
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.jetbrains.annotations.NotNull; | |
import java.util.concurrent.ExecutorService; | |
import java.util.concurrent.Executors; | |
public class SomeJavaApi { | |
private static final String SUCCESS_RESULT = "SUCCESSFUL_CALL"; | |
private static final long WORK_DELAY = 1000L; |
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
# | |
# Example of simple discord chatbot based on discord.py library | |
# For article (Russian language): http://tetraquark.ru/archives/377 | |
# | |
import discord | |
import asyncio | |
import requests | |
DISCORD_BOT_TOKEN = 'DISCORD_APP_TOKEN' |
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
# | |
# Testing of FastICA algorithm from sklearn library. | |
# Author: tetraquark | tetraquark.ru | |
# Article URL (RUS language): http://tetraquark.ru/archives/311 | |
# | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from sklearn.decomposition import FastICA | |
# Length of the sources signals |
NewerOlder