This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Builds lua_ipython_kernel on centos | |
ARG IMAGE_BASE="centos" | |
ARG IMAGE_TAG="7" | |
FROM ${IMAGE_BASE}:${IMAGE_TAG} | |
RUN yum install -y \ | |
epel-release \ | |
&& yum install -y \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Dockerfile for Aeron C++ SDK | |
# | |
# Copyright (c) 2017 Neomantra BV | |
# Released under the MIT License, see LICENSE.txt | |
FROM debian:stretch-slim | |
MAINTAINER Evan Wies <evan@neomantra.net> | |
ARG AERON_VERSION="master" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// cc -o bson_float_test bson_float_test.c -lbson-1.0.0 | |
#include <stdio.h> | |
#include <libbson-1.0/bson.h> | |
int main(int argc, const char* argv[]) | |
{ | |
bson_t b; | |
bson_init(&b); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <boost/fusion/adapted/std_tuple.hpp> | |
#include <boost/fusion/algorithm/iteration/for_each.hpp> | |
struct One { | |
int value() const { return 1+rand(); } | |
}; | |
struct Two { | |
int value() const { return 2+rand(); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <boost/fusion/adapted/std_tuple.hpp> | |
#include <boost/fusion/algorithm/iteration/for_each.hpp> | |
struct One { | |
int value() const { return 1+rand(); } | |
}; | |
struct Two { | |
int value() const { return 2+rand(); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local ffi = require("ffi") | |
local new = ffi.new | |
--[[ | |
All numeric calculations are performed with doubles. Using | |
floats for storage saves memory (for big arrays). But arithmetic | |
is usually slower due to the required float<->double conversions. | |
]] | |
local Matrix | |
local MatrixStructure = ffi.typeof("double[16]") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Converts a LuaJIT bytecode number to name | |
-- | |
-- usage: luajit bcname.lua bytecode_number [bytecode_number2 [...]] | |
-- | |
-- example: | |
-- $ luajit-2.1 bcname.lua 71 72 | |
-- VARG | |
-- ISNEXT | |
-- | |
-- From: http://www.freelists.org/post/luajit/frames-and-tail-calls,1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ luajit ~/Desktop/serialize_metamethod.lua | |
2 =%= 3 | |
cdata<struct 98>: 0x0004d738 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local ffi = require 'ffi' | |
local C = ffi.C | |
-- in reality this would be some hashing library, | |
-- but for this example they are dumb functions | |
local hasher = function(x) return tonumber(x) end | |
local H = { | |
hash = hasher, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env luajit | |
-- iteratively allocates of `size` bytes using a specified allocator | |
-- intended to exercise malloc and jemalloc to see where they are allocating memory | |
-- requires the luajit-jemalloc module | |
local num_iters = 5 | |
local alloc = 'malloc' | |
local size = arg[1] and tonumber(arg[1]) or 1000 | |
if arg[2] and arg[2] == 'jemalloc' then alloc = 'jemalloc' end |