Skip to content

Instantly share code, notes, and snippets.

Alexander Gladysh agladysh

Block or report user

Report or block agladysh

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View README.md

A treemap recursively subdivides area into rectangles; the area of any node in the tree corresponds to its value. This example uses color to encode different packages of the Flare visualization toolkit. Treemap design invented by Ben Shneiderman. Squarified algorithm by Bruls, Huizing and van Wijk. Data courtesy Jeff Heer.

@agladysh
agladysh / nginx2csv.lua
Last active Dec 12, 2015
Released under MIT license
View nginx2csv.lua
-- For nginx combined log format:
-- http://nginx.org/en/docs/http/ngx_http_log_module.html#log_format
local query = '^'
.. '(%d+%.%d+%.%d+%.%d+)%s' -- IP
.. '%-%s' -- separator
.. '(.-)%s' -- Remote user, TODO: Support
.. '%[(.-)%]%s' -- Date, time
.. '"(.-)"%s' -- request
.. '(%d+)%s' -- HTTP status code
.. '(%d+)%s' -- body_bytes_sent
@agladysh
agladysh / gist:1850707
Created Feb 17, 2012
Weird Lua crash with Adobe Alchemy
View gist:1850707
https://github.com/lua-alchemy/lua-alchemy/compare/ag/150/weird-bugs...ag/150/debug-output
[SWF] LuaAlchemyiOSTest.swf - 4,676,970 bytes after decompression
initializing 6...
0010 -- BEGIN
0020
0030
0040
0050
0051 -- luaL_openlibs BEGIN 1
@agladysh
agladysh / load_args.c
Created Nov 21, 2011
LJ2 lua_tolstring issue
View load_args.c
#include <string.h>
#include <lua.h>
#include <lauxlib.h>
#define MAXARGS (256)
static int load_args(
lua_State * L,
int idx, /* index of first argument */
View bad.json
{
"f5e4d821-75b2-45ee-b255-ce72817ab774": {
"14893fe4-d878-4b53-8bd6-3dfb059bd9b8": 0,
"e0fc313e-7ad3-4fb3-9a68-0dc133fcdb54": 0,
"8240b7bd-e599-4beb-878a-b2e845cdee8a": 1,
"7f0a901f-a000-482c-bbcb-f346452e6b16": "69476aa8-c739-4442-969b-605df8ec4805"
},
"81c2051a-e824-45d2-82b9-68f9c13859ee": {
"16845c1f-a576-4c18-b8b2-d76dc7468182": {
"88464518-baf4-488d-87ba-8842660b8b36": {
@agladysh
agladysh / console.log
Created Apr 23, 2011
lua-zmq inverted pub-sub problem
View console.log
# Spawn receiver 1
$ lua receiver.lua &
[1] 9728
R 9728 init
R 9728 create socket
R 9728 bind socket
R 9728 subscribe
R 9728 before receive msg loop
@agladysh
agladysh / with_coroutines.lua
Created Apr 18, 2011
Example for using coroutine-based workarounds for blocking callbacks in Lua Alchemy (issue #121)
View with_coroutines.lua
-- See http://code.google.com/p/lua-alchemy/issues/detail?id=121
-- Example. Actual implementation should reuse as much resources as possible.
-- Code is not tested.
local sleep = function(interval)
local timer = as3.class.flash.utils.Timer.new(interval)
local function callback()
if timer then
timer.stop()
timer.removeEventListener(
@agladysh
agladysh / INFO
Created Apr 3, 2011
SELECT does not^H^H^H work while LOADING in Redis 2.2.2 (it does!)
View INFO
$ redis-cli info
redis_version:2.2.2
redis_git_sha1:00000000
redis_git_dirty:0
arch_bits:32
multiplexing_api:epoll
process_id:3989
uptime_in_seconds:586
uptime_in_days:0
lru_clock:161962
@agladysh
agladysh / check_keys_escaped.lua
Created Apr 3, 2011
Redis keys are not escaped
View check_keys_escaped.lua
pcall(require, 'luarocks.require')
local sidereal = require 'sidereal' -- sudo luarocks install sidereal --from=http://luarocks.org/repositories/rocks-cvs
--------------------------------------------------------------------------------
-- Some value printing code
--------------------------------------------------------------------------------
require 'lua-nucleo.module' -- sudo luarocks install lua-nucleo
require 'lua-nucleo.strict'
View check_exists_pipeline.lua
pcall(require, 'luarocks.require')
local sidereal = require 'sidereal' -- sudo luarocks install sidereal --from=http://luarocks.org/repositories/rocks-cvs
--------------------------------------------------------------------------------
-- Some value printing code
--------------------------------------------------------------------------------
require 'lua-nucleo.module' -- sudo luarocks install lua-nucleo
require 'lua-nucleo.strict'
You can’t perform that action at this time.