Skip to content

Instantly share code, notes, and snippets.

View clementi's full-sized avatar
🎵
NP: Symphony No. 6 in A Minor: I. Allegro … (5:24/23:07)

Jeff Pratt clementi

🎵
NP: Symphony No. 6 in A Minor: I. Allegro … (5:24/23:07)
View GitHub Profile
@clementi
clementi / .scalafmt.conf
Created April 22, 2021 07:05
Scalafmt Configuration
version = "2.7.4"
align.preset = more
align.multiline = true
maxColumn = 100
@clementi
clementi / sbt-plugins.md
Last active May 25, 2021 20:36
sbt plugins
@clementi
clementi / scala-libraries-and-tools.md
Last active October 28, 2022 22:42
Scala Libraries and Tools

Scala Libraries and Tools

A curated List of useful or interesting libraries and tools for Scala programming. See also the Scala Toolbox.

Libraries

Name Description URL
Akka HTTP The Akka HTTP modules implement a full server- and client-side HTTP stack on top of akka-actor and akka-stream. https://doc.akka.io/docs/akka-http/current
Akka Stream The purpose is to offer an intuitive and safe way to formulate stream processing setups such that we can then execute them efficiently and with bounded resource usage—no more OutOfMemoryErrors. https://doc.akka.io/docs/akka/current/stream
@clementi
clementi / g8-templates.md
Last active March 15, 2022 22:42
Useful Giter8 Templates

Useful Giter8 Templates

Name Description
akka/akka-quickstart-scala.g8 A minimal seed template for an Akka with Scala build
clementi/cats-effect-seed.g8 Scala SBT project with Cats and Cats-Effect
devinsideyou/scala3-seed.g8 A Giter8 template for a fully configured Scala3 SBT single but multibuild ready project. It is configured in a slightly opinionated but mostly dependency free fashion.
http4s/http4s.g8 Scala SBT project with http4s
scala/scala-seed.g8 Barebones Scala SBT project
scala/scala3-cross.g8 Scala 3 and Scala 2 cross-compiled sbt template
@clementi
clementi / main.c
Last active March 3, 2021 22:47
Calculate pi by using the formula pi/4 = 1/1 - 1/3 + 1/5 - 1/7 + 1/9 - ...
#include <stdio.h>
#include <stdlib.h>
double calc_pi(int terms) {
double sum = 0;
for (int n = 0; n <= 2 * terms; n++) {
double term = 1.0 / (2 * n + 1);
if (n % 2 == 0) {
sum += term;
@clementi
clementi / Public_Time_Servers.md
Created January 27, 2021 23:52 — forked from mutin-sa/Top_Public_Time_Servers.md
List of Top Public Time Servers

Google Public NTP [AS15169]:

time.google.com

time1.google.com

time2.google.com

time3.google.com

@clementi
clementi / x.sh
Created July 29, 2020 19:57
Do something n times
#!/usr/bin/env sh
# run like this: x 5 uuidgen
function x {
for _ in {1..$1};
do
output=$(${*:2})
echo "$output"
done
@clementi
clementi / Kleenean.scala
Last active February 21, 2020 19:10
Kleene (three-valued) logic (Scala)
trait Expression
case class Not(expression: Expression) extends Expression
case class And(left: Expression, right: Expression) extends Expression
case class Or(left: Expression, right: Expression) extends Expression
case class Implies(left: Expression, right: Expression) extends Expression
case class Equivalent(left: Expression, right: Expression) extends Expression
trait Kleenean extends Expression {
def neg: Kleenean
@clementi
clementi / Cache.scala
Last active February 21, 2020 23:01
"Immutable" cache using the State monad
import java.time.{Duration, LocalDateTime}
import cats.data.State
import State._
object Cache {
def insert[K, V](key: K, value: V): State[Cache[K, V], Unit] =
modify[Cache[K, V]](_.insert(key, value))
def lookup[K, V](key: K): State[Cache[K, V], Option[V]] = {
@clementi
clementi / colorize.sh
Last active February 24, 2020 15:14
Get Pygments to highlight SBT files and other common scripts without their file extensions
#!/usr/bin/env sh
if [ $# -eq 0 ]; then
echo "Filename required."
exit -1
fi
filename=$(basename -- "$1")
extension="${filename##*.}"