Skip to content

Instantly share code, notes, and snippets.

View ikhoon's full-sized avatar
😀
Working from home

Ikhun Um ikhoon

😀
Working from home
View GitHub Profile
@trustin
trustin / setup-docker.sh
Created January 10, 2024 11:37
How to install Docker on macOS without using Docker Desktop
#!/usr/bin/env bash
set -Eeuo pipefail
# Install Docker CLI and Docker Compose, etc.
brew install docker docker-compose docker-credential-helper
# Configure Docker CLI.
mkdir -p "$HOME/.docker/cli-plugins"
ln -sfn '/opt/homebrew/opt/docker-compose/bin/docker-compose' "$HOME/.docker/cli-plugins/docker-compose"
echo '{
@trustin
trustin / git-trigger-build.sh
Last active January 22, 2024 05:14
git-trigger-build: Triggers a CI build by pushing an empty commit
#!/bin/bash -e
# Stash the staged files if any.
NEEDS_UNSTASH=0
if ! git diff --staged --exit-code >/dev/null; then
echo -ne '\033[1;32m'
echo -n 'Stashing the staged files'
echo -e '\033[0m'
git stash
NEEDS_UNSTASH=1
package armeria.lecture.week3;
import java.util.Scanner;
import java.util.concurrent.ConcurrentLinkedQueue;
import org.reactivestreams.Subscriber;
import org.reactivestreams.Subscription;
import com.linecorp.armeria.client.WebClient;
import com.linecorp.armeria.common.HttpData;
@seoh
seoh / Main.scala
Last active July 18, 2021 16:11
example of typelevel programming: merge sort by type
object Main extends App {
// boilerplate
import scala.reflect.runtime.universe._
def show[T](value: T)(implicit tag: TypeTag[T])
= tag.toString.replace("Main.", "")
// type-level programming
@codefromthecrypt
codefromthecrypt / add-accesslog.sh
Last active September 11, 2019 09:08
Add custom armeria configuration to zipkin
#!/bin/sh
#
# NOTE: if you are reading this, probably you should upvote https://github.com/line/armeria/issues/1909
#
# get normal zipkin server
curl -sSL https://zipkin.io/quickstart.sh | bash -s
# Write pom.xml thats responsible for generating armeria-configurator.jar
cat << 'EOF' > pom.xml
import cats.effect.ExitCase._
import cats.effect.Sync
import cats.effect.concurrent.Ref
import cats.syntax.flatMap._
import cats.syntax.functor._
trait Tap[F[_]] {
def apply[A](effect: F[A]): F[A]
}
@dsebban
dsebban / fs2-pull.md
Last active April 11, 2024 20:48
Understanding fs2 `Pull`

Undertsanding the Pull type from fs2

From the scaladocs

class Stream[+F[_], +O] extends AnyVal
  • A stream producing output of type O
  • May evaluate F effects.
@seoh
seoh / slides.md
Last active May 25, 2020 22:22
Scala Night 2018

Quick Tips for Fast Code on the JVM

I was talking to a coworker recently about general techniques that almost always form the core of any effort to write very fast, down-to-the-metal hot path code on the JVM, and they pointed out that there really isn't a particularly good place to go for this information. It occurred to me that, really, I had more or less picked up all of it by word of mouth and experience, and there just aren't any good reference sources on the topic. So… here's my word of mouth.

This is by no means a comprehensive gist. It's also important to understand that the techniques that I outline in here are not 100% absolute either. Performance on the JVM is an incredibly complicated subject, and while there are rules that almost always hold true, the "almost" remains very salient. Also, for many or even most applications, there will be other techniques that I'm not mentioning which will have a greater impact. JMH, Java Flight Recorder, and a good profiler are your very best friend! Mea

Why not both?

With the recent announcement of cats-effect, a relevant question from the past resurfaces: why does IO, which is otherwise quite Task-like, not define both or race? To be clear, the type signatures of these functions would be as follows:

object IO {
  def both[A, B](ioa: IO[A], iob: IO[B])(implicit EC: ExecutionContext): IO[(A, B)] = ???
  def race[A, B](ioa: IO[A], iob: IO[B])(implicit EC: ExecutionContext): IO[Either[A, B]] = ???
}