Skip to content

Instantly share code, notes, and snippets.

@Mons
Mons / tar_test.c
Created December 14, 2020 13:35 — forked from danikin/tar_test.c
Tarantool Quick Test
// Tarantool quick test
// Copyright, Dennis Anikin 2016
//
// Quick disclaimer:
//
// This test shows 500K-1000K transactions per second on one CPU core
// and 600K-1600K queries per second on one CPU core.
//
// Based on the $6.57 per-month-price for the AWS t2.micro instance we can afford the tremendous number of 630bln queries for just $1
//
@Mons
Mons / fx.lua
Created November 17, 2020 14:51
for _,expr in pairs({
"1",
"N",
"N/2+1",
"N/2+2",
"math.random()"
}) do
local fun,err = loadstring("return "..expr)
if not fun then error("Bad expression '"..expr.."'") end
local count = math.floor(math.random(7))
@Mons
Mons / nginx-proxy-100-continue.patch
Created July 19, 2017 21:34
Disable local 100 continue response, proxy it from upstream
diff -r -u nginx-1.10.3.orig/src/http/ngx_http_core_module.c nginx-1.10.3/src/http/ngx_http_core_module.c
--- nginx-1.10.3.orig/src/http/ngx_http_core_module.c 2017-01-31 18:01:11.000000000 +0300
+++ nginx-1.10.3/src/http/ngx_http_core_module.c 2017-02-13 15:37:11.505036520 +0300
@@ -626,6 +626,13 @@
offsetof(ngx_http_core_loc_conf_t, etag),
NULL },
+ { ngx_string("proxy_100_continue"),
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
+ ngx_conf_set_flag_slot,
@Mons
Mons / change-uuid
Last active February 10, 2020 17:59
UUID Changer for Tarantool storage files
#!/usr/bin/env perl
use 5.010;
use strict;
use File::Find;
use Getopt::Long;
sub usage {
return <<EOF
===============================================================
use 5.016;
use Encode::Base58::GMP;
use Data::UUID;
# '11115QchsAWLTKggVhJEd'
# '00000000-ffff-ffff-0000-000000000000'
# 55b1a44d-e22b-4cf1-9c89-486d20c06adc
# 4da4b155 2be2 f14c 9c89 486d20c06adc
sub listener {
push_read(line => sub {
my $line = shift; # GET / HTTP/1.1
# PUT /file HTTP/1.1
my ($method, $path, $http) = $line =~ m{^(\S+)\s+(\S+)};
# Key: value
# Conetent-Length: 10
#
# body...
#!/usr/bin/env perl
use 5.016;
use integer;
my $n = <>;
local $/ = " ";
$, = " ";
my @bottom;
while (<>) {
@Mons
Mons / super-gc.lua
Created July 29, 2015 21:39
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')()
@Mons
Mons / pool.lua
Created July 29, 2015 23:56
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