Skip to content

Instantly share code, notes, and snippets.

@serafo27
serafo27 / ConcurrencyVsParallelismTest.kt
Created January 20, 2023 09:50
Concurrency vs Parallelism using Kotlin coroutines
import kotlinx.coroutines.*
import org.junit.jupiter.api.Test
import org.slf4j.LoggerFactory
import java.math.BigInteger
import java.util.*
import kotlin.system.measureTimeMillis
import kotlin.time.ExperimentalTime
import kotlin.time.measureTimedValue
class ConcurrencyVsParallelismTest {
@serafo27
serafo27 / K8s_Cheatsheet.md
Last active February 7, 2022 15:00
K8s Cheatsheet

K8s Cheatsheet

Get all the contexts:

kubectl config get-contexts

Get current context:

kubectl config current-context

Select context

kubectl config use-context my-cluster-name

@serafo27
serafo27 / Bowling.hs
Last active August 2, 2019 16:37
Bowling kata haskell
module Bowling where
import Data.Char (digitToInt)
import Data.List.Split (splitOn)
toInt = digitToInt
data Score = Strike | Points Int Int | None | Spare Int
deriving (Eq, Show)
@serafo27
serafo27 / FizzBuzz.hs
Last active July 18, 2019 19:48
FIzz Buzz kata in haskell
module FizzBuzz where
import Data.Maybe
import Data.List
import Data.Char (digitToInt)
type Rule = Int -> Maybe String
fizz = oR (word 3 "fizz") (contains 3 "fizz")
buzz = word 5 "buzz"
@serafo27
serafo27 / abstractClass.js
Created June 7, 2016 09:54
example of abstract, not instantiable, class in javascript
var AbstractClass = (function(){
function AbstractClass() {
if (this.constructor === AbstractClass) {
throw new Error("Can't instantiate abstract class!");
}
};
@serafo27
serafo27 / inheritance.js
Last active June 7, 2016 09:40
example of inheritance in javascript
//father class
var classA = (function() {
function classA() {
this.val1 = "a";
}