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 net_box = require('net.box') | |
local fiber = require('fiber') | |
local clock = require('clock') | |
local CONN_STRING = 'localhost:3301' -- SET UP CONECTION STRING TO YOUR ROUTER / PLAIN TARANTOOL | |
local WORKER_COUNT = 256 -- SET UP NUMBER OF PARALLEL REQUESTS HERE | |
local conn = assert(net_box.connect(CONN_STRING)) |
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
--- RSA bindings for Tarantool | |
--- Carefully adapted from https://github.com/spacewander/lua-resty-rsa | |
local bit = require "bit" | |
local band = bit.band | |
local ffi = require "ffi" | |
local ffi_new = ffi.new | |
local ffi_gc = ffi.gc | |
local ffi_copy = ffi.copy | |
local ffi_str = ffi.string |
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
[ | |
{ | |
"name": "Account", | |
"type": "record", | |
"logicalType": "Aggregate", | |
"fields": [ | |
{"name": "id", "type": "int"}, | |
{"name": "name", "type": ["null", "string"], "default": null} | |
], | |
"indexes": ["id", "name"], |
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 | |
-- Sets common rocks paths so that the app can be started from any | |
-- directory | |
-- | |
-- By default, when you do require('mymodule'), tarantool looks into | |
-- the current working directory and whatever is specified in | |
-- package.path and package.cpath. If you run your app while in the | |
-- root directory of that app, everything goes fine, but if you try to | |
-- start your app with "tarantool myapp/init.lua", it will fail to load | |
-- its modules, and modules from myapp/.rocks. |
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
def mult(v1, v2): | |
"""vX is array of int pairs, e. g. [(6, 2), [7,3 ]] which is equivalent to vector (6, 6, 7, 7, 7) """ | |
result = 0 | |
position1 = -1 | |
position2 = -1 | |
counter1 = 0 | |
counter2 = 0 | |
while True: | |
assert counter1 >= 0 and counter2 >= 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 uuid = require('uuid') | |
local log = require('log') | |
box.cfg{} | |
box.schema.create_space('test', {if_not_exists=true }) | |
box.space.test:create_index('primary', {parts={1,'string'}, if_not_exists=true}) | |
for i = 1,1000000 do | |
box.space.test:replace({uuid.new():str(), 'test', 'testtesttesttesttesttesttesttesttesttesttesttest'}) | |
end |
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 fio = require('fio') | |
local log = require('log') | |
local json = require('json') | |
local utf = require('utf8') | |
box.cfg({}) | |
--- specify data schema | |
box.once('init_addresses', function() | |
box.schema.create_space('address') |
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 fiber = require('fiber') | |
function another_func() | |
fiber.sleep(1) | |
fiber.yield() | |
end | |
function test() | |
local fib = fiber.create(another_func) | |
fib:set_joinable(true) |
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
function utils.urlencode(data) | |
if type(data) == 'string' then | |
if data then | |
local res = string.gsub(data, '\n', '\r\n') | |
res = string.gsub(res, '([^%w _.~-])', function(c) | |
return string.format('%%%02X', string.byte(c)) | |
end) | |
return string.gsub(res, ' ', '+') | |
end | |
elseif type(data) == 'number' then |
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
d:cia d.sharonov$ docker build . | |
Sending build context to Docker daemon 60.7MB | |
Step 1/5 : FROM centos:7 | |
---> 49f7960eb7e4 | |
Step 2/5 : COPY ./SDK /root/SDK | |
---> Using cache | |
---> 6c60e5bb0d31 | |
Step 3/5 : COPY ./cia /root/cia | |
---> Using cache | |
---> 4462b7b2da25 |
NewerOlder