Skip to content

Instantly share code, notes, and snippets.

View rybakit's full-sized avatar

Eugene Leonovich rybakit

View GitHub Profile
@william8th
william8th / .tmux.conf
Last active July 22, 2024 12:43
Tmux open new pane in same directory
# Set the control character to Ctrl+Spacebar (instead of Ctrl+B)
set -g prefix C-space
unbind-key C-b
bind-key C-space send-prefix
# Set new panes to open in current directory
bind c new-window -c "#{pane_current_path}"
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
@fl00r
fl00r / trie.lua
Created October 28, 2016 11:17
Trie
properties = box.schema.space.create('properties')
properties:create_index('primary', {parts = {1, 'str'}, type = 'HASH', unique = true, if_not_exists = true})
properties:replace({'node_id', 0})
nodes = box.schema.space.create('nodes')
nodes:create_index('primary', {parts = {1, 'num', 2, 'str'}, type = 'TREE', unique = true, if_not_exists = true})
function load_words()
local words = "/opt/dict/words"
for line in io.lines(words) do
@danikin
danikin / tar_test.c
Last active December 18, 2020 07:28
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
//
@mholt
mholt / transcript
Created February 26, 2016 18:42
Is it necessary to consume response body before closing it (net/http client code)?
mholt [9:10 AM]
When using http.Get(), is it really necessary to read the full response body just to close it later?
[9:10]
The docs keep saying `Caller should close resp.Body when done reading from it.` and I keep seeing code like this:
```
io.Copy(ioutil.Discard, resp.Body)
resp.Body.Close()
```
@Ocramius
Ocramius / .gitignore
Last active April 21, 2016 20:05
Benchmarking type-hinted variadic arguments versus looping+checking values
vendor
composer.phar
@rybakit
rybakit / bench_json_vs_msgpack.php
Last active March 30, 2020 09:01
pure msgpack.php vs json extension
<?php
use App\MessagePack\PackedMap;
use App\MessagePack\PackedMapTransformer;
use MessagePack\BufferUnpacker;
use MessagePack\Packer;
use MessagePack\PackOptions;
require __DIR__.'/vendor/autoload.php';
@rtsisyk
rtsisyk / tarantol-modules.rst
Created June 18, 2015 17:31
Tarantool Modules

Modules

Install a module

Use LuaRocks - a Lua package manager.

@kostja
kostja / ansible-sucks
Last active October 15, 2020 11:03
Ansible vs. GNU Make
instances := $(basename $(wildcard *.lua))
hosts := n4 n6 n11 n12 n16 n17 n18 n19 n20
all:
echo "nothing"
start: clean
$(foreach i, $(instances), tarantoolctl $@ $i;)
stop:
@nikic
nikic / BinaryTree.php
Created April 23, 2015 12:16
Tree traversal performance: yield from vs. naive implementation
<?php error_reporting(E_ALL);
class BinaryTree {
private $content, $left, $right;
public function __construct($content, BinaryTree $left = null, BinaryTree $right = null) {
$this->content = $content;
$this->left = $left;
$this->right = $right;
}
@zloidemon
zloidemon / gist:221df66ddc9e9c478b23
Last active August 29, 2015 14:17
Example FIFO queue in tarantool
> curl http://tarantool.org/dist/public.key |apt-key add -
> echo "deb http://tarantool.org/dist/master/ubuntu/ trusty main" > /etc/apt/sources.list.d/tarantool.list
> apt-get update
> apt-get install tarantool luarocks rlwrap
> mkdir ~/.luarocks
> echo "rocks_servers = {[[http://rocks.tarantool.org/]]}" >> ~/.luarocks/config.lua
> luarocks install queue
```lua