Skip to content

Instantly share code, notes, and snippets.

Avatar
😀
Working from home

Ikhun Um ikhoon

😀
Working from home
View GitHub Profile
View armeria-interop-scala.md

Armeria on Scala

View BidiStream.java
package example.armeria;
import java.nio.charset.StandardCharsets;
import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.reactivestreams.Publisher;
View FixedStreamMessageTest.java
class FixedStreamMessageTest {
@ArgumentsSource(IntsProvider.class)
@ParameterizedTest
void spec_306_requestAfterCancel(List<Integer> nums) throws InterruptedException {
final Integer[] array = nums.stream().toArray(Integer[]::new);
final StreamMessage<Integer> message = StreamMessage.of(array);
final CompletableFuture<Subscription> subscriptionFuture = new CompletableFuture<>();
message.subscribe(new Subscriber<Integer>() {
@Override
View client-call-close-stacktrace.txt
java.lang.RuntimeException: null
at com.linecorp.armeria.internal.client.grpc.ArmeriaClientCall.close(ArmeriaClientCall.java:441)
at com.linecorp.armeria.internal.client.grpc.ArmeriaClientCall.transportReportStatus(ArmeriaClientCall.java:398)
at com.linecorp.armeria.internal.common.grpc.GrpcStatus.reportStatus(GrpcStatus.java:259)
at com.linecorp.armeria.internal.common.grpc.HttpStreamReader.onNext(HttpStreamReader.java:128)
at com.linecorp.armeria.internal.common.grpc.HttpStreamReader.onNext(HttpStreamReader.java:44)
at com.linecorp.armeria.common.stream.DefaultStreamMessage.notifySubscriberWithElements(DefaultStreamMessage.java:404)
at com.linecorp.armeria.common.stream.DefaultStreamMessage.notifySubscriber0(DefaultStreamMessage.java:382)
at com.linecorp.armeria.common.stream.DefaultStreamMessage.doRequest(DefaultStreamMessage.java:239)
at com.linecorp.armeria.common.stream.DefaultStreamMessage.request(DefaultStreamMessage.java:224)
@ikhoon
ikhoon / ikhoon.postfixTemplates
Last active Nov 16, 2020
custom postfix template
View ikhoon.postfixTemplates
## Templates for guava ##
.toList : convert to ImmutableList
java.util.stream.Stream -> $expr$.collect(com.google.common.collect.ImmutableList.toImmutableList())
@ikhoon
ikhoon / DATAFrameErrorStack.java
Last active Jan 30, 2020
java.lang.IllegalStateException: cannot start a new stream
View DATAFrameErrorStack.java
"armeria-common-worker-nio-2-1@4812" daemon prio=5 tid=0x17 nid=NA runnable
java.lang.Thread.State: RUNNABLE
at com.linecorp.armeria.internal.Http2ObjectEncoder.doWriteData(Http2ObjectEncoder.java:93)
at com.linecorp.armeria.internal.HttpObjectEncoder.writeData(HttpObjectEncoder.java:85)
at com.linecorp.armeria.server.HttpResponseSubscriber.write(HttpResponseSubscriber.java:298)
at com.linecorp.armeria.server.HttpResponseSubscriber.onNext(HttpResponseSubscriber.java:227)
at com.linecorp.armeria.server.HttpResponseSubscriber.onNext(HttpResponseSubscriber.java:58)
at com.linecorp.armeria.common.stream.DefaultStreamMessage.notifySubscriberWithElements(DefaultStreamMessage.java:341)
at com.linecorp.armeria.common.stream.DefaultStreamMessage.notifySubscriber0(DefaultStreamMessage.java:319)
at com.linecorp.armeria.common.stream.DefaultStreamMessage.doRequest(DefaultStreamMessage.java:188)
@ikhoon
ikhoon / Functors.scala
Created Jan 13, 2020
functor expamles
View Functors.scala
package category
import java.util.concurrent.CompletableFuture
object Functors {
// Monad 핵심: 많이 쓰인다.
// A => B, F[A] => (A => B), => F[B]
// Map Pair(A, B)
// type class, 특정 타입에 기반된 행위
View json-unit-dep.tree
org.hamcrest:hamcrest:2.1
variant "default" [
org.gradle.status = release (not requested)
]
org.hamcrest:hamcrest:2.1
\--- org.awaitility:awaitility:4.0.1
\--- allDependencies (requested org.awaitility:awaitility)
org.hamcrest:hamcrest-core:1.3
@ikhoon
ikhoon / lambdainstance.java
Created Sep 30, 2019
Check java lambda instance is singleton.
View lambdainstance.java
String foo() {
return "abc";
}
String foo(Supplier<String> s) {
System.out.println(s);
return "abc " + s.get();
}
@Test
@ikhoon
ikhoon / checkout-pr.zsh
Last active Oct 7, 2019
git checkout remote pull request to local branch and track it with FZF-TMUX
View checkout-pr.zsh
# git checkout remote pull request to local branch and track it with FZF-TMUX
# Requirements:
# - hub : https://github.com/github/hub
# - fzf-tmux : https://github.com/junegunn/fzf#fzf-tmux-script
pr() {
local pr_list pr_id origin branch_name
pr_list=$(cat /dev/null | hub pr list -f "%pC%>(8)%i%Creset %t @%au %l%n")
result=$?
if [[ $pr_list == *"github.com username:"* ]]; then
echo "Please run 'hub pr list' to login GitHub"