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 EventContext(key: Key): AbstractCoroutineContextElement(key) { | |
private val completed = CompletableDeferred<Unit>() | |
private var events: AtomicReference<ImmutableList<EventWrapper>?> = AtomicReference(immutableListOf()) | |
// in this implementation, polling an empty list "closes" it, | |
// thus, if you poll a list of 1 element, it becomes a list of 0 elements, | |
// when thats polled, its atomically closed and subsequent offer calls return false. | |
fun poll(): EventWrapper? { |
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
[ditto@teamcity ~]$ cat ./.ssh/authorized_keys | |
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDTEe1AqswRuHevBWuuuIcEzFTxz+glnohcGQWFpQShhawcTiB4FRhF3FsayU1Qt9HaiDd/Mafdnh0tGpWGJ/sozl6l3ydFSD++FIlJM9TSxhnPHMOOBKLISpB3rDSH4Nz8C6Hp0ySMtF2aMZhCSz/EKjjm/iV6cTQ/ScYFh3rcn6Y78cR3U9WgOFFfFaIfh9QQRs3oN6RowrlE+Oj+5U6W8PtPgcoC+smxd1DxEE2aX96FhlpmeRyAQtyoJEPj07LExKPEIQ6Vv2aAiL13EB/dK5qV5gSeq5+m9C/OOscnR/S6NkXUpsprxpXPyVFmanaKn87i57Iq5146IKP+Wfwr geoff@Kusinagi-2 | |
[ditto@teamcity ~]$ logout | |
Connection to teamcity.empowerops.ca closed. | |
C:\Users\Geoff\Code\OASIS\Samples\PowerShell\SC function via ssh [2238_create_non_commercial_version ≡ +0 ~2 -0 !]> cat C:\Users\Geoff\.ssh\id_rsa.pub | |
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDTEe1AqswRuHevBWuuuIcEzFTxz+glnohcGQWFpQShhawcTiB4FRhF3FsayU1Qt9HaiDd/Mafdnh0tGpWGJ/sozl6l3ydFSD++FIlJM9TSxhnPHMOOBKLISpB3rDSH4Nz8C6Hp0ySMtF2aMZhCSz/EKjjm/iV6cTQ/ScYFh3rcn6Y78cR3U9WgOFFfFaIfh9QQRs3oN6RowrlE+Oj+5U6W8PtPgcoC+smxd1DxEE2aX96FhlpmeRyAQtyoJEPj07LExKPEIQ6Vv2aAiL13EB/dK5qV5gSeq5+m9C/OOscnR/S6NkXUpsprxpXPyVFm |
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
Param( | |
$OutputCerts = "./sslcerts", | |
$ServerCN = "127.0.0.1", | |
$ClientCN = "127.0.0.1" | |
) | |
Get-Command "openssl" -ErrorAction Stop | |
# you can get this from choco with | |
# choco install openssl-light |
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
@Test fun `should receive updated data when querying all challenges`() = runBlocking<Unit> { | |
//setup | |
val initChallenges = list(Challenge(...),Challenge(...)) | |
val newSurveyChallenge = SurveyChallenge(...) | |
val expectedChallenges = initChallenges + newSurveyChallenge | |
//act | |
initChallenges.forEach(challengeDao::addOrUpdate) | |
challengeDao.addOrUpdate(newSurveyChallenge) |
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
@Test fun `when using a rendezvous channel can see through to caller if configured`() = runBlocking{ | |
val channel = Channel<String>(RENDEZVOUS) | |
var exception: Exception? = null | |
val producer = GlobalScope.launch(Dispatchers.IO){ | |
hardpoint { | |
channel.send("hello!") | |
} | |
} |
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 Test { | |
@Volatile | |
var ticker = 0 | |
@Volatile | |
var deferred: Deferred<String> | |
val retryingExceptionHandler: CoroutineExceptionHandler = CoroutineExceptionHandler { _, throwable -> | |
println("!!!!!!!") | |
authScope.kickoffUpdateWithDelay() | |
authScope.testB() |
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 groostav.kotlinx.exec | |
import kotlinx.coroutines.* | |
import kotlinx.coroutines.Dispatchers.Unconfined | |
import kotlinx.coroutines.channels.Channel | |
import kotlinx.coroutines.channels.Channel.Factory.RENDEZVOUS | |
import kotlinx.coroutines.channels.ReceiveChannel | |
import kotlinx.coroutines.channels.consumeEach | |
import java.util.concurrent.atomic.AtomicInteger | |
import java.util.concurrent.atomic.AtomicReference |
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
Retrofit.addCallAdapterFactory(ErrorCheckingCallAdapterFactory()) | |
class ErrorCheckingCallAdapterFactory() : CallAdapter.Factory() { | |
override fun get(returnType: Type, annotations: Array<Annotation>, retrofit: Retrofit): CallAdapter<*, *>? { | |
if (CallAdapter.Factory.getRawType(returnType) != Deferred::class.java) { | |
return null // Ignore ~~non-Observable~~ non-coroutine types. | |
} | |
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 Tests{ | |
@Test | |
fun `Submits app selection if selections can be made`() = runBlocking(Dispatchers.Main) { //@Test... = runBlocking is a good convention | |
mainActivityViewModel.submitAppSelection(selectedApp) | |
verify(mockAppsStartupFsm).submitEvent(AppSelected(selectedApp)) | |
} | |
} |
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
private enum class Side { Left, Right } | |
infix fun Deferred<Boolean>.orAsync(right: Deferred<Boolean>) = async<Boolean> { | |
val left: Deferred<Boolean> = this@orAsync | |
//note: I didnt take a context object. | |
//`infix` might not be possible... | |
// 'short circuit' | |
if(left.isCompleted && left.getCompleted()) return@async true | |
if(right.isCompleted && right.getCompleted()) return@async true |