Skip to content

Instantly share code, notes, and snippets.

:shipit:

Mamy Ratsimbazafy mratsim

:shipit:
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
mratsim / design_threading_API.md
Last active Nov 11, 2019
Some design questions on Threading API
View design_threading_API.md
  • 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
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
mratsim / 2019-11-07 Eth2 impl call.md
Last active Nov 7, 2019
2019-11-07 Eth2 impl call
View 2019-11-07 Eth2 impl call.md
View compilation_command.md

Either

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:

View make_genesis.sh
#!/bin/bash
set -eo pipefail
# Clone Nimbus Eth 2
SRCDIR=${NIMBUS_PATH:-"nim-beacon-chain"}
# Read in variables
source "$(dirname "$0")/vars.sh"
@mratsim
mratsim / myproj.nim
Last active Oct 23, 2019 — forked from xmonader/myproj.nim
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
type
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
mratsim / nim_magic.py
Created Sep 26, 2019 — forked from apahl/nim_magic.py
Nim cell magic for Jupyter and JLab Notebooks
View nim_magic.py
"""
nim_magic.py
Jupyter cell magic for your favorite programming language.
This is now also available as a proper repo:
https://github.com/apahl/nim_magic
All further changes will be tracked there.
Requirements: Nim (https://nim-lang.org), nimpy (`nimble install nimpy`, thanks to @yglukhov for this great library!)
@mratsim
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
mratsim / 20190829 - Eth 2 implementers call 24.md
Created Aug 29, 2019
20190829 - Eth 2 implementers call 24
View 20190829 - Eth 2 implementers call 24.md
You can’t perform that action at this time.