Skip to content

Instantly share code, notes, and snippets.


Mamy Ratsimbazafy mratsim

Block or report user

Report or block mratsim

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
mratsim /
Last active Nov 11, 2019
Some design questions on Threading API
  • Atomic Rc vs Rc taxes for single-threaded module compile with threads:on
  • API to allow to switch runtimes:
    • Simple threadpool, custom one
    • Throughput optimized (work-stealing)
    • Latency-optimized (Earliest Deadline First schedulers / priority queues)
    • Plug in Cuda/OpenCL async (Streams and Command Queue) or external system like MPI, (Hadoop/Kafka?) etc
  • 2 spawns
    • spawn that access a global default threadpool for Nim programs composability
    • spawn that takes a threadpool as first argument
mratsim / experimental.go
Created Nov 7, 2019 — forked from protolambda/experimental.go
Binary Tree as immutable state backing, with rebinding pattern for minimal copy-on-write modifications. Every merkle cached *by default*.
View experimental.go
package experimental
import "encoding/binary"
// Experimental code! Everything a tree and cached by default.
type HashFn func(a Root, b Root) Root
// A link is called to rebind a value
mratsim / 2019-11-07 Eth2 impl
Last active Nov 7, 2019
2019-11-07 Eth2 impl call
View 2019-11-07 Eth2 impl


nim c --passC:"-fno-asynchronous-unwind-tables -fno-exceptions -fno-rtti -fverbose-asm -masm=intel -S" -d:release --noLinking:on "path/to/file.nim"

The result will be in $HOME/.cache/file_r/file.c.o (_r for release) The C sources or Nim sources (with --debugger:native) will be interleaved with ASM

Otherwise use:

set -eo pipefail
# Clone Nimbus Eth 2
# Read in variables
source "$(dirname "$0")/"
mratsim / myproj.nim
Last active Oct 23, 2019 — forked from xmonader/myproj.nim
View myproj.nim
# This is just an example to get you started. A typical binary package
# uses this file as the main entry point of the application.
import strformat, tables, json, strutils, asyncdispatch, asyncnet, strutils, parseutils, options, net
from cgi import decodeUrl
import terminaltables
import mimetypes
View loopvec.c
// ----------------------------------
// Time measurements
#include <sys/time.h>
#include <time.h>
// Number of seconds since the Epoch
static inline double Wtime_sec(void)
struct timeval tv;
mratsim /
Created Sep 26, 2019 — forked from apahl/
Nim cell magic for Jupyter and JLab Notebooks
Jupyter cell magic for your favorite programming language.
This is now also available as a proper repo:
All further changes will be tracked there.
Requirements: Nim (, nimpy (`nimble install nimpy`, thanks to @yglukhov for this great library!)
mratsim / cpu.nim
Created Aug 29, 2019
CPU info test
View cpu.nim
import std/cpuinfo
import macros
echo "CPU name: ", cpuName()
echo "CPUs: ", countProcessors()
macro checkFeatures(body: untyped) =
result = newStmtList()
for call in body:
mratsim / 20190829 - Eth 2 implementers call
Created Aug 29, 2019
20190829 - Eth 2 implementers call 24
View 20190829 - Eth 2 implementers call
You can’t perform that action at this time.