Skip to content

Instantly share code, notes, and snippets.

View azolotko's full-sized avatar
🛠️

Alex Zolotko azolotko

🛠️
  • Zaandam, The Netherlands
View GitHub Profile
@azolotko
azolotko / build.sbt
Last active November 23, 2022 14:21
Generating a scratch-based container image with a GraalVM static native-image binary (via sbt-native-packager's GraalVMNativeImagePlugin and DockerPlugin)
enablePlugins(
GraalVMNativeImagePlugin,
DockerPlugin
)
GraalVMNativeImage / containerBuildImage := Some("ghcr.io/graalvm/native-image")
GraalVMNativeImage / graalVMNativeImageOptions += "--static"
GraalVMNativeImage / packageBin := (GraalVMNativeImage / packageBin).map { f =>

Understanding Comparative Benchmarks

I'm going to do something that I don't normally do, which is to say I'm going to talk about comparative benchmarks. In general, I try to confine performance discussion to absolute metrics as much as possible, or comparisons to other well-defined neutral reference points. This is precisely why Cats Effect's readme mentions a comparison to a fixed thread pool, rather doing comparisons with other asynchronous runtimes like Akka or ZIO. Comparisons in general devolve very quickly into emotional marketing.

But, just once, today we're going to talk about the emotional marketing. In particular, we're going to look at Cats Effect 3 and ZIO 2. Now, for context, as of this writing ZIO 2 has released their first milestone; they have not released a final 2.0 version. This implies straight off the bat that we're comparing apples to oranges a bit, since Cats Effect 3 has been out and in production for months. However, there has been a post going around which cites various compar

@spaced
spaced / fixes.md
Last active December 29, 2023 13:07
wayland tweaks

scaling hidpi: everything is very small needed steps:

  • settings -> display -> scale = 1
  • settings -> enforce fonts dpi -> 162dpi
  • settings -> symbols -> scale up

meta/win/idea issue:

  • settings -> input -> keyboard -> extended -> toggle left alt with left win
  • idea: help -> custom properties:
@jooeycheng
jooeycheng / ruby_generate_pubkey.rb
Last active May 5, 2023 01:03
Ruby OpenSSL::PKey::RSA generate RSA Public Key from Modulus and Exponent
# [A] OpenSSL::PKey::RSA has undocumented `e=' and `n=' methods
exponent = "10001"
modulus = "9201EBD5DC974FDE613A85AFF2728627FD2C227F18CF1C864FBBA3781908BB7BD72C818FC37D0B70EF8708705C623DF4A9427A051B3C8205631716AAAC3FCB76114D91036E0CAEFA454254D135A1A197C1706A55171D26A2CC3E9371B86A725458E82AB82C848AB03F4F0AF3127E7B2857C3B131D52B02F9A408F4635DA7121B5B4A53CEDE687D213F696D3116EB682A4CEFE6EDFC54D25B7C57D345F990BB5D8D0C92033639FAC27AD232D9D474896668572F494065BC7747FF4B809FE3084A5E947F72E59309EDEAA5F2D81027429BF4827FB62006F763AFB2153C4A959E579390679FFD7ADE1DFE627955628DC6F2669A321626D699A094FFF98243A7C105"
rsa = OpenSSL::PKey::RSA.new
e = exponent.to_i(16)
n = modulus.to_i(16)
rsa.e = OpenSSL::BN.new(e)
rsa.n = OpenSSL::BN.new(n)
@julien-truffaut
julien-truffaut / NestedCoproduct.scala
Last active February 8, 2019 12:28
Free Monad with nested Coproduct
package sandbox
import cats.data.Coproduct
import cats.free.{Free, Inject}
sealed trait Alg1[A]
sealed trait Alg2[A]
sealed trait Alg3[A]
class Alg1Ops[F[_]](implicit I: Inject[Alg1, F]){
(require '[clojure.core.async :as a])
(def xform (comp (map inc)
(filter even?)
(dedupe)
(flatmap range)
(partition-all 3)
(partition-by #(< (apply + %) 7))
(flatmap flatten)
(random-sample 1.0)
@gavinking
gavinking / memoize.ceylon
Last active September 7, 2017 15:21
A useful generic function to memoize a function or method, or canonicalize a class. (Tested on Ceylon 1.1 - may not work in 1.0.)
"A generic function that produces a memoized version
of the given [[function|fun]]. Works for any function
arity."
Callable<Return,Args> memoize<Return,Args>(Callable<Return,Args> fun)
given Args satisfies Anything[] {
value cache = HashMap<Args,Return&Object|Finished>();
function callFun(Args args) {
//we'll use finished as a convenient
//unit value to represent the case
//that the function returned null
class SocialNotifier
include Celluloid
attr_reader :status
def intialize(&block)
@block = block
end
def run
(ns demo.client
(:require [enfocus.core :as ef]
[enfocus.events :as events]
[vertx.client.eventbus :as eb])
(:require-macros [enfocus.macros :as em]))
(defn open-eventbus
"Opens a connection to the remote EventBus endpoint."
[& on-open]
(let [eb (eb/eventbus "http://localhost:8081/eventbus")]