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.
(* an abstract signature for instantiations of the existential quantifier *) | |
module type EXISTS = | |
sig | |
(* the predicate *) | |
type 'a phi | |
(* the existential type *) | |
type t | |
(* the introduction rule *) |
package cqrs | |
package eventstore | |
import zio.* | |
import zio.prelude.* | |
import zio.prelude.fx.* | |
object BaseSyntax: | |
type Program[S, R, E, A] = ZPure[Nothing, S, S, R, E, A] |
// Inspired by a tweet from @trautonen 1/13/2016 | |
// Use Source.unfoldAsync to turn paginated database results into an akka-streams Source | |
// unfold is the inverse of fold | |
case class Page[T](pageNumber:Long, totalPages:Long, contents:List[T]) | |
case class Thing(id: Long, name: String = "foo") | |
val totalPages = 5 // | |
val pageSize = 3 |
import * as pulumi from '@pulumi/pulumi'; | |
import * as gcp from '@pulumi/gcp'; | |
import * as k8s from '@pulumi/kubernetes'; | |
import * as k8sInputApi from '@pulumi/kubernetes/types/input'; | |
const serviceAccountKeys = new Map<string, gcp.serviceAccount.Key>(); | |
/** | |
* Creates a service account and key, and sets the cloudsql.client role in IAM. | |
*/ |
trait Coercible[A, B] { | |
def coerce(a: A): B | |
} | |
def coerce[A, B](a: A)(implicit coerceAB: Coercible[A, B]): B = { | |
coerceAB.coerce(a) | |
} | |
trait Newtype[+T] { | |
val value: T |
In your command-line run the following commands:
brew doctor
brew update
import Control.Monad | |
------------------------------------------------------------------------------- | |
-- State Monad Implementation | |
------------------------------------------------------------------------------- | |
newtype State s a = State { runState :: s -> (a,s) } | |
instance Monad (State s) where | |
return a = State $ \s -> (a, s) |
""" | |
Given a dictionary, transform it to a string. Then byte encode that string. Then base64 encode it and since this will go | |
on a url, use the urlsafe version. Then decode the byte string so that it can be else where. | |
""" | |
data = base64.urlsafe_b64encode(json.dumps({'a': 123}).encode()).decode() | |
# And the decode is just as simple... | |
data = json.loads(base64.urlsafe_b64decode(query_param.encode()).decode()) | |
# Byte encode the string, base64 decode that, then byte decode, finally transform it to a dictionary |
package org.example; | |
import scala.Function1; | |
import scala.collection.generic.CanBuildFrom; | |
import scala.collection.immutable.List; | |
import scala.collection.immutable.List$; | |
import scala.collection.immutable.Vector; | |
import scala.collection.immutable.Vector$; | |
import scala.collection.mutable.Builder; |