Compatible with Lua 5.3
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
const std = @import("std"); | |
const assert = std.debug.assert; | |
const lua_ABI = @cImport({ | |
@cInclude("lua.h"); | |
@cInclude("lauxlib.h"); | |
@cInclude("lualib.h"); | |
}); | |
pub const lua = struct { |
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 telstra_sms_api = require "telstra_sms_api".new | |
local sleep = require "cqueues".sleep | |
if #arg < 2 then | |
io.stderr:write("Expected number and body\n") | |
os.exit(1) | |
end | |
local to = arg[1] | |
local message = table.concat(arg, " ", 2) |
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
const std = @import("std"); | |
const system = switch (std.builtin.os.tag) { | |
.linux => std.os.linux, | |
else => std.os.system, | |
}; | |
const ThreadPool = @This(); | |
max_threads: u16, | |
counter: u32 = 0, |
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 new_fifo = require "fifo" | |
local cqueues = require "cqueues" | |
local cc = require "cqueues.condition" | |
local methods = {} | |
local mt = { | |
__index = methods; | |
} | |
function methods.new(...) | |
local cond = cc.new(); |
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 strbyte = string.byte | |
local bit = require"bit" | |
local band = bit.band | |
local bor = bit.or | |
local lshift = bit.lshift | |
local rshift = bit.rshift | |
local function utf8_to_codepoint ( s , i ) | |
local x = strbyte ( s , i , i ) |
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 <errno.h> | |
#include <stdio.h> | |
#include <unistd.h> | |
#include <netinet/tcp.h> | |
#include <netinet/in.h> | |
#include <arpa/inet.h> | |
#include <sys/socket.h> | |
int main(int argc, char **argv) { | |
int s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); |
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
// zig test bls.zig -I/usr/include -lc -lstdc++ -L/usr/lib -lbls_c256 | |
const std = @import("std"); | |
const assert = std.debug.assert; | |
const testing = std.testing; | |
const BLS = struct { | |
const curves = enum { | |
bls_c256, | |
bls_c384, |
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 tarantool | |
local cqueues = require "cqueues" | |
local fiber = require "fiber" | |
local socket = require "socket" | |
package.loaded["http.client"] = nil -- tarantool has a namespace clash | |
local websocket = require "http.websocket" | |
local cq = cqueues.new() | |
-- Hook up cqueues loop inside tarantool fiber |
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
pkgname=("lua-$_rockname" "lua51-$_rockname" "lua52-$_rockname") | |
makedepends+=('luarocks' 'lua' 'lua51' 'lua52') | |
build() { | |
for lua_ver in 5.1 5.2 5.3; do | |
mkdir -p "$lua_ver" | |
(cd "$lua_ver"; luarocks build --pack-binary-rock --lua-version="$lua_ver" --deps-mode=none --no-manifest "$_rockname"-"$pkgver"-*.rockspec) | |
done | |
} |