Skip to content

Instantly share code, notes, and snippets.

pthread_setschedparam failed: Operation not permitted
This VM uses a separate heartbeat thread to update its internal clock
and handle events. For best operation, this thread should run at a
higher priority, however the VM was unable to change the priority. The
effect is that heavily loaded systems may experience some latency
issues. If this occurs, please create the appropriate configuration
file in /etc/security/limits.d/ as shown below:
cat <<END | sudo tee /etc/security/limits.d/pharo.conf
* hard rtprio 2
@deech
deech / binarytrees.nim
Created March 13, 2019 20:58
Binary tree benchmark [Nim]
import threadpool, strformat, os, strutils, math
type
Tree = ref object
left: Tree
right: Tree
proc deepCopy[T](x: var T, y: T) =
x = y
proc check(t: Tree): int32 =
@deech
deech / compiletimefizzbuzz.nim
Created June 7, 2019 23:10
Compile Time FizzBuzz In Nim
import math
proc fizzbuzz(n: int) {.compileTime.} =
for i in 1 .. n:
let
by3 = (i mod 3) == 0
by5 = (i mod 5) == 0
if (by3 and by5): echo "FizzBuzz"
elif by3: echo "Fizz"
elif by5: echo "Buzz"
else: echo $i
@deech
deech / recordupdate.hs
Last active January 30, 2021 00:35
Record Update with RecordWildCards
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns#-}
data C = C { c::[Int] } deriving Show
data B = B { b::Bool, c::C } deriving Show
data A = A { a::String, b::B } deriving Show
mkA = A "hello world" (B True (C [1,2,3]))