Skip to content

Instantly share code, notes, and snippets.

@kanaka
kanaka / run.sh
Created December 1, 2017 22:45
mal run script for running low-level code within qemu/kvm
#!/bin/bash
(
sleep 0.1
while ! exec 3<> /dev/tcp/localhost/21118; do
sleep 0.1
done
while read -u 3 -r cmd arg1; do
case ${cmd} in
slurp:)
if [ -r "${arg1}" ]; then
Redmonk Jun 2017
http://redmonk.com/sogrady/2017/06/08/language-rankings-6-17/
Tiobe Jul 2017
http://www.tiobe.com/tiobe_index
PYPL (Jun 28, 2017)
http://pypl.github.io/PYPL.html
Programming Language Popularity Chart (Jul 11, 2017)
global glob
import glob, re
class dstat_scboot(dstat):
def __init__(self):
self.name = 'scboot monitor'
self.format = ('d', 6, 100)
self.vars = ('count', 'kernel', 'fabric', 'preinit', 'slurm')
self.nick = ('secs', 'kernel', 'fabric', 'initfs', 'slurm')
#self.vars = ('count', 'kernel', 'fabric', 'preinit', 'slurm', 'logins')
@kanaka
kanaka / mal-wasm.txt
Last active May 9, 2017 14:28
Build/run mal wasm implementation
$ docker run -it -v $HOME/Code/MAL:/mal -w /mal -it kanaka/emscripten bash
/mal# export PATH=$PATH:/mal/wac
/mal# make test^wasm^step0
@kanaka
kanaka / mal_stats.txt
Last active July 17, 2018 00:34
mal implementation LOC/file size stats
* Full stats
for i in $(make print-IMPLS); do s=$(make stats^$i | grep total); printf "%-9s %s\n" "$i" "$s"; done | sort -n -k2
mal 306 983 7627 total
factor 427 2669 14164 total
clojure 429 1424 12248 total
hy 456 1982 15365 total
perl6 504 2168 16202 total
ruby 510 1637 14189 total
es6 557 2259 17682 total
[2a5c261150a330] {jit-log-opt-loop
# Loop 1 (0x30c get_local(0x14)) : loop with 194 ops
[i0, i1, i2, p3, p4, p5, p6]
+407: label(i0, i1, i2, p3, p4, p5, p6, descr=TargetToken(139953923088416))
debug_merge_point(0, 0, '0x30c get_local(0x14)')
+416: i8 = int_add(i0, 1)
+427: i10 = int_lt(i1, 0)
+435: guard_false(i10, descr=<Guard0x7f498fdf2020>) [i2, i1, i8, p6, p5, p4, p3]
+441: p11 = getarrayitem_gc_r(p5, i1, descr=<ArrayP 8>)
+460: i13 = int_lt(i8, 0)
[296568f953bd68] {jit-log-opt-loop
# Loop 1 (0x30c get_local(0x14)) : loop with 191 ops
[i0, i1, i2, p3, p4, p5, p6]
+375: label(i0, i1, i2, p3, p4, p5, p6, descr=TargetToken(139900644630560))
debug_merge_point(0, 0, '0x30c get_local(0x14)')
+384: i8 = int_add(i0, 1)
+395: i10 = int_lt(i1, 0)
+403: guard_false(i10, descr=<Guard0x7f3d283a8020>) [i2, i1, i8, p6, p5, p4, p3]
+409: p11 = getarrayitem_gc_r(p5, i1, descr=<ArrayP 8>)
+428: i13 = int_lt(i8, 0)
[279fff6c334719] {jit-log-opt-loop
# Loop 1 (0x32a end(0xf)) : loop with 138 ops
[p0, p1, p2, p3, p4]
+343: label(p0, p1, p2, p3, p4, descr=TargetToken(139680798449696))
+352: p6 = call_r(ConstClass(pop_sig), p1, p2, p3, descr=<Callr 8 rrr EF=5>)
+423: guard_no_exception(descr=<Guard0x7f09f85fe020>) [p6, p4, p3, p2, p1, p0]
+438: guard_class(p6, ConstClass(Function), descr=<Guard0x7f09f85f0060>) [p6, p4, p3, p2, p1, p0]
+450: i8 = getfield_gc_i(p4, descr=<FieldS list.length 8>)
+461: i10 = int_sub(i8, 1)
+465: p11 = getfield_gc_r(p4, descr=<FieldP list.items 16>)
@kanaka
kanaka / addTwo.wast
Last active June 17, 2021 21:39
Run wast (WebAssembly) in node
(module
(func $addTwo (param i32 i32) (result i32)
(i32.add
(get_local 0)
(get_local 1)))
(export "addTwo" (func $addTwo)))
@kanaka
kanaka / core.json
Created February 15, 2017 21:32
miniMAL cljs core library
["do",
["def", "clj-str", "str"],
["def", "clj-println", "println"],
["def", "clj-list?", "list?"],
["def", "clj-contains?", "contains?"],
["def", "clj-keys", "keys"],
["def", "clj-vals", "vals"],
["def", "new", ["fn", ["a", "&", "b"],