Skip to content

Instantly share code, notes, and snippets.

Alexey Melnichuk moteus

Block or report user

Report or block moteus

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 luaxx.h
/* vim: set et sw=3 tw=0 fo=croqlaw cino=t0:
*
* Luaxx, the C++ Lua wrapper library.
* Copyright (c) 2006-2007 Matthew A. Nicholson
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
@moteus
moteus / get_win_ver.lua
Last active Dec 21, 2015
Detecting windows and service pack versions
View get_win_ver.lua
local function exec(str)
local f, err = io.popen(str .. " 2>&1", "r")
if not f then return nil, err end
local str, err = f:read("*all")
f:close()
if str then return str end
return str, err
end
local WINVER = {
@moteus
moteus / bzmsg.hpp
Created Jan 10, 2014
Binary zeromq message class.
View bzmsg.hpp
#ifndef __BZMSG_H_INCLUDED__
#define __BZMSG_H_INCLUDED__
#include <zmq.hpp>
#include <vector>
#include <list>
#include <iostream>
#include <iomanip>
#include <string>
@moteus
moteus / lakeconfig.lua
Last active Apr 10, 2016
lake file for luaffi library
View lakeconfig.lua
J = path.join
function dasc_target(t)
local DASC = LUA_EXE .. ' ' .. path.join('dynasm', 'dynasm.lua')
local dasc_h = {}
for name, args in pairs(t) do
local dasc = target(name .. ".h", args[1] .. ".dasc", DASC .. ' ' .. (args[2] or "") .. ' -o $(TARGET) $(DEPENDS) ')
table.insert(dasc_h, dasc)
end
return dasc_h
@moteus
moteus / output.txt
Last active Jul 14, 2016
Test zmq poll with inproc transport using libuv
View output.txt
ZMQ Version: 4 2 0
Timer recv: hello #1
Timer recv: hello #2
Timer recv: hello #3
Timer recv: hello #4
No messages ([ZMQ][EAGAIN] Resource temporarily unavailable (11))
Poll recv: hello #5
Poll recv: hello #6
Poll recv: hello #7
Poll recv: hello #8
@moteus
moteus / add_call_block.lua
Created Sep 2, 2016
Add call block number to FusionPBX
View add_call_block.lua
-- In dialplan
--
-- actin set pin_number=123456
-- actin lua add_call_block.lua
--
require "resources.functions.split"
local Database = require "resources.functions.database"
local log = require "resources.functions.log".call_block
View service
-- File to conrol FusionPBX Lua services/monitors
-- @usage:
-- # stop `call_flow_subscribe` monitor
-- fs_cli -x "lua service flow shutdown"
-- # stop `mwi_subscribe` monitor
-- fs_cli -x "lua service mwi shutdown"
require "resources.functions.config"
local log = require "resources.functions.log".service
View apply_var.lua
local log = require "resources.functions.log".apply_var
function apply_global_var(str, t)
return (string.gsub(str, "$${.-}", function(key)
key = string.sub(key, 4, -2)
local var = t and t[key] or freeswitch.getGlobalVariable(key)
if not var then
log.warningf("unknown global variable: %s", key)
end
return var or ''
@moteus
moteus / fax_queue_monitor.lua
Last active Dec 14, 2016
FusionPBX fax_queue_monitor based on EventCounsumer class
View fax_queue_monitor.lua
require "resources.functions.config"
require "resources.functions.split"
local log = require "resources.functions.log".fax_queue_monitor
local Next = require "app.fax.resources.scripts.queue.next"
local EventConsumer = require "resources.functions.event_consumer"
local pid_file = scripts_dir .. "/run/fax_queue.tmp"
local events = EventConsumer.new(pid_file)
@moteus
moteus / fsc.lua
Last active Dec 14, 2016
FusionPBX service control script
View fsc.lua
-- File to conrol FusionPBX Lua services/monitors
-- @usage:
-- # stop `call_flow_subscribe`
-- fs_cli -x "lua fsc.lua flow shutdown"
local destination = assert(argv[1])
local command = assert(argv[2])
local event = freeswitch.Event("CUSTOM", "fusion::" .. destination .. "::" .. command);
event:fire()
You can’t perform that action at this time.