Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@kn666
kn666 / nginx.conf
Created June 3, 2019 06:47 — forked from RunsFor/nginx.conf
HTTP terminating tools comparison in tarantool (MacBook Pro 13 2017 3.5 Ghz Intel Core i7, 16GB)
worker_processes 8;
error_log logs/error.log info;
events {
worker_connections 4096;
}
http {
include mime.types;
default_type application/octet-stream;
access_log off;
sendfile on;
@kn666
kn666 / parallels_tools_ubuntu_new_kernel_fix.md
Created May 24, 2018 11:50 — forked from rudolfratusinski/parallels_tools_ubuntu_new_kernel_fix.md
Parallels Tools fix for Ubuntu 18.04 and other Linux distributions with Kernel version >= 4.15

Preparation

  • In open Ubuntu 18.04 machine click Parallels Actions -> "Install Parallels Tools"

  • A "Parallels Tools" CD will popup on your Ubuntu desktop.

  • Open it by double mouse click, copy all the content to a new, empty directory on a desktop, name it for e.g. "parallels_fixed"

  • Open terminal, change directory to parallels_fixed (cd ~/Desktop/parallels_fixed)

  • Make command line installer executable (chmod +x install)

  • Change directory to "installer" (cd installer)

  • Make few other scripts executable: chmod +x installer.* *.sh prl_*

@kn666
kn666 / super-gc.lua
Created May 4, 2018 07:32 — forked from Mons/super-gc.lua
Class, super and gc
local weak = setmetatable({},{__mode = 'v'})
do
local Class = {}
-- function Class:super( class,method )
-- return function ()
-- print("work")
-- end
-- end
function Class:test()
self:super(Class,'method')()
@kn666
kn666 / pool.lua
Created May 4, 2018 07:31 — forked from Mons/pool.lua
Connection pool draft
local obj = require('obj')
local fiber = require('fiber')
local log = require('log')
local remote = require('net.box')
local pool = obj.class({},'pool')
function pool:_init(cfg)
local zones = {}
self.total = 0
if gr == nil then
gr = { version = 1.0 };
else
gr.version = 1.0
end
-- gr['defschema'] = '1s30s 1s7d 1m3M'
gr['defschema'] = '1s30s'
gr['defagg'] = 'avg'
gr.port = 22003
@kn666
kn666 / jobserver.lua
Created April 20, 2018 19:21 — forked from rybakit/jobserver.lua
tarantool/queue config example
queue = require('queue')
local function start(config)
box.once('jobserver:v0.1.0', function()
local tube = queue.create_tube('default', 'fifottl', {if_not_exists = true})
end)
end
local function stop()
end
#!/usr/bin/tarantool
------------------------------------- Импортируем встроенные библиотеки ------------------------------------------
json = require('json')
yaml = require('yaml')
fiber = require('fiber')
msgpack = require('msgpack')
-------------------------------------------------- Конфиг базы ------------------------------------------------------
@kn666
kn666 / cqueues-fifo.lua
Created April 16, 2018 11:58 — forked from daurnimator/cqueues-fifo.lua
Wrapper around fifo.lua using cqueues to implement non-blocking queues.
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();
@kn666
kn666 / pointer.lua
Created April 16, 2018 09:02 — forked from daurnimator/pointer.lua
A small library that will let you use luajit cdata how you would hope.
local ffi=require"ffi"
local topointer
local pointer_mt
local key_address , key_ctype , key_cdata , key_methods = {},{},{},{}
local function ispointer ( ob )
return getmetatable ( ob ) == pointer_mt
end
local function denormalise ( ob )
@kn666
kn666 / tarantool_cqueues.lua
Created April 15, 2018 14:10 — forked from daurnimator/tarantool_cqueues.lua
Tarantool + cqueues for lua-http
-- This code monkey patches cqueues primitives to allow for transparent use of cqueues inside of tarantool
local cqueues = require "cqueues"
local socket = require "socket" -- https://tarantool.org/en/doc/1.7/reference/reference_lua/socket.html (not luasocket)
local old_step; old_step = cqueues.interpose("step", function(self, timeout)
if cqueues.running() then
return old_step(self, timeout)
else
local t = self:timeout() or math.huge