Skip to content

Instantly share code, notes, and snippets.

View carlosedp's full-sized avatar

Carlos Eduardo carlosedp

View GitHub Profile
@carlosedp
carlosedp / TupleAssign.scala
Last active November 10, 2023 16:42
Direct tuple assignment in for comprehension
// Run with scala-cli TupleAssing.scala
//
// //> using scala "3.3.1"
//> using scala "3.4.0-RC1-bin-20231109-c7b3d7b-NIGHTLY"
//> using lib "dev.zio::zio:2.0.19"
// (required before Scala 3.4)
// //> using options -source:future
import zio.*
diff --git a/apps/plugins/SOURCES b/apps/plugins/SOURCES
index c512a9e..e9d6f58 100644
--- a/apps/plugins/SOURCES
+++ b/apps/plugins/SOURCES
@@ -221,7 +221,7 @@ superdom.c
#endif /* LCD_DEPTH > 1 */
-
+test_disk.c
@carlosedp
carlosedp / httpserver.scala
Last active March 20, 2024 00:57
Scala ZIO-HTTP with logback and GraalVM native-image binary support
// Run with scala-cli httpserver.scala
// Save logback.xml file into ./resources dir
// Before generating native image binary, run first as above and make a real access to the URL
// so the native-image-agent can generate the metadata in ./resources dir.
// Then generate native image binary with: scala-cli package --native-image httpserver.scala
//> using scala "3.3.0"
//> using lib "dev.zio::zio:2.0.15"
//> using lib "dev.zio::zio-http:3.0.0-RC2"
//> using lib "dev.zio::zio-logging-slf4j2::2.1.13"
//> using lib "ch.qos.logback:logback-classic:1.4.8"
@carlosedp
carlosedp / jmh-result.json
Last active October 14, 2024 12:53
Benchmark results for https://github.com/carlosedp/zio-channel/ at 2024-10-14T12:53:54
[
{
"jmhVersion" : "1.37",
"benchmark" : "zio.channel.benchmarks.Benchmarks.sendMessagesZioChannel",
"mode" : "avgt",
"threads" : 1,
"forks" : 1,
"jvm" : "/usr/lib/jvm/temurin-17-jdk-amd64/bin/java",
"jvmArgs" : [
],
[
{
"jmhVersion" : "1.29",
"benchmark" : "bench.PipelineOps.aliased",
"mode" : "avgt",
"threads" : 1,
"forks" : 1,
"jvm" : "/Users/cdepaula/Library/Caches/Coursier/arc/https/github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.3.1/graalvm-ce-java17-darwin-amd64-22.3.1.tar.gz/graalvm-ce-java17-22.3.1/Contents/Home/bin/java",
"jvmArgs" : [
"-XX:ThreadPriorityPolicy=1",
@carlosedp
carlosedp / PipelineBench.scala
Last active June 2, 2023 02:35
Scala JMH Benchmark Samples
// Run with `scli --jmh PipelineBench.scala`, to generate json output, add `-- -rf json` args
//> using scala 3.3.0
//> using options "-Wunused:all"
package bench
import java.util.concurrent.TimeUnit
import scala.util.chaining.*
import org.openjdk.jmh.annotations.*
@carlosedp
carlosedp / docker-compose.yml
Last active April 13, 2023 13:20
ZIO Kafka sample app
# Run with docker-compose up -d
version: "2"
services:
zookeeper:
image: confluentinc/cp-zookeeper:latest
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
ports:
@carlosedp
carlosedp / .gtkwaverc
Created February 11, 2023 14:51
GTKWave config
fontname_signals Menlo 16
fontname_waves Menlo 16
fill_waveform 1
use_roundcaps 1
wave_scrolling 1
disable_mouseover 0
highlight_wavewindow 1
use_scrollwheel_as_y on
@carlosedp
carlosedp / PipelineOps.scala
Last active January 23, 2023 12:42
Pipeline operators in Scala
#!/usr/bin/env -S scala-cli shebang
//> using scala "3"
/** Test functions */
val triple = (x: Int) => 3 * x
val half = (x: Int) => x / 2
val sum = (x: Int) => (y: Int) => x + y
/** with extension infix */
// extension [A, B](a: A)
@carlosedp
carlosedp / MemMask.scala
Last active November 8, 2022 21:16
MemoryMask-Circt+Firtool
//> using scala "2.13.8"
//> using lib "edu.berkeley.cs::chisel3::3.5.4"
//> using lib "com.sifive::chisel-circt::0.6.0"
//> using plugin "edu.berkeley.cs:::chisel3-plugin::3.5.4"
//> using options "-unchecked", "-deprecation", "-language:reflectiveCalls", "-feature", "-Xcheckinit", "-Xfatal-warnings", "-Ywarn-dead-code", "-P:chiselplugin:genBundleElements", "-Ywarn-unused"
import chisel3._
import circt.stage.ChiselStage
import chisel3.stage.ChiselGeneratorAnnotation