Thread pools on the JVM should usually be divided into the following three categories:
- CPU-bound
- Blocking IO
- Non-blocking IO polling
Each of these categories has a different optimal configuration and usage pattern.
| import arrow.core.Nel | |
| import arrow.core.raise.Raise | |
| import arrow.core.raise.recover | |
| import arrow.fx.coroutines.parZipOrAccumulate | |
| object ApplicationError | |
| object UserLegalId | |
| object User | |
| object DepartmentCode | |
| object Department |
| import reactor.core.publisher.Mono | |
| import java.util.concurrent.Executor | |
| fun noTrampolining(): Mono<Int> { | |
| var initial = Mono.just(0) | |
| (0..5000).forEach { i -> | |
| initial = initial.map { i } | |
| } | |
| return initial |
| # Export as Text Table | |
| aws --region XXXXXXXXX cognito-idp list-users --user-pool-id XXXXXXXXXXXXX --output table > ~/users.txt | |
| # Export as JSON | |
| aws --region XXXXXXXXX cognito-idp list-users --user-pool-id XXXXXXXXXXXXX --output json > ~/users.json | |
| # Export User Pool with more than 60 users (pagination) | |
| aws --region XXXXXXXXX cognito-idp list-users --user-pool-id XXXXXXXXXXXXX --pagination-token INCREDIBLYLONGSTRINGHERE --output json > ~/users-2.json |
| use std::{ | |
| fs::File, | |
| io::{Read, Write}, | |
| time::Instant, | |
| }; | |
| use tokio::task::{self, JoinHandle}; | |
| async fn compute() { | |
| let handles: Vec<JoinHandle<_>> = (0..1000) | |
| .map(|_| { |
| package main | |
| import ( | |
| "fmt" | |
| "os" | |
| "runtime" | |
| "sync" | |
| "time" | |
| ) |
| package reflect_cats_test | |
| import ( | |
| "encoding/json" | |
| "net/url" | |
| "reflect" | |
| "testing" | |
| "github.com/stretchr/testify/assert" | |
| "github.com/stretchr/testify/require" |
| // Save as ~/.ammonite/predef.sc | |
| // To use fs2 from ammonite repl, type `load.fs2` from repl prompt. | |
| // You'll get all fs2 & cats imports, ContextShift and Timer instances | |
| // for IO, and a globalBlocker | |
| import $plugin.$ivy.`org.typelevel:::kind-projector:0.11.0` | |
| if (!repl.compiler.settings.isScala213) | |
| repl.load.apply("interp.configureCompiler(_.settings.YpartialUnification.value = true)") |
:GuiFont Iosevka Term:h15
| </dev/urandom tr -dc 'A-Za-z0-9!"#$%&'\''()*+,-./:;<=>?@[\]^_`{|}~' | head -c 13 ; echo |