commit stringlengths 40 40 | old_file stringlengths 6 92 | new_file stringlengths 6 92 | old_contents stringlengths 0 2.22k | new_contents stringlengths 68 2.86k | subject stringlengths 19 253 | message stringlengths 20 711 | lang stringclasses 1
value | license stringclasses 11
values | repos stringlengths 10 33.5k |
|---|---|---|---|---|---|---|---|---|---|
8c7e3eb8c05d629793e0df02963d2c7d26ce8d8c | media/lua/client/FileLoader.lua | media/lua/client/FileLoader.lua | local STORY_TAGS = { '<title>', '<x>', '<y>', '<z>' };
local MOD_ID = 'RMMuldraughTales';
local STORY_FOLDER = '/stories/'
local function loadStory(id, filename)
local filepath = STORY_FOLDER .. filename;
local reader = getModFileReader(id, filepath, false);
if reader then
local line;
local file = {
content = '',
};
while true do
line = reader:readLine();
-- Checks if EOF is reached.
if not line then
reader:close();
break;
end
-- Look for tags.
local hasTag;
for i = 1, #STORY_TAGS do
local tag = STORY_TAGS[i];
-- Check if the line starts with the current tag.
if line:sub(1, tag:len()) == tag then
-- Remove tag from line.
line = line:sub(tag:len() + 1);
-- Store line using the tag as a key.
file[tag] = line;
hasTag = true;
break;
end
end
if not hasTag then
file.content = file.content .. '\n';
end
end
return file;
else
print(string.format("Can't read story from %s.", filepath));
end
end
local function loadStories()
local file = loadStory(MOD_ID, 'Test.txt');
print(file.title);
print(file.x, file.y, file.z);
print(file.content);
end
Events.OnGameBoot.Add(loadStories);
| local STORY_TAGS = { '<title>', '<x>', '<y>', '<z>' };
local MOD_ID = 'RMMuldraughTales';
local STORY_FOLDER = '/stories/'
local function loadStory(id, filename)
local filepath = STORY_FOLDER .. filename;
local reader = getModFileReader(id, filepath, false);
if reader then
local line;
local file = {
content = '',
};
while true do
line = reader:readLine();
-- Checks if EOF is reached.
if not line then
reader:close();
break;
end
-- Look for tags.
local hasTag;
for i = 1, #STORY_TAGS do
local tag = STORY_TAGS[i];
-- Check if the line starts with the current tag.
if line:sub(1, tag:len()) == tag then
-- Remove tag from line.
line = line:sub(tag:len() + 1);
-- Store line using the tag as a key after removing the < and > symbols.
tag = tag:gsub("[<>]", "")
file[tag] = line;
hasTag = true;
break;
end
end
if not hasTag then
file.content = file.content .. '\n';
end
end
return file;
else
print(string.format("Can't read story from %s.", filepath));
end
end
local function loadStories()
local file = loadStory(MOD_ID, 'Test.txt');
print(file.title);
print(file.x, file.y, file.z);
print(file.content);
end
Events.OnGameBoot.Add(loadStories);
| Remove the < and > symbols when storing the tag in the file table | Remove the < and > symbols when storing the tag in the file table
| Lua | mit | rm-code/muldraugh-tales |
d2e8f34214fa18e7518cc486bee470bc5a043cf6 | src/game/StarterPlayer/StarterPlayerScripts/CameraScript.lua | src/game/StarterPlayer/StarterPlayerScripts/CameraScript.lua | -- ClassName: LocalScript
local run = game:GetService("RunService")
local OFFSET = Vector3.new(-45, 45, 45)
local FIELD_OF_VIEW = 25
local player = game.Players.LocalPlayer
local camera = workspace.CurrentCamera
camera.FieldOfView = FIELD_OF_VIEW
local function lookAt(pos)
local cameraPos = pos + OFFSET
camera.CoordinateFrame = CFrame.new(cameraPos, pos)
end
local function onRenderStep()
local character = player.Character
local rootPart = character:FindFirstChild("HumanoidRootPart")
if character and rootPart then
lookAt(rootPart.Position)
end
end
run:BindToRenderStep("Camera", Enum.RenderPriority.Camera.Value, onRenderStep)
| -- ClassName: LocalScript
local run = game:GetService("RunService")
local function getTopDownOffset(dist)
return Vector3.new(-dist, dist, dist)
end
local OFFSET = getTopDownOffset(45)
local FIELD_OF_VIEW = 25
local player = game.Players.LocalPlayer
local camera = workspace.CurrentCamera
camera.FieldOfView = FIELD_OF_VIEW
local function lookAt(pos)
local cameraPos = pos + OFFSET
camera.CoordinateFrame = CFrame.new(cameraPos, pos)
end
local function onRenderStep()
local character = player.Character
local rootPart = character:FindFirstChild("HumanoidRootPart")
if character and rootPart then
lookAt(rootPart.Position)
end
end
run:BindToRenderStep("Camera", Enum.RenderPriority.Camera.Value, onRenderStep)
| Create a function for the top-down offset to avoid repetition | Create a function for the top-down offset to avoid repetition
| Lua | mit | VoxelDavid/echo-ridge |
05a1d7b8090831b80082a92c573d06d02e04e9be | src/cmdrservice/test/scripts/Server/ServerMain.server.lua | src/cmdrservice/test/scripts/Server/ServerMain.server.lua | --[[
@class ServerMain
]]
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerScriptService = game:GetService("ServerScriptService")
local LoaderUtils = require(ServerScriptService:FindFirstChild("LoaderUtils", true))
local clientFolder, serverFolder, sharedFolder = LoaderUtils.toWallyFormat(ServerScriptService.cmdrservice)
clientFolder.Parent = ReplicatedStorage
sharedFolder.Parent = ReplicatedStorage
serverFolder.Parent = ServerScriptService
local serviceBag = require(serverFolder.ServiceBag).new()
serviceBag:GetService(require(serverFolder.CmdrService))
serviceBag:Init()
serviceBag:Start()
serviceBag:GetService(require(serverFolder.CmdrService)):RegisterCommand({
Name = "explode";
Aliases = { "boom" };
Description = "Makes players explode";
Group = "Admin";
Args = {
{
Name = "Players";
Type = "players";
Description = "Victims";
},
};
}, function(_context, players)
for _, player in pairs(players) do
local humanoid = player.Character and player.Character:FindFirstChildWhichIsA("Humanoid")
local humanoidRootPart = humanoid and humanoid.RootPart
if humanoidRootPart then
local explosion = Instance.new("Explosion")
explosion.Position = humanoidRootPart.Position
explosion.Parent = humanoidRootPart
end
end
return "Exploded!"
end) | --[[
@class ServerMain
]]
local ServerScriptService = game:GetService("ServerScriptService")
local loader = ServerScriptService:FindFirstChild("LoaderUtils", true).Parent
local packages = require(loader).bootstrapGame(ServerScriptService.cmdrservice)
local serviceBag = require(packages.ServiceBag).new()
serviceBag:GetService(require(packages.CmdrService))
serviceBag:Init()
serviceBag:Start()
serviceBag:GetService(require(packages.CmdrService)):RegisterCommand({
Name = "explode";
Aliases = { "boom" };
Description = "Makes players explode";
Group = "Admin";
Args = {
{
Name = "Players";
Type = "players";
Description = "Victims";
},
};
}, function(_context, players)
for _, player in pairs(players) do
local humanoid = player.Character and player.Character:FindFirstChildWhichIsA("Humanoid")
local humanoidRootPart = humanoid and humanoid.RootPart
if humanoidRootPart then
local explosion = Instance.new("Explosion")
explosion.Position = humanoidRootPart.Position
explosion.Parent = humanoidRootPart
end
end
return "Exploded!"
end) | Add more modern loader for cmdr tests | test: Add more modern loader for cmdr tests
| Lua | mit | Quenty/NevermoreEngine,Quenty/NevermoreEngine,Quenty/NevermoreEngine |
2befef8a57058d1c615bb6600cf9e3c2b623b735 | fs-onchange.lua | fs-onchange.lua | local uv = require("luv")
if #arg < 1 then
print(string.format("Usage: %s <file1> [file2 ...]", arg[0]));
return
end
for i = 1, #arg do
local fse = uv.new_fs_event()
assert(uv.fs_event_start(fse, arg[i], {
-- "watch_entry" = true,
-- "stat" = true,
recursive = true
}, function (err, fname, status)
--[[
require("pl")
pretty.dump(status)
--]]
if err then
print("Error " .. err)
else
print(string.format("Change detected in %s", uv.fs_event_getpath(fse)))
if status["change"] == true then
print("change: " .. (fname and fname or ""))
elseif status["rename"] == true then
print("rename: " .. (fname and fname or ""))
else
print("unknow: " .. (fname and fname or ""))
end
end
end))
end
uv.run("default")
uv.loop_close()
| local uv = require("luv")
if #arg < 1 then
print(string.format("Usage: %s <file1> [file2 ...]", arg[0]));
return
end
for i = 1, #arg do
local fse = uv.new_fs_event()
assert(uv.fs_event_start(fse, arg[i], {
-- "watch_entry" = true,
-- "stat" = true,
recursive = true
}, function (err, fname, status)
--[[
require("pl")
pretty.dump(status)
--]]
if err then
print("Error " .. err)
else
print(string.format("Change detected in %s", uv.fs_event_getpath(fse)))
if status["change"] == true then
print("change: " .. (fname and fname or ""))
elseif status["rename"] == true then
print("rename: " .. (fname and fname or ""))
else
print("unknow: " .. (fname and fname or ""))
end
end
end))
end
uv.run("default")
uv.loop_close()
| Change file format -> mac2unix | Change file format -> mac2unix
Signed-off-by: Robbie Cao <643a933cab46d49aae0d64e790867eaec8b68831@gmail.com>
| Lua | mit | robbie-cao/mooncake |
d3c7ce400398417337922d6bfe6c5df794a836d6 | solutions/uri/1005/1005.lua | solutions/uri/1005/1005.lua | a = tonumber(io.read("*n"))
b = tonumber(io.read("*n"))
print(string.format('MEDIA = %.5f', (a * 3.5 + b * 7.5) / 11.0))
| Solve Average 1 in lua | Solve Average 1 in lua
| Lua | mit | deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground,deniscostadsc/playground | |
2752da83f099faa0d12b59f1e80ee8ead196db7b | src/test/params_spec.lua | src/test/params_spec.lua | describe('params specs', function ()
it('can be created', function ()
pending('Test not implemented')
end)
it('can be added', function ()
pending('Test not implemented')
end)
it('can index variables in params', function ()
pending('Test not implemented')
end)
it('can index variables in params when combined', function ()
pending('Test not implemented')
end)
it('can check if all the variables in params are resolved', function ()
pending('Test not implemented')
end)
it('can check if all the variables in params are resolved when combined', function ()
pending('Test not implemented')
end)
it('can resolve variables in params', function ()
pending('Test not implemented')
end)
it('can resolve variables in params when combined', function ()
pending('Test not implemented')
end)
end)
| Add unit test for params | Add unit test for params
| Lua | mit | AitorATuin/luacmd | |
f97bc39804fd544481a17d619f55285313986b0a | modules/gcalc.lua | modules/gcalc.lua | return {
["^:(%S+) PRIVMSG (%S+) :!gcalc (.+)$"] = function(self, src, dest, msg)
msg = utils.escape(msg):gsub('%s', '+')
local content, status = utils.http("http://www.google.com/search?q=" .. msg)
if(content) then
-- It might explode, but shouldn't!
local ans = content:match('<h2 .-><b>(.-)</b></h2><div')
if(ans) then
self:msg(dest, src, "%s: %s", src:match"^([^!]+)", ans:gsub("<[^>]+> ?", ""))
else
self:msg(dest, src, '%s: %s', src:match"^([^!]+)", 'Do you want some air with that fail?')
end
end
end
}
| return {
["^:(%S+) PRIVMSG (%S+) :!gcalc (.+)$"] = function(self, src, dest, msg)
msg = utils.escape(msg):gsub('%s', '+')
local content, status = utils.http("http://www.google.com/search?q=" .. msg)
if(content) then
-- It might explode, but shouldn't!
local ans = content:match('<h2 .-><b>(.-)</b></h2><div')
if(ans) then
self:msg(dest, src, "%s: %s", src:match"^([^!]+)", utils.decodeHTML(ans:gsub("<[^>]+> ?", "")))
else
self:msg(dest, src, '%s: %s', src:match"^([^!]+)", 'Do you want some air with that fail?')
end
end
end
}
| Convert HTML entities to readable characters. | Convert HTML entities to readable characters.
| Lua | mit | torhve/ivar2,torhve/ivar2,torhve/ivar2,haste/ivar2 |
dde9cb6aecbffc11c8975aef37518280cfc4227c | examples/hello-world/tundra.lua | examples/hello-world/tundra.lua | Build {
Units = "units.lua",
Configs = {
{
Name = "macosx-gcc",
DefaultOnHost = "macosx",
Tools = { "gcc", "mono" },
},
{
Name = "win32-msvc",
DefaultOnHost = "windows",
Tools = { "msvc-vs2008", "mono" },
},
{
Name = "win32-mingw",
Tools = { "mingw" },
-- Link with the C++ compiler to get the C++ standard library.
ReplaceEnv = {
LD = "$(CXX)",
},
},
},
}
| Build {
Units = "units.lua",
Configs = {
{
Name = "macosx-gcc",
DefaultOnHost = "macosx",
Tools = { "gcc" },
},
{
Name = "win32-msvc",
DefaultOnHost = "windows",
Tools = { "msvc-vs2012" },
},
{
Name = "win32-mingw",
Tools = { "mingw" },
-- Link with the C++ compiler to get the C++ standard library.
ReplaceEnv = {
LD = "$(CXX)",
},
},
},
}
| Update to build with vs2012 | Update to build with vs2012
| Lua | mit | bmharper/tundra,bmharper/tundra,bmharper/tundra,deplinenoise/tundra,deplinenoise/tundra,deplinenoise/tundra,bmharper/tundra |
6ddaa21fe8c67c98673931dbcf6b2c6913d20e92 | test/tests/regex_cap.lua | test/tests/regex_cap.lua | local assertEq = test.assertEq
local function log(x) test.log(tostring(x) .. "\n") end
local vi_regex = require('regex.regex')
local compile = vi_regex.compile
local pat
pat = compile('a(.*)b')
assertEq(pat:match("axyzb"), {_start=1,_end=5, groups={{2,4}},})
assertEq(pat:match("axyzbb"), {_start=1,_end=6, groups={{2,5}},})
pat = compile('a(foo|bar)*b')
--log(test.tostring(vi_regex.parse('a(foo|bar)*b'), ''))
--log(test.tostring(vi_regex.parse('a(foo|bar)*b'), ''))
assertEq(pat:match("ab"), {_start=1,_end=2,})
assertEq(pat:match("afoob"), {_start=1,_end=5, groups={{2,4}},})
assertEq(pat:match("afoobarb"), {_start=1,_end=8, groups={{5,7}},})
| local assertEq = test.assertEq
local function log(x) test.log(tostring(x) .. "\n") end
local vi_regex = require('regex.regex')
local compile = vi_regex.compile
local pat
pat = compile('a(.*)b')
assertEq(pat:match("axyzb"), {_start=1,_end=5, groups={{2,4}},})
assertEq(pat:match("axyzbb"), {_start=1,_end=6, groups={{2,5}},})
pat = compile('a(foo|bar)*b')
--log(test.tostring(vi_regex.parse('a(foo|bar)*b'), ''))
--log(test.tostring(vi_regex.parse('a(foo|bar)*b'), ''))
assertEq(pat:match("ab"), {_start=1,_end=2,})
assertEq(pat:match("afoob"), {_start=1,_end=5, groups={{2,4}},})
assertEq(pat:match("afoobarb"), {_start=1,_end=8, groups={{5,7}},})
pat = compile('a([a-z]*)z X([0-9]*)Y')
assertEq(pat:match('az XY'), {_start=1, _end=5})
assertEq(pat:match('aasdfz X123Y'), {_start=1, _end=12, groups={{2,5},{9,11}}}) | Add a multi-group test, which fails. | Add a multi-group test, which fails.
| Lua | mit | jugglerchris/textadept-vi,jugglerchris/textadept-vi,erig0/textadept-vi |
c3bb1247a6d545e503525e225ccce7a23bea4e00 | logger/files/usr/share/heka/lua_filters/buffered_syslog.lua | logger/files/usr/share/heka/lua_filters/buffered_syslog.lua | require "string"
-- Useful for buffering syslog messages.
buffer = ""
function process_message ()
local max_buffer_size = read_config("max_buffer_size") or 1
local payload = read_message("Payload")
buffer = buffer .. payload
if string.len(buffer) >= max_buffer_size then
flush_buffer()
end
return 0
end
function timer_event(ns)
if string.len(buffer) > 0 then
flush_buffer()
end
end
function flush_buffer()
inject_payload("buffered_syslog", "docker_syslog", buffer)
buffer = ""
end | -- Useful for buffering syslog messages.
buffer_length = 0
local buffer = ""
function process_message ()
local max_buffer_size = read_config("max_buffer_size") or 1
local payload = read_message("Payload")
buffer_length = buffer_length + 1
buffer = buffer .. payload
if buffer_length >= max_buffer_size then
flush_buffer()
end
return 0
end
function timer_event(ns)
if buffer_length > 0 then
flush_buffer()
end
end
function flush_buffer()
inject_payload("buffered_syslog", "docker_syslog", buffer)
buffer_length = 0
buffer = ""
end | Revert "Simplify, no need for a buffer_length variable." | Revert "Simplify, no need for a buffer_length variable."
This reverts commit 63fefab61fd677a8e236721776b6e55277409180.
| Lua | bsd-2-clause | mhahn/empire,markpeek/empire,mhahn/empire,vfulco/empire,zhakui/empire,markpeek/empire,mhahn/empire,zhakui/empire,zofuthan/empire,zofuthan/empire,no2key/empire,vfulco/empire,lihuanghai/empire,lihuanghai/empire,remind101/empire,iserko/empire,no2key/empire,remind101/empire,remind101/empire,iserko/empire,iserko/empire |
e9995e72b985888bfd6fac7584924ba7a9dd02fa | Utilities/common.lua | Utilities/common.lua | -- Returns x clamped to [min, max], and whether the clamp was binding.
function Clamp(x, min, max)
if x <= min then
return min, true
elseif x >= max then
return max, true
else
return x, false
end
end
-- PID controller, with integral windup protection.
-- Interface:
-- controller = PID:New()
-- control = controller:Step(setpoint, state)
PID = {}
PID.Step_ = function(self, setpoint, state)
local error = setpoint - state
local p = self.kP_ * error
local i = self.kI_ * (self.integral_ + error)
local d = self.kD_ * (error - self.lastError_)
output, binding = Clamp(p + i + d, self.outMin_, self.outMax_)
-- Do not add to the integral if the constraint is binding to avoid windup
-- after setpoint changes.
-- TODO: Investigate the risk of loss of convergence when the integral
-- drives the binding.
if not binding then
self.integral_ = Clamp(self.integral_ + error, self.integralMin_,
self.integralMax_)
end
self.lastError_ = error
return output
end
PID.New = function(self, kP, kI, kD, integralMin, integralMax, outMin, outMax)
local new = {}
new.kP_ = kP
new.kI_ = kI
new.kD_ = kD
new.integralMin_ = integralMin
new.integralMax_ = integralMax
new.outMin_ = outMin
new.outMax_ = outMax
new.integral_ = 0
new.lastError_ = 0
-- Hack since FTD does not have setmetatable
new.Step = self.Step_
return new
end
| Add a utility library (Clamp(), PID class). | Add a utility library (Clamp(), PID class).
| Lua | mit | Blothorn/FTD,Blothorn/FTD | |
43730dddc1780e08a1a7327d8e3992577461ee84 | examples/scripts/test.lua | examples/scripts/test.lua | local test = {}
local counter
test.accept = function ()
counter = counter + 1
header = "Status: 200 Ok\r\n" ..
"Content-Type: text/html\r\n\r\n"
body = "<h1>Hello!</h1>" ..
"uri:" .. os.getenv("REQUEST_URI") ..
"<br />method: " .. os.getenv("REQUEST_METHOD") ..
"<br />requests: " .. counter
return header .. body
end
test.start = function ()
counter = 0
end
return test | local test = {}
local counter
function getenv(env, default)
return os.getenv(env) or default
end
test.accept = function ()
counter = counter + 1
header = "Status: 200 Ok\r\n" ..
"Content-Type: text/html\r\n\r\n"
body = "<h1>Hello!</h1>" ..
"uri:" .. getenv("REQUEST_URI", "\n") ..
"<br />method: " .. getenv("REQUEST_METHOD", "\n") ..
"<br />requests: " .. counter .. "\n"
return header .. body
end
test.start = function ()
counter = 0
end
return test | Handle calling with absent environment variables | Handle calling with absent environment variables
| Lua | bsd-3-clause | TravisPaul/lua-simple-fcgi |
6465fbe2d19315ec19629b34744ba27a746b0238 | src/lgix/Gio.lua | src/lgix/Gio.lua | ------------------------------------------------------------------------------
--
-- LGI Gio2 override module.
--
-- Copyright (c) 2010, 2011 Pavel Holejsovsky
-- Licensed under the MIT license:
-- http://www.opensource.org/licenses/mit-license.php
--
------------------------------------------------------------------------------
local select, type, pairs = select, type, pairs
local lgi = require 'lgi'
local Gio = lgi.Gio
local GObject = lgi.GObject
| ------------------------------------------------------------------------------
--
-- LGI Gio2 override module.
--
-- Copyright (c) 2010, 2011 Pavel Holejsovsky
-- Licensed under the MIT license:
-- http://www.opensource.org/licenses/mit-license.php
--
------------------------------------------------------------------------------
local select, type, pairs = select, type, pairs
local lgi = require 'lgi'
local Gio = lgi.Gio
local GObject = lgi.GObject
-- GOI < 1.30 did not map static factory method into interface
-- namespace. The prominent example of this fault was teh
-- Gio.File.new_for_path had to be accessed as
-- Gio.file_new_for_path(). Create a compatibility layer to mask this
-- flaw.
for _, name in pairs { 'path', 'uri', 'commandline_arg' } do
if not Gio.File['new_for_' .. name] then
Gio.File._method['new_for_' .. name] = Gio['file_new_for_' .. name]
end
end
| Add workaround for file_new_for_path() vs. File.new_for_path() issue | Add workaround for file_new_for_path() vs. File.new_for_path() issue
| Lua | mit | psychon/lgi,zevv/lgi,pavouk/lgi |
e0a0f0fd392c1b7ef84144c156865813e9530598 | failure_report.lua | failure_report.lua | -- From https://github.com/lua-shellscript/lua-shellscript/blob/master/src/sh/commands.lua
local function escape(...)
local command = type(...) == 'table' and ... or { ... }
for i, s in ipairs(command) do
s = (tostring(s) or ''):gsub('"', '\\"')
if s:find '[^A-Za-z0-9_."/-]' then
s = '"' .. s .. '"'
elseif s == '' then
s = '""'
end
command[i] = s
end
return table.concat(command, ' ')
end
local failure_report_url = 'http://verizoff.at.ninjawedding.org/fail'
function log_failure(status_code, url, downloader, item_type, item_value)
local template = 'curl -s -X POST %s -F downloader=%s -F response_code=%s -F url=%s -F item_name=%s:%s'
local command = template:format(failure_report_url,
escape(downloader),
escape(status_code),
escape(url),
escape(item_type),
escape(item_value))
os.execute(command)
end
| -- From https://github.com/lua-shellscript/lua-shellscript/blob/master/src/sh/commands.lua
local function escape(...)
local command = type(...) == 'table' and ... or { ... }
for i, s in ipairs(command) do
s = (tostring(s) or ''):gsub('"', '\\"')
if s:find '[^A-Za-z0-9_."/-]' then
s = '"' .. s .. '"'
elseif s == '' then
s = '""'
end
command[i] = s
end
return table.concat(command, ' ')
end
local failure_report_url = 'http://verizoff.at.ninjawedding.org:81/fail'
function log_failure(status_code, url, downloader, item_type, item_value)
local template = 'curl -s -X POST %s -F downloader=%s -F response_code=%s -F url=%s -F item_name=%s:%s'
local command = template:format(failure_report_url,
escape(downloader),
escape(status_code),
escape(url),
escape(item_type),
escape(item_value))
os.execute(command)
end
| Use port 81 for failure report endpoint. | Use port 81 for failure report endpoint.
verizoff.at.ninjawedding.org is running on a system with other HTTP
daemons on it. Easiest solution for me: bind them all to different
ports.
| Lua | unlicense | ArchiveTeam/verizon-grab,ArchiveTeam/verizon-grab,ArchiveTeam/verizon-grab |
2496129051859bc9d560a399341727fb9626d9e3 | lua/entities/gmod_wire_expression2/core/functions.lua | lua/entities/gmod_wire_expression2/core/functions.lua | --[[============================================================
E2 Function System
By Rusketh
General Operators
============================================================]]--
__e2setcost(1)
registerOperator("function", "", "", function(self, args)
local sig, body = args[2], args[3]
self.funcs[sig] = body
end)
__e2setcost(2)
registerOperator("return", "", "", function(self, args)
if args[2] then
local op = args[2]
local rv = op[1](self, op)
self.func_rv = rv
end
error("return",0)
end)
| --[[============================================================
E2 Function System
By Rusketh
General Operators
============================================================]]--
__e2setcost(1)
registerOperator("function", "", "", function(self, args)
local sig, body = args[2], args[3]
self.funcs[sig] = body
self.strfunc_cache = {}
end)
__e2setcost(2)
registerOperator("return", "", "", function(self, args)
if args[2] then
local op = args[2]
local rv = op[1](self, op)
self.func_rv = rv
end
error("return",0)
end)
| Clear E2's strfunc cache when defining a function | Clear E2's strfunc cache when defining a function
Previously the following code:
function string f() { print("A") }
"f"()
function string f() { print("B") }
"f"()
...would print "A" twice, because the previous entry for "f()" was still
present in the cache.
Fixes #1612.
| Lua | apache-2.0 | NezzKryptic/Wire,Grocel/wire,sammyt291/wire,garrysmodlua/wire,dvdvideo1234/wire,wiremod/wire |
443ac26ab19206761c62ceddb11888497c0ecbc1 | .hammerspoon/init.lua | .hammerspoon/init.lua | hs.hotkey.bind({"cmd", "shift"}, "{", function()
current_app():selectMenuItem({"Window", "Select Previous Tab"})
end)
hs.hotkey.bind({"cmd", "shift"}, "}", function()
current_app():selectMenuItem({"Window", "Select Previous Tab"})
end)
function current_app()
return hs.window.application()
end
function reload_config(files)
hs.reload()
end
hs.pathwatcher.new(os.getenv("HOME") .. "/.hammerspoon/", reload_config):start()
hs.alert.show("Config loaded")
| local mash = {"cmd", "alt", "ctrl"}
-- Application shortcuts
hs.hotkey.bind({"cmd", "shift"}, "{", function()
current_app():selectMenuItem({"Window", "Select Previous Tab"})
end)
hs.hotkey.bind({"cmd", "shift"}, "}", function()
current_app():selectMenuItem({"Window", "Select Previous Tab"})
end)
-- Window management
hs.hotkey.bind(mash, "h", function()
local win = hs.window.focusedWindow()
local f = win:frame()
local screen = win:screen()
local max = screen:frame()
f.x = max.x
f.y = max.y
f.w = max.w / 2
f.h = max.h
win:setFrame(f)
end)
hs.hotkey.bind(mash, "l", function()
local win = hs.window.focusedWindow()
local f = win:frame()
local screen = win:screen()
local max = screen:frame()
f.x = max.x + (max.w / 2)
f.y = max.y
f.w = max.w / 2
f.h = max.h
win:setFrame(f)
end)
function current_app()
return hs.window.application()
end
function reload_config(files)
hs.reload()
end
hs.pathwatcher.new(os.getenv("HOME") .. "/.hammerspoon/", reload_config):start()
hs.alert.show("Config loaded")
| Add mash shortcuts for throwing windows to the left and right | [hammerspoon] Add mash shortcuts for throwing windows to the left and right
| Lua | mit | kejadlen/dotfiles,kejadlen/dotfiles |
b543d9b8d5db92995f6081830749da00566d9b9c | .hammerspoon/init.lua | .hammerspoon/init.lua | require 'expandmode'
require 'movemode'
local super = {'ctrl', 'alt', 'cmd', 'shift'}
function screensChangedCallback()
local screens = hs.screen.allScreens()
if #screens < 2 then
hs.notify.show('Switched KWM modes', '', 'Switched to floating window mode',''):withdraw()
hs.execute('kwmc space -t float', true)
hs.execute('kwmc config focused-border off', true)
else
hs.notify.show('Switched KWM modes', '', 'Switched to bsp window mode',''):withdraw()
hs.execute('kwmc space -t bsp', true)
hs.execute('kwmc config focused-border on', true)
end
end
hs.screen.watcher.new(screensChangedCallback):start()
| require 'expandmode'
require 'movemode'
local super = {'ctrl', 'alt', 'cmd', 'shift'}
function screensChangedCallback()
local screens = hs.screen.allScreens()
if #screens < 2 then
hs.notify.show('Switched KWM modes', '', 'Switched to floating window mode','')
hs.execute('kwmc space -t float', true)
hs.execute('kwmc config focused-border off', true)
else
hs.notify.show('Switched KWM modes', '', 'Switched to bsp window mode','')
hs.execute('kwmc space -t bsp', true)
hs.execute('kwmc config focused-border on', true)
end
end
hs.screen.watcher.new(screensChangedCallback):start()
| Make hammerspoon window notifications more persistent. | Make hammerspoon window notifications more persistent.
Unfortunately, this means you'll have to clean them out of your notification center from time to time. But that place is a shithole anyways.
| Lua | mit | paradox460/.dotfiles,paradox460/.dotfiles,paradox460/.dotfiles,paradox460/.dotfiles |
0a7a3e51394fd57488736e44a7a66d2e252bd9a3 | prototype/luaload/luaload.lua | prototype/luaload/luaload.lua | require("compose")
require("mutations")
local function dumptable(bt, tablename)
local tabledef = {}
local output = {}
local prefix = ""
if tablename then
prefix = "$1."
end
for k, v in pairs(bt) do
if type(k) == "string" then
if type(v) == "table" then
if #v > 0 then
-- This is an ordered list value
table.insert(tabledef, prefix .. k .. " = " .. table.concat(v, " "))
else
if tablename then
-- This is a nested definition
table.insert(output, dumptable(v, tablename .. "/" .. k))
else
-- This is a top-level definition
table.insert(output, dumptable(v, k))
end
end
else
-- This is a string value
table.insert(tabledef, prefix .. k .. " = " .. tostring(v))
-- TODO: think about how we can support multi-line string definitions
-- at the top-level and avoid multi-line problems within tables
end
end
end
if #tabledef > 0 then
if tablename then
table.insert(output, "define " .. tablename)
table.insert(output, table.concat(tabledef, "\n"))
table.insert(output, "endef")
else
table.insert(output, table.concat(tabledef, "\n"))
end
end
return table.concat(output, "\n")
end
function luaload(name)
return dumptable(require(name))
end
| require("compose")
require("mutations")
-- TODO: try expanding nested definitions into namespaces
local function dumptable(bt, tablename)
local tabledef = {}
local output = {}
local prefix = ""
if tablename then
prefix = "$1."
end
for k, v in pairs(bt) do
if type(k) == "string" then
if type(v) == "table" then
if #v > 0 then
-- This is an ordered list value
table.insert(tabledef, prefix .. k .. " = " .. table.concat(v, " "))
else
if tablename then
-- This is a nested definition
table.insert(output, dumptable(v, tablename .. "/" .. k))
else
-- This is a top-level definition
table.insert(output, dumptable(v, k))
end
end
else
-- This is a string value
table.insert(tabledef, prefix .. k .. " = " .. tostring(v))
-- TODO: think about how we can support multi-line string definitions
-- at the top-level and avoid multi-line problems within tables
end
end
end
if #tabledef > 0 then
if tablename then
table.insert(output, "define " .. tablename)
table.insert(output, table.concat(tabledef, "\n"))
table.insert(output, "endef")
else
table.insert(output, table.concat(tabledef, "\n"))
end
end
return table.concat(output, "\n")
end
function luaload(name)
return dumptable(require(name))
end
| Add note on nested lua tables | Add note on nested lua tables
| Lua | mit | sjanhunen/yeast |
f498fbe451050c8dcaefebffc1904d8c76f9a08f | hammerspoon/.hammerspoon/init.lua | hammerspoon/.hammerspoon/init.lua | require('windows').init()
require('config-reloader').init()
require('display-sleep').init()
require('launch-apps').init()
require('keyboard-watcher').init()
require('wallpaper').init()
require('concourse').init()
| require('windows').init()
require('config-reloader').init()
require('display-sleep').init()
require('launch-apps').init()
require('keyboard-watcher').init()
require('wallpaper').init()
--require('concourse').init()
| Disable Concourse menu by default | Disable Concourse menu by default
Only for work laptop + needs arguments to run
| Lua | mit | spinningarrow/.files,spinningarrow/.files |
1f428b6b7f94aa5e3b6385648e960c0e31bbac16 | config/nvim/lua/gb/git.lua | config/nvim/lua/gb/git.lua | keymap = require("gb.utils").map
require("gitsigns").setup(
{
watch_gitdir = {
interval = 100
},
signs = {
add = { hl = "GitGutterAdd" },
change = { hl = "GitGutterChange" },
delete = { hl = "GitGutterDelete" },
topdelete = { hl = "GitGutterDelete" },
changedelete = { hl = "GitGutterChangeDelete" }
}
}
)
keymap("n", "<leader>gs", "vertical Git", { silent = true, cmd_cr = true })
keymap("n", "<leader>gh", "diffget //2", { silent = true, cmd_cr = true })
keymap("n", "<leader>gl", ":diffget //3", { silent = true, cmd_cr = true })
keymap("n", "<leader>gb", "GBrowse!", { silent = true, cmd_cr = true })
keymap("v", "<leader>gb", ":'<,'>GBrowse!<CR>", { silent = true, cmd_cr = false })
require("neogit").setup(
{
integrations = {
diffview = true
}
}
)
| keymap = require("gb.utils").map
require("gitsigns").setup(
{
watch_gitdir = {
interval = 100
},
signs = {
add = { hl = "GitGutterAdd" },
change = { hl = "GitGutterChange" },
delete = { hl = "GitGutterDelete" },
topdelete = { hl = "GitGutterDelete" },
changedelete = { hl = "GitGutterChangeDelete" }
}
}
)
keymap("n", "<leader>gs", "vertical Git", { silent = true, cmd_cr = true })
keymap("n", "<leader>gh", "diffget //2", { silent = true, cmd_cr = true })
keymap("n", "<leader>gl", "diffget //3", { silent = true, cmd_cr = true })
keymap("n", "<leader>gb", "GBrowse!", { silent = true, cmd_cr = true })
keymap("v", "<leader>gb", ":'<,'>GBrowse!<CR>", { silent = true, cmd_cr = false })
require("neogit").setup(
{
integrations = {
diffview = true
}
}
)
| Remove : on diffget //3 | Remove : on diffget //3
| Lua | mit | gblock0/dotfiles |
386bc4aa8f70fb3b7f72dc3bd2d8184be25f920b | docs/lua-api/sound.lua | docs/lua-api/sound.lua | --- Provides sound and music functions.
-- @module rpgplus.sound
--- Play a sound to a specific player.
-- @param player player to play the sound to
-- @param sound sound to play
function playSound(player, sound) end
--- Play a note to a specific player.
-- @param player player to play the note to
-- @param instrument instrument which will playing
-- @param note note to play
function playNote(player, instrument, note) end
--- Play a song to a specific player.
-- @param player player to play the song to
-- @param song path of the .nbs song file, relative to the script directory
-- @return true if the song was started, false if not (due to missing NoteBlockAPI plugin)
--
function playSong(player, song) end | --- Provides sound and music functions.
-- @module rpgplus.sound
--- Play a sound to a specific player.
-- @param player player to play the sound to
-- @param sound sound to play
function playSound(player, sound) end
--- Play a note to a specific player.
-- @param player player to play the note to
-- @param instrument instrument which will playing
-- @param note note to play, either its number of a string like "c#'" or "a"
function playNote(player, instrument, note) end
--- Play a song to a specific player.
-- @param player player to play the song to
-- @param song path of the .nbs song file, relative to the script directory
-- @return true if the song was started, false if not (due to missing NoteBlockAPI plugin)
--
function playSong(player, song) end | Update luadoc for playNote function. | Update luadoc for playNote function.
| Lua | mit | leMaik/RpgPlus |
626f00de5c51367d2edb48b3a7c06f4ae4b678be | layout-a4.lua | layout-a4.lua | local book = SILE.require("classes/book");
book:loadPackage("masters")
book:defineMaster({ id = "right", firstContentFrame = "content", frames = {
content = {left = "22.5mm", right = "100%-15mm", top = "20mm", bottom = "top(footnotes)" },
runningHead = {left = "left(content)", right = "right(content)", top = "top(content)-8mm", bottom = "top(content)-2mm" },
footnotes = { left="left(content)", right = "right(content)", height = "0", bottom="100%-15mm"}
}})
book:defineMaster({ id = "left", firstContentFrame = "content", frames = {}})
book:loadPackage("twoside", { oddPageMaster = "right", evenPageMaster = "left" });
book:mirrorMaster("right", "left")
SILE.call("switch-master-one-page", {id="right"})
| local book = SILE.require("classes/book");
book:loadPackage("masters")
book:defineMaster({ id = "right", firstContentFrame = "content", frames = {
content = {left = "32mm", right = "100%-32mm", top = "36mm", bottom = "top(footnotes)" },
runningHead = {left = "left(content)", right = "right(content)", top = "top(content)-12mm", bottom = "top(content)-2mm" },
footnotes = { left="left(content)", right = "right(content)", height = "0", bottom="100%-24mm"}
}})
book:defineMaster({ id = "left", firstContentFrame = "content", frames = {}})
book:loadPackage("twoside", { oddPageMaster = "right", evenPageMaster = "left" });
book:mirrorMaster("right", "left")
SILE.call("switch-master-one-page", {id="right"})
| Use bigger margins and single side template for A4 drafts | Use bigger margins and single side template for A4 drafts
| Lua | agpl-3.0 | alerque/casile,alerque/casile,alerque/casile,alerque/casile,alerque/casile |
fe9d87de5c2a994ce1227461aa5c2d49ee3c9262 | src/conf.lua | src/conf.lua | function love.conf(t)
t.title = "Journey to the Center of Hawkthorne v0.0.10"
t.author = "Kyle Conroy"
t.version = "0.8.0"
t.identity = "hawkthorne"
t.screen.width = 456
t.screen.height = 264
t.consolne = false
t.modules.physics = false
t.modules.joystick = false
t.release = false
end
| function love.conf(t)
t.title = "Journey to the Center of Hawkthorne v0.0.11"
t.author = "Kyle Conroy"
t.version = "0.8.0"
t.identity = "hawkthorne"
t.screen.width = 456
t.screen.height = 264
t.consolne = false
t.modules.physics = false
t.modules.joystick = false
t.release = false
end
| Bump release version to v0.0.11 | Bump release version to v0.0.11
| Lua | mit | hawkthorne/hawkthorne-server-lua,hawkthorne/hawkthorne-client-lua,hawkthorne/hawkthorne-client-lua,hawkthorne/hawkthorne-server-lua |
677ec4165303c5431fb697c18f25afd8416fbd8a | Modules/qSystems/DataTypes/qModel.lua | Modules/qSystems/DataTypes/qModel.lua | local lib = {}
-- Code originally by WhoBloxedWho
local MINIMUM_SIZES = {
["TrussPart"] = Vector3.new(2, 2, 2);
["UnionOperation"] = Vector3.new(0, 0, 0);
}
--- Scales a group of parts around a centroid
-- @param Parts Table of parts, the parts to scale
-- @param Scale The scale to scale by
-- @param Centroid Vector3, the center to scale by
local function Scale(Parts, Scale, Centroid)
for _, Object in pairs(Parts) do
if Object:IsA("BasePart") then
local MinSize = MINIMUM_SIZES[Object.ClassName] or Vector3.new(0.05, 0.05, 0.05)
local ObjectOffset = Object.Position - Centroid
local ObjectRotation = Object.CFrame - Object.CFrame.p
local FoundMesh = Object:FindFirstChildWhichIsA("DataModelMesh")
local TrueSize = FoundMesh and Object.Size * FoundMesh.Scale or Object.Size
local NewSize = TrueSize * Scale
if not Object:IsA("TrussPart") and not Object:IsA("UnionOperation") then
if NewSize.X < MinSize.X or NewSize.Y < MinSize.Y or NewSize.Z < MinSize.Z then
if not FoundMesh then
FoundMesh = Instance.new("SpecialMesh", Object)
if Object:IsA("WedgePart") then
FoundMesh.MeshType = "Wedge"
elseif Object:IsA("CornerWedgePart") then
FoundMesh.MeshType = "CornerWedge"
elseif Object:IsA("Part") then
if Object.Shape.Name == "Ball" then
FoundMesh.MeshType = "Sphere"
elseif Object.Shape.Name == "Cylinder" then
FoundMesh.MeshType = "Cylinder"
else
FoundMesh.MeshType = "Brick"
end
else
FoundMesh.MeshType = "Brick"
end
end
end
end
Object.Size = NewSize
if FoundMesh then
FoundMesh.Scale = NewSize / Object.Size
FoundMesh.Offset = FoundMesh.Offset * Scale
-- if FoundMesh.Scale == Vector3.new(1, 1, 1) and FoundMesh.Offset == Vector3.new(0, 0, 0) then
-- FoundMesh:Destroy()
-- end
end
Object.CFrame = CFrame.new(Centroid + (ObjectOffset * Scale)) * ObjectRotation
end
end
end
lib.Scale = Scale
return lib | Update for modern sizing conventions | Update for modern sizing conventions
| Lua | mit | Quenty/NevermoreEngine,Quenty/NevermoreEngine,Quenty/NevermoreEngine | |
a223a6b52df9d1a1686361236022af31e24c3ddd | packages/date.lua | packages/date.lua | local date = function (options)
options.format = options.format or "%c"
options.time = options.time or os.time()
options.locale = options.locale or localeify(SILE.settings.get("document.language"))
os.setlocale(options.locale, "time")
return os.date(options.format, options.time)
end
local localeify = function (lang)
lang = lang == "en-u-va-posix" and "en" or lang
return lang .. "_" .. string.upper(lang) .. ".utf-8"
end
SILE.registerCommand("date", function(options, content)
SILE.typesetter:typeset(date(options))
end, "Output a timestamp using the system date function")
return {
exports = {
date = date
}
}
| local localeify = function (lang)
lang = lang == "en-u-va-posix" and "en" or lang
return lang .. "_" .. string.upper(lang) .. ".utf-8"
end
local date = function (options)
options.format = options.format or "%c"
options.time = options.time or os.time()
options.locale = options.locale or localeify(SILE.settings.get("document.language"))
os.setlocale(options.locale, "time")
return os.date(options.format, options.time)
end
SILE.registerCommand("date", function (options, _)
SILE.typesetter:typeset(date(options))
end, "Output a timestamp using the system date function")
return {
exports = {
date = date
}
}
| Define function before use, not after | refactor(core): Define function before use, not after
| Lua | mit | alerque/sile,alerque/sile,alerque/sile,alerque/sile |
f556733ae92c31766ffaeae630f23ab5014f6a36 | spec/packages_spec.lua | spec/packages_spec.lua | SILE = require("core.sile")
local lfs = require("lfs")
describe("#packages like", function ()
local _, dir_obj = lfs.dir("packages")
local file = dir_obj:next()
it("foo", function() end)
while file do
local pkg, ok = file:gsub(".lua$", "")
if ok == 1
and pkg ~= "color-fonts"
and pkg ~= "font-fallback"
and pkg ~= "pandoc"
and pkg ~= "pdf"
and pkg ~= "pdfstructure"
and pkg ~= "url"
then
describe(pkg, function ()
it("should load", function ()
assert.has.no.error(function() require("packages." .. pkg) end)
end)
it("should have #documentation", function ()
local mod = require("packages." .. pkg)
assert.truthy(type(mod) == "table")
assert.truthy(mod.documentation)
end)
end)
end
file = dir_obj:next()
end
end)
| SILE = require("core.sile")
local lfs = require("lfs")
describe("#package", function ()
for pkg in lfs.dir("packages") do
if pkg ~= ".." and pkg ~= "."
and pkg ~= "color-fonts"
and pkg ~= "font-fallback"
and pkg ~= "pandoc"
and pkg ~= "pdf"
and pkg ~= "pdfstructure"
and pkg ~= "url"
then
describe(pkg, function ()
local pack
it("should load", function ()
assert.has.no.error(function()
pack = require("packages." .. pkg)
end)
end)
it("return a module", function ()
assert.truthy(type(pack) == "table")
end)
it("be documented", function ()
assert.string(pack.documentation)
end)
end)
end
end
end)
| Refactor unit tests for package loading | test(packages): Refactor unit tests for package loading
| Lua | mit | alerque/sile,alerque/sile,alerque/sile,alerque/sile |
8362d768e2d740cf9dbc56fd5e4cbbac6a9bacad | upstream_config.lua | upstream_config.lua | local router = require "resty.router"
local r = router:new("resty.router.redis_dns")
local method = ngx.req.get_method()
local ok = nil
local err = nil
if method == ngx.HTTP_GET then
ok, err = r:set_route(ngx.var.arg_location,ngx.var.arg_upstream,ngx.var.arg_ttl)
end
if method == ngx.HTTP_DELETE then
ok, err = r:unset_route(ngx.var.arg_location)
end
if not ok then
ngx.status = 500
ngx.say(err)
return ngx.exit(500)
end
ngx.var.rr_status = ok
| local router = require "resty.router"
local r = router:new("resty.router.redis_dns")
local method = ngx.req.get_method()
local ok = nil
local err = nil
if method == "GET" then
ok, err = r:set_route(ngx.var.arg_location,ngx.var.arg_upstream,ngx.var.arg_ttl)
end
if method == "DELETE" then
ok, err = r:unset_route(ngx.var.arg_location)
end
if not ok then
ngx.status = 500
ngx.say(err)
return ngx.exit(500)
end
ngx.var.rr_status = ok
| Use string as specified by openresty docs | Use string as specified by openresty docs | Lua | apache-2.0 | dhiaayachi/dynx,dhiaayachi/dynx |
98a3ffd356edba4cf20538d41917a51327ce3757 | test/dev-app/tests/fixtures/user.lua | test/dev-app/tests/fixtures/user.lua | --user fixtures
return {
{
username = 'serena',
password = '123456'
},
{
username = 'lua',
password = '1234'
},
{
username = 'arnold',
password = '12345678'
},
}
| --user fixtures
return {
{
username = 'serena',
password = '123456'
},
{
username = 'lua',
password = '1234'
},
{
username = 'arnold',
password = '12345678'
},
{
username = 'harry',
password = '12345678'
},
}
| Update fixture for model unit tests | tests(model): Update fixture for model unit tests
| Lua | mit | sailorproject/sailor,Etiene/sailor,mpeterv/sailor,Etiene/sailor,mpeterv/sailor |
b1a43e342e2869220cb723c34518a48671280b28 | modules/mod_01.lua | modules/mod_01.lua |
local chatfilter = function(message, name, type)
return (FilterLib:Filter(message) == "")
end
local mod = {
["Name"] = "ChatSanitizer",
["Description"] = "Blocks spam messages. https://github.com/Aviana/ChatSanitizer",
["OnEnable"] = nil,
["OnDisable"] = nil,
["CreateUI"] = function(frame, pad)
return pad
end,
["NameFilter"] = nil,
["ChatFilter"] = chatfilter,
}
local f = CreateFrame("frame")
f:RegisterEvent("PLAYER_LOGIN")
f:SetScript("OnEvent", function()
SI_ModInstall(mod)
end)
|
local chatfilter = function(message, name, type)
return (not FriendLib:IsFriend(name)) and (FilterLib:Filter(message) == "")
end
local mod = {
["Name"] = "ChatSanitizer",
["Description"] = "Blocks spam messages. https://github.com/Aviana/ChatSanitizer",
["OnEnable"] = nil,
["OnDisable"] = nil,
["CreateUI"] = function(frame, pad)
return pad
end,
["NameFilter"] = nil,
["ChatFilter"] = chatfilter,
}
local f = CreateFrame("frame")
f:RegisterEvent("PLAYER_LOGIN")
f:SetScript("OnEvent", function()
SI_ModInstall(mod)
end)
| Use FriendLib in ChatSanitizer module | Use FriendLib in ChatSanitizer module
| Lua | mit | EinBaum/SuperIgnore |
03327a767d98192e7480f6c063c693fd5b206144 | worldedit/init.lua | worldedit/init.lua | local path = minetest.get_modpath(minetest.get_current_modname())
local loadmodule = function(path)
local file = io.open(path)
if not file then
return
end
file:close()
return dofile(path)
end
loadmodule(path .. "/manipulations.lua")
loadmodule(path .. "/primitives.lua")
loadmodule(path .. "/visualization.lua")
loadmodule(path .. "/serialization.lua")
loadmodule(path .. "/code.lua")
loadmodule(path .. "/compatibility.lua")
| assert(minetest.get_voxel_manip, string.rep(">", 300) .. "HEY YOU! YES, YOU OVER THERE. THIS VERSION OF WORLDEDIT REQUIRES MINETEST 0.4.8 OR LATER! YOU HAVE AN OLD VERSION." .. string.rep("<", 300))
local path = minetest.get_modpath(minetest.get_current_modname())
local loadmodule = function(path)
local file = io.open(path)
if not file then
return
end
file:close()
return dofile(path)
end
loadmodule(path .. "/manipulations.lua")
loadmodule(path .. "/primitives.lua")
loadmodule(path .. "/visualization.lua")
loadmodule(path .. "/serialization.lua")
loadmodule(path .. "/code.lua")
loadmodule(path .. "/compatibility.lua")
| Add version checker since so many people are confused about which version to use. | Add version checker since so many people are confused about which version to use.
| Lua | agpl-3.0 | Uberi/Minetest-WorldEdit |
7510d2882fcdc05da0ff2bae5a93d8a8c50ac704 | .textadept/init.lua | .textadept/init.lua | -- 4 spaces FTW!
buffer.tab_width = 4
buffer.use_tabs = false
-- Turn on line wrapping:
buffer.wrap_mode = buffer.WRAP_WORD
-- Increase font size for GUI:
buffer:set_theme(
'light',
{
font = 'IBM Plex Mono',
fontsize = 18
}
)
-- Interpret PICO-8 files as Lua.
textadept.file_types.extensions.p8 = 'lua'
-- Make Alt have the same functionality as
-- Ctrl with word selection using Shift.
-- Since the default functionality
-- makes no sense.
keys.asleft = buffer.word_left_extend
keys.asright = buffer.word_right_extend
-- Increase the line number margin width, relatively:
events.connect(
events.FILE_OPENED,
function()
if type(buffer.line_count) == 'number' then
local lineCountLength = tostring(buffer.line_count):len()
local width = lineCountLength * 12
buffer.margin_width_n[0] = width + (not CURSES and 4 or 0)
end
end
)
| -- 4 spaces FTW!
buffer.tab_width = 4
buffer.use_tabs = false
-- Turn on line wrapping:
buffer.wrap_mode = buffer.WRAP_WORD
-- Increase font size for GUI:
buffer:set_theme(
'light',
{
font = 'IBM Plex Mono',
fontsize = 18
}
)
-- Interpret PICO-8 files as Lua.
textadept.file_types.extensions.p8 = 'lua'
-- Make Alt have the same functionality as
-- Ctrl with word selection using Shift.
-- Since the default functionality
-- makes no sense.
keys.asleft = buffer.word_left_extend
keys.asright = buffer.word_right_extend
-- Increase the line number margin width, relatively:
events.connect(
events.FILE_OPENED,
function()
if type(buffer.line_count) == 'number' then
local lineCountLength = tostring(buffer.line_count):len()
local width = (lineCountLength + 1) * 12
buffer.margin_width_n[0] = width + (not CURSES and 4 or 0)
end
end
)
| Add one character width to line number margin. | Add one character width to line number margin. | Lua | mpl-2.0 | ryanpcmcquen/linuxTweaks |
6a4730f278c3bfa8eb8e6e53237d89098d913589 | packages/dumpframes.lua | packages/dumpframes.lua | local base = require("packages.base")
local package = pl.class(base)
package._name = "dumpframes"
local seenframes = {}
local outfile
function package.writeTof ()
local contents = "return " .. pl.pretty.write(seenframes)
local toffile, err = io.open(outfile, "w")
if not toffile then return SU.error(err) end
toffile:write(contents)
end
function package.saveFrames (_)
for id, spec in pairs(SILE.frames) do
seenframes[id] = {
spec:left():tonumber(),
spec:top():tonumber(),
spec:right():tonumber(),
spec:bottom():tonumber()
}
end
end
function package:_init(options)
base._init(self)
outfile = options.outfile or SILE.masterFilename .. '.tof'
self.class:registerHook("endpage", self.saveFrames)
self.class:registerHook("finish", self.writeTof)
end
return package
| Add package to dump frame info | feat(packages): Add package to dump frame info
| Lua | agpl-3.0 | alerque/casile,alerque/casile,alerque/casile,alerque/casile,alerque/casile | |
749f1fad8ceb9ff455b31a82357ad65c56b578c0 | lua/testdata/unique_list.lua | lua/testdata/unique_list.lua | local begin_tran = floating_temple.begin_tran
local end_tran = floating_temple.end_tran
local shared = floating_temple.shared
begin_tran()
if shared["num"] == nil then
shared["num"] = 1
end
end_tran()
local lst = {}
for i=1,10 do
begin_tran()
local num = shared["num"] + 1
shared["num"] = num
end_tran()
table.insert(lst, num)
print(lst)
end
| Add a test floating_lua program that constructs a list of unique integers. | Add a test floating_lua program that constructs a list of unique integers.
| Lua | apache-2.0 | snyderek/floating_temple,snyderek/floating_temple,snyderek/floating_temple | |
1b3b48f588b774b34ed0a5254de642df15366e39 | training/main.lua | training/main.lua | #!/usr/bin/env th
require 'torch'
require 'optim'
require 'paths'
require 'xlua'
local opts = paths.dofile('opts.lua')
opt = opts.parse(arg)
print(opt)
if opt.cuda then
require 'cutorch'
cutorch.setDevice(1)
end
os.execute('mkdir -p ' .. opt.save)
torch.save(paths.concat(opt.save, 'opts.t7'), opt, 'ascii')
print('Saving everything to: ' .. opt.save)
torch.setdefaulttensortype('torch.FloatTensor')
torch.manualSeed(opt.manualSeed)
paths.dofile('data.lua')
paths.dofile('model.lua')
paths.dofile('train.lua')
paths.dofile('test.lua')
paths.dofile('util.lua')
if opt.peoplePerBatch > nClasses then
print('\n\nError: opt.peoplePerBatch > number of classes. Please decrease this value.')
print(' + opt.peoplePerBatch: ', opt.peoplePerBatch)
print(' + number of classes: ', nClasses)
os.exit(-1)
end
epoch = opt.epochNumber
for _=1,opt.nEpochs do
train()
if opt.testing then
test()
end
epoch = epoch + 1
end
| #!/usr/bin/env th
require 'torch'
require 'optim'
require 'paths'
require 'xlua'
local opts = paths.dofile('opts.lua')
opt = opts.parse(arg)
print(opt)
if opt.cuda then
require 'cutorch'
cutorch.setDevice(1)
end
os.execute('mkdir -p ' .. opt.save)
torch.save(paths.concat(opt.save, 'opts.t7'), opt, 'ascii')
print('Saving everything to: ' .. opt.save)
torch.setdefaulttensortype('torch.FloatTensor')
torch.manualSeed(opt.manualSeed)
paths.dofile('data.lua')
paths.dofile('util.lua')
paths.dofile('model.lua')
paths.dofile('train.lua')
paths.dofile('test.lua')
if opt.peoplePerBatch > nClasses then
print('\n\nError: opt.peoplePerBatch > number of classes. Please decrease this value.')
print(' + opt.peoplePerBatch: ', opt.peoplePerBatch)
print(' + number of classes: ', nClasses)
os.exit(-1)
end
epoch = opt.epochNumber
for _=1,opt.nEpochs do
train()
if opt.testing then
test()
end
epoch = epoch + 1
end
| Load util before model for optimizeNet | Load util before model for optimizeNet
\cc @melgor
| Lua | apache-2.0 | Alexx-G/openface,nhzandi/openface,xinfang/face-recognize,nhzandi/openface,cmusatyalab/openface,nhzandi/openface,Alexx-G/openface,xinfang/face-recognize,francisleunggie/openface,nmabhi/Webface,Alexx-G/openface,cmusatyalab/openface,francisleunggie/openface,nmabhi/Webface,Alexx-G/openface,francisleunggie/openface,nmabhi/Webface,nmabhi/Webface,xinfang/face-recognize,cmusatyalab/openface |
4f2789ca0df4b51af264f11c2de3510c1db874d2 | util/hashes.lua | util/hashes.lua |
local softreq = function (...) return select(2, pcall(require, ...)); end
local error = error;
module "hashes"
local md5 = softreq("md5");
if md5 then
if md5.digest then
local md5_digest = md5.digest;
local sha1_digest = sha1.digest;
function _M.md5(input)
return md5_digest(input);
end
function _M.sha1(input)
return sha1_digest(input);
end
elseif md5.sumhexa then
local md5_sumhexa = md5.sumhexa;
function _M.md5(input)
return md5_sumhexa(input);
end
else
error("md5 library found, but unrecognised... no hash functions will be available", 0);
end
else
error("No md5 library found. Install md5 using luarocks, for example", 0);
end
return _M;
|
local softreq = function (...) local ok, lib = pcall(require, ...); if ok then return lib; else return nil; end end
local error = error;
module "hashes"
local md5 = softreq("md5");
if md5 then
if md5.digest then
local md5_digest = md5.digest;
local sha1_digest = sha1.digest;
function _M.md5(input)
return md5_digest(input);
end
function _M.sha1(input)
return sha1_digest(input);
end
elseif md5.sumhexa then
local md5_sumhexa = md5.sumhexa;
function _M.md5(input)
return md5_sumhexa(input);
end
else
error("md5 library found, but unrecognised... no hash functions will be available", 0);
end
else
error("No md5 library found. Install md5 using luarocks, for example", 0);
end
return _M;
| Fix softreq, so it reports when no suitable MD5 library is found | Fix softreq, so it reports when no suitable MD5 library is found
| Lua | mit | sarumjanuch/prosody,sarumjanuch/prosody |
ee4a96209a5ee70a27fd6972700d4fbb22cff7d5 | Modules/Shared/Utility/RandomUtils.lua | Modules/Shared/Utility/RandomUtils.lua | ---
-- @module RandomUtils
-- @author Quenty
local RandomUtils = {}
function RandomUtils.choice(list)
if #list == 0 then
return nil
elseif #list == 1 then
return list[1]
else
return list[math.random(1, #list)]
end
end
--- Creates a copy of the table, but shuffled using fisher-yates shuffle
-- @tparam table orig A new table to copy
-- @tparam[opt=nil] A random to use when shuffling
function RandomUtils.shuffledCopy(orig, random)
local tbl = {}
for i=1, #orig do
tbl[i] = orig[i]
end
if random then
for i = #tbl, 2, -1 do
local j = random:NextInteger(1, i)
tbl[i], tbl[j] = tbl[j], tbl[i]
end
else
for i = #tbl, 2, -1 do
local j = math.random(i)
tbl[i], tbl[j] = tbl[j], tbl[i]
end
end
return tbl
end
return RandomUtils | ---
-- @module RandomUtils
-- @author Quenty
local RandomUtils = {}
function RandomUtils.choice(list, random)
if #list == 0 then
return nil
elseif #list == 1 then
return list[1]
else
if random then
return list[random:NextInteger(1, #list)]
else
return list[math.random(1, #list)]
end
end
end
--- Creates a copy of the table, but shuffled using fisher-yates shuffle
-- @tparam table orig A new table to copy
-- @tparam[opt=nil] A random to use when shuffling
function RandomUtils.shuffledCopy(orig, random)
local tbl = {}
for i=1, #orig do
tbl[i] = orig[i]
end
if random then
for i = #tbl, 2, -1 do
local j = random:NextInteger(1, i)
tbl[i], tbl[j] = tbl[j], tbl[i]
end
else
for i = #tbl, 2, -1 do
local j = math.random(i)
tbl[i], tbl[j] = tbl[j], tbl[i]
end
end
return tbl
end
return RandomUtils | Allow random to be passed in | Allow random to be passed in
| Lua | mit | Quenty/NevermoreEngine,Quenty/NevermoreEngine,Quenty/NevermoreEngine |
5db6c0536f6348da37bacfefb2368f32018092f4 | hammerspoon/init.lua | hammerspoon/init.lua | local log = hs.logger.new('init.lua', 'debug')
-- Use Control+` to reload Hammerspoon config
hs.hotkey.bind({'ctrl'}, '`', nil, function()
hs.reload()
end)
keyUpDown = function(modifiers, key)
-- Un-comment & reload config to log each keystroke that we're triggering
-- log.d('Sending keystroke:', hs.inspect(modifiers), key)
hs.eventtap.keyStroke(modifiers, key, 0)
end
-- Subscribe to the necessary events on the given window filter such that the
-- given hotkey is enabled for windows that match the window filter and disabled
-- for windows that don't match the window filter.
--
-- windowFilter - An hs.window.filter object describing the windows for which
-- the hotkey should be enabled.
-- hotkey - The hs.hotkey object to enable/disable.
--
-- Returns nothing.
enableHotkeyForWindowsMatchingFilter = function(windowFilter, hotkey)
windowFilter:subscribe(hs.window.filter.windowFocused, function()
hotkey:enable()
end)
windowFilter:subscribe(hs.window.filter.windowUnfocused, function()
hotkey:disable()
end)
end
require('keyboard.control-escape')
require('keyboard.hyper')
-- require('keyboard.panes')
require('keyboard.windows')
hs.notify.new({title='Hammerspoon', informativeText='Ready to rock 🤘'}):send()
| local log = hs.logger.new('init.lua', 'debug')
-- Use Control+` to reload Hammerspoon config
--hs.hotkey.bind({'ctrl'}, '`', nil, function()
--hs.reload()
--end)
keyUpDown = function(modifiers, key)
-- Un-comment & reload config to log each keystroke that we're triggering
-- log.d('Sending keystroke:', hs.inspect(modifiers), key)
hs.eventtap.keyStroke(modifiers, key, 0)
end
-- Subscribe to the necessary events on the given window filter such that the
-- given hotkey is enabled for windows that match the window filter and disabled
-- for windows that don't match the window filter.
--
-- windowFilter - An hs.window.filter object describing the windows for which
-- the hotkey should be enabled.
-- hotkey - The hs.hotkey object to enable/disable.
--
-- Returns nothing.
enableHotkeyForWindowsMatchingFilter = function(windowFilter, hotkey)
windowFilter:subscribe(hs.window.filter.windowFocused, function()
hotkey:enable()
end)
windowFilter:subscribe(hs.window.filter.windowUnfocused, function()
hotkey:disable()
end)
end
require('keyboard.control-escape')
require('keyboard.hyper')
-- require('keyboard.panes')
require('keyboard.windows')
hs.notify.new({title='Hammerspoon', informativeText='Ready to rock 🤘'}):send()
| Stop using C-` for reload | Hammerspoon: Stop using C-` for reload
| Lua | mit | shanematley/dotfiles,shanematley/dotfiles |
9018d454ea7262ba3f3b2a09d7def1edd038bcc0 | hammerspoon/init.lua | hammerspoon/init.lua | require('keyboard') -- Load Hammerspoon bits from https://github.com/jasonrudolph/keyboard
--------------------------------------------------------------------------------
-- Load Hammerspoon bits from https://github.com/jasonrudolph/dotfiles
--------------------------------------------------------------------------------
require('do-not-disturb')
require('posture-reminder')
require('screen-sharing')
require('wifi')
-- TODO Consider auto-generating an HTML bookmarks file containing all of URLs
-- that are bound to Hammerspoon functions, so that LaunchBar can automatically
-- add those URLs to its index.
| require('keyboard') -- Load Hammerspoon bits from https://github.com/jasonrudolph/keyboard
-- Make Hammerspoon accessible via the command line
-- http://www.hammerspoon.org/docs/hs.ipc.html
require("hs.ipc")
--------------------------------------------------------------------------------
-- Load Hammerspoon bits from https://github.com/jasonrudolph/dotfiles
--------------------------------------------------------------------------------
require('do-not-disturb')
require('posture-reminder')
require('screen-sharing')
require('wifi')
-- TODO Consider auto-generating an HTML bookmarks file containing all of URLs
-- that are bound to Hammerspoon functions, so that LaunchBar can automatically
-- add those URLs to its index.
| Make Hammerspoon accessible via the command line | Make Hammerspoon accessible via the command line
| Lua | mit | jasonrudolph/dotfiles,jasonrudolph/dotfiles,jasonrudolph/dotfiles,jasonrudolph/dotfiles |
3b7c8a2d253cf45bd7ab6bc232ee629a072ab161 | print_all_variables.lua | print_all_variables.lua | -- Use Activation by Button event "Manual (triggered by action button)"
logf("-----")
local function toDebugString(a, indent)
if type(a) == 'table' then
indent = indent or 0
local out = {'table\n'}
for k, v in pairs(a) do
table.insert(out, string.format('%s%s -> %s\n', string.rep(' ', indent), tostring(k), toDebugString(v, indent+1)))
end
return table.concat(out)
else
return tostring(a)
end
end
for key, item in pairs(devices) do
logf("%s -> %s", key, toDebugString(item, 0))
end
| -- Use Activation by Button event "Manual (triggered by action button)"
logf("-----")
local function toDebugString(a, indent)
if type(a) == 'table' then
indent = indent or 0
local out = {'table\n'}
for k, v in pairs(a) do
table.insert(out, string.format('%s%s -> %s\n', string.rep(' ', indent), tostring(k), toDebugString(v, indent+1)))
end
return table.concat(out)
else
return tostring(a)
end
end
for key, item in pairs(devices) do
logf("%s -> %s", key, toDebugString(item, 0))
end
| Print all variables and its values to the user log | Print all variables and its values to the user log | Lua | mit | Koukaam/ipcorder-utils |
b9f8209e7d80198018df705fb9072d3f68afd3cb | spec/types_spec.lua | spec/types_spec.lua | local types = require "titan-compiler.types"
describe("Titan types", function()
it("pretty-prints types", function()
assert.same("{ integer }", types.tostring(types.Array(types.Integer)))
end)
it("checks if a type is garbage collected", function()
assert.truthy(types.is_gc(types.String))
assert.truthy(types.is_gc(types.Array(types.Integer)))
assert.falsy(types.is_gc(types.Function({}, {})))
end)
it("checks if a type matches a tag", function()
assert.truthy(types.has_tag(types.String, "String"))
assert.truthy(types.has_tag(types.Integer, "Integer"))
end)
end)
| local types = require "titan-compiler.types"
describe("Titan types", function()
it("pretty-prints types", function()
assert.same("{ integer }", types.tostring(types.Array(types.Integer)))
end)
it("checks if a type is garbage collected", function()
assert.truthy(types.is_gc(types.String))
assert.truthy(types.is_gc(types.Array(types.Integer)))
assert.falsy(types.is_gc(types.Function({}, {})))
end)
it("checks if a type matches a tag", function()
assert.truthy(types.has_tag(types.String, "String"))
assert.truthy(types.has_tag(types.Integer, "Integer"))
end)
it("compares identical functions", function()
local fsib = types.Function({types.String, types.Integer}, types.Boolean)
local fsib2 = types.Function({types.String, types.Integer}, types.Boolean)
assert.truthy(types.equals(fsib, fsib2))
end)
it("compares functions with different arguments", function()
local fsib = types.Function({types.String, types.Boolean}, types.Boolean)
local fsib2 = types.Function({types.Integer, types.Integer}, types.Boolean)
assert.falsy(types.equals(fsib, fsib2))
end)
it("compares functions with different returns", function()
local fsib = types.Function({types.String, types.Integer}, types.Boolean)
local fsii = types.Function({types.String, types.Integer}, types.Integer)
assert.falsy(types.equals(fsib, fsii))
end)
it("compares functions of different arity", function()
local f1 = types.Function({types.String}, types.Boolean)
local f2 = types.Function({types.String, types.Integer}, types.Boolean)
local f3 = types.Function({types.String, types.Integer, types.Integer}, types.Boolean)
assert.falsy(types.equals(f1, f2))
assert.falsy(types.equals(f2, f1))
assert.falsy(types.equals(f2, f3))
assert.falsy(types.equals(f3, f2))
assert.falsy(types.equals(f1, f3))
assert.falsy(types.equals(f3, f1))
end)
end)
| Add tests for types.equals with functions | Add tests for types.equals with functions
| Lua | mit | titan-lang/titan-v0,titan-lang/titan-v0,titan-lang/titan-v0 |
59dc9440536d86b218ba8ee0780d35af3e96a76a | src/cosy/nginx/conf.lua | src/cosy/nginx/conf.lua | return function (loader)
local Lfs = loader.require "lfs"
local Default = loader.load "cosy.configuration.layers".default
local www = loader.prefix .. "/lib/luarocks/rocks/cosyverif/"
for subpath in Lfs.dir (www) do
if subpath ~= "." and subpath ~= ".."
and Lfs.attributes (www .. "/" .. subpath, "mode") == "directory" then
www = www .. subpath .. "/src/cosy/www"
break
end
end
assert (www:match "/www$")
Default.http = {
nginx = loader.prefix .. "/nginx",
hostname = nil,
interface = "*",
port = 8080,
timeout = 5,
pid = loader.home .. "/nginx.pid",
configuration = loader.home .. "/nginx.conf",
directory = loader.home .. "/nginx",
www = www,
www_fallback = loader.prefix .. "/share/cosy/www",
bundle = loader.source .. "/cosy-full.lua",
}
end
| return function (loader)
local Lfs = loader.require "lfs"
local Default = loader.load "cosy.configuration.layers".default
local www = loader.prefix .. "/lib/luarocks/rocks/cosy/"
for subpath in Lfs.dir (www) do
if subpath ~= "." and subpath ~= ".."
and Lfs.attributes (www .. "/" .. subpath, "mode") == "directory" then
www = www .. subpath .. "/src/cosy/www"
break
end
end
assert (www:match "/www$")
Default.http = {
nginx = loader.prefix .. "/nginx",
hostname = nil,
interface = "*",
port = 8080,
timeout = 5,
pid = loader.home .. "/nginx.pid",
configuration = loader.home .. "/nginx.conf",
directory = loader.home .. "/nginx",
www = www,
www_fallback = loader.prefix .. "/share/cosy/www",
bundle = loader.source .. "/cosy-full.lua",
}
end
| Fix cosy path in www prefix. | Fix cosy path in www prefix.
| Lua | mit | CosyVerif/library,CosyVerif/library,CosyVerif/library |
fb713cdedb16f8eb67523f17b0d66262b4e9dca1 | test/excepttest.lua | test/excepttest.lua | local socket = require("socket")
try = socket.newtry(function()
print("finalized!!!")
end)
try = socket.protect(try)
print(try(nil, "it works"))
| local socket = require("socket")
local finalizer_called
local func = socket.protect(function(err, ...)
local try = socket.newtry(function()
finalizer_called = true
error("ignored")
end)
if err then
return error(err, 0)
else
return try(...)
end
end)
local ret1, ret2, ret3 = func(false, 1, 2, 3)
assert(not finalizer_called, "unexpected finalizer call")
assert(ret1 == 1 and ret2 == 2 and ret3 == 3, "incorrect return values")
ret1, ret2, ret3 = func(false, false, "error message")
assert(finalizer_called, "finalizer not called")
assert(ret1 == nil and ret2 == "error message" and ret3 == nil, "incorrect return values")
local err = {key = "value"}
ret1, ret2 = pcall(func, err)
assert(not ret1, "error not rethrown")
assert(ret2 == err, "incorrect error rethrown")
print("OK")
| Add more tests for socket.try/protect | Add more tests for socket.try/protect
| Lua | mit | diegonehab/LuaSocket,enginix/luasocket,BeamNG/luasocket,enginix/luasocket,diegonehab/LuaSocket,cjtallman/luasocket,diegonehab/LuaSocket,cjtallman/luasocket,cjtallman/luasocket,BeamNG/luasocket,enginix/luasocket,BeamNG/luasocket,cjtallman/luasocket,BeamNG/luasocket,enginix/luasocket |
936f29cd06d13370ccb0a02f762da967eb81693a | lib/executable.lua | lib/executable.lua | LXSC.EXECUTABLE = {}
function LXSC.EXECUTABLE:log(scxml)
print(scxml.datamodel:run(self.expr))
end
function LXSC.EXECUTABLE:raise(scxml)
scxml:fireEvent(self.event,nil,true)
end
function LXSC.SCXML:executeContent(item)
local handler = LXSC.EXECUTABLE[item.kind]
if handler then
handler(item,self) -- TODO: pcall this and inject error event on failure
else
print(string.format("Warning: skipping unhandled executable type %s | %s",item.kind,dump(item)))
end
end
| LXSC.EXECUTABLE = {}
function LXSC.EXECUTABLE:log(scxml)
print(scxml.datamodel:run(self.expr))
end
function LXSC.EXECUTABLE:raise(scxml)
scxml:fireEvent(self.event,nil,true)
end
function LXSC.EXECUTABLE:send(scxml)
-- TODO: warn about delay/delayexpr no support
-- TODO: support type/typeexpr/target/targetexpr
local dm = scxml.datamodel
local name = self.event or dm:run(self.eventexpr)
local data
if self.namelist then
data = {}
for name in string.gmatch(self.namelist,'[^%s]+') do data[name] = dm:get(name) end
end
if self.idlocation and not self.id then dm:set( dm:run(self.idlocation), LXSC.uuid4() ) end
scxml:fireEvent(name,data,false)
end
function LXSC.SCXML:executeContent(item)
local handler = LXSC.EXECUTABLE[item.kind]
if handler then
handler(item,self) -- TODO: pcall this and inject error event on failure
else
print(string.format("Warning: skipping unhandled executable type %s | %s",item.kind,dump(item)))
end
end
| Add <send> minimal support; pass 4/10 | Add <send> minimal support; pass 4/10
| Lua | mit | Phrogz/LXSC |
a2674e82ec6c29acdc11ec13dccd8be82662e842 | modulefiles/Core/rucio/1.6.6.lua | modulefiles/Core/rucio/1.6.6.lua | help(
[[
This module loads Rucio 1.6.6 into the environment. Rucio is a
distributed data movement system.
]])
whatis("Loads Rucio")
local version = "1.6.6"
local base = "/cvmfs/oasis.opensciencegrid.org/osg/modules/rucio/"..version
prepend_path("PATH", pathJoin(base, "bin"))
setenv("RUCIO_HOME", pathJoin(base, "rucio"))
family('rucio')
load("gfal/7.20")
| help(
[[
This module loads Rucio 1.6.6 into the environment. Rucio is a
distributed data movement system.
]])
whatis("Loads Rucio")
local version = "1.6.6"
local base = "/cvmfs/oasis.opensciencegrid.org/osg/modules/rucio/"..version
prepend_path("PATH", pathJoin(base, "bin"))
prepend_path("PYTHONPATH", pathJoin(base, "lib", "python2.6", "site-packages"))
setenv("RUCIO_HOME", pathJoin(base, "rucio"))
family('rucio')
load("gfal/7.20")
| Add pythonpath to rucio module | Add pythonpath to rucio module
| Lua | apache-2.0 | OSGConnect/modulefiles,OSGConnect/modulefiles,OSGConnect/modulefiles |
298f86a8b2ceefe8932e7bcf839d644a2b0888f4 | samples/complex_platforms/premake4.lua | samples/complex_platforms/premake4.lua | solution "MySolution"
configurations {
"Debug",
"Deployment",
"Profiling",
"Release"
}
platforms {
"Win32 Static SCRT",
"Win32 Static DCRT",
"Win32 DLL",
"Win64 Static SCRT",
"Win64 Static DCRT",
"Win64 DLL",
"PS3 PPU GCC",
"PS3 PPU SN",
"PS3 SPU GCC",
"PS3 SPU SN"
}
--
-- Map the platforms to their underlying architectures.
--
configuration { "Win32 *" }
architecture "x32"
os "windows"
configuration { "Win64 *" }
architecture "x64"
os "windows"
configuration { "* PPU *" }
architecture "ps3ppu"
configuration { "* SPU *" }
architecture "ps3spu"
configuration { "* GCC" }
compiler "gcc"
configuration { "* SN" }
compiler "sn"
| Add sample script for new platform API | Add sample script for new platform API
| Lua | bsd-3-clause | aleksijuvani/premake-core,felipeprov/premake-core,jsfdez/premake-core,mendsley/premake-core,starkos/premake-core,mendsley/premake-core,jsfdez/premake-core,felipeprov/premake-core,bravnsgaard/premake-core,soundsrc/premake-core,premake/premake-core,starkos/premake-core,Tiger66639/premake-core,sleepingwit/premake-core,resetnow/premake-core,noresources/premake-core,Zefiros-Software/premake-core,jsfdez/premake-core,premake/premake-core,felipeprov/premake-core,grbd/premake-core,tvandijck/premake-core,PlexChat/premake-core,mandersan/premake-core,PlexChat/premake-core,dcourtois/premake-core,alarouche/premake-core,TurkeyMan/premake-core,sleepingwit/premake-core,LORgames/premake-core,premake/premake-core,jstewart-amd/premake-core,TurkeyMan/premake-core,aleksijuvani/premake-core,resetnow/premake-core,starkos/premake-core,martin-traverse/premake-core,CodeAnxiety/premake-core,jstewart-amd/premake-core,dcourtois/premake-core,prapin/premake-core,mandersan/premake-core,Meoo/premake-core,Yhgenomics/premake-core,Zefiros-Software/premake-core,tritao/premake-core,resetnow/premake-core,lizh06/premake-core,TurkeyMan/premake-core,resetnow/premake-core,alarouche/premake-core,tritao/premake-core,grbd/premake-core,Blizzard/premake-core,sleepingwit/premake-core,xriss/premake-core,tritao/premake-core,kankaristo/premake-core,Blizzard/premake-core,PlexChat/premake-core,noresources/premake-core,Yhgenomics/premake-core,Tiger66639/premake-core,jstewart-amd/premake-core,CodeAnxiety/premake-core,saberhawk/premake-core,mendsley/premake-core,mandersan/premake-core,grbd/premake-core,CodeAnxiety/premake-core,mendsley/premake-core,premake/premake-core,LORgames/premake-core,Blizzard/premake-core,noresources/premake-core,martin-traverse/premake-core,tvandijck/premake-core,bravnsgaard/premake-core,bravnsgaard/premake-core,mendsley/premake-core,Zefiros-Software/premake-core,Yhgenomics/premake-core,mandersan/premake-core,starkos/premake-core,noresources/premake-core,LORgames/premake-core,CodeAnxiety/premake-core,jsfdez/premake-core,dcourtois/premake-core,kankaristo/premake-core,dcourtois/premake-core,akaStiX/premake-core,Meoo/premake-core,soundsrc/premake-core,premake/premake-core,Tiger66639/premake-core,akaStiX/premake-core,felipeprov/premake-core,saberhawk/premake-core,Zefiros-Software/premake-core,bravnsgaard/premake-core,LORgames/premake-core,Blizzard/premake-core,aleksijuvani/premake-core,Blizzard/premake-core,Yhgenomics/premake-core,sleepingwit/premake-core,starkos/premake-core,Meoo/premake-core,sleepingwit/premake-core,starkos/premake-core,jstewart-amd/premake-core,lizh06/premake-core,kankaristo/premake-core,noresources/premake-core,lizh06/premake-core,premake/premake-core,tritao/premake-core,soundsrc/premake-core,xriss/premake-core,Zefiros-Software/premake-core,TurkeyMan/premake-core,martin-traverse/premake-core,tvandijck/premake-core,premake/premake-core,noresources/premake-core,xriss/premake-core,grbd/premake-core,tvandijck/premake-core,prapin/premake-core,bravnsgaard/premake-core,Blizzard/premake-core,dcourtois/premake-core,soundsrc/premake-core,alarouche/premake-core,Meoo/premake-core,Tiger66639/premake-core,PlexChat/premake-core,resetnow/premake-core,aleksijuvani/premake-core,mandersan/premake-core,lizh06/premake-core,akaStiX/premake-core,akaStiX/premake-core,tvandijck/premake-core,saberhawk/premake-core,prapin/premake-core,prapin/premake-core,TurkeyMan/premake-core,dcourtois/premake-core,soundsrc/premake-core,starkos/premake-core,martin-traverse/premake-core,CodeAnxiety/premake-core,alarouche/premake-core,xriss/premake-core,noresources/premake-core,kankaristo/premake-core,jstewart-amd/premake-core,dcourtois/premake-core,aleksijuvani/premake-core,xriss/premake-core,saberhawk/premake-core,LORgames/premake-core | |
a6a334be218a884ae82b9ce27e203fc26ff17760 | tests/scope-tests.lua | tests/scope-tests.lua | local realvim = vim
local scope = scope
local scope_abbr = scope_abbr
module('scope_test', vim.bridge)
local env = getfenv(1)
for _, scope in ipairs { env[scope], env[scope_abbr] } do
scope.foo = 'bar'
realvim.command('echo ' .. scope_abbr .. ':foo')
scope.foo = 189
realvim.command('echo ' .. scope_abbr .. ':foo')
realvim.command('let ' .. scope_abbr .. ':foo = 179')
print(scope.foo)
realvim.command('let ' .. scope_abbr .. ':foo = "baz"')
print(scope.foo)
scope.foo = nil
realvim.command('echo exists("' .. scope_abbr .. ':foo")')
print(scope.foo)
scope.foo = 17
print(scope.foo)
realvim.command('unlet ' .. scope_abbr .. ':foo')
print(scope.foo)
scope.foo = true
print(scope.foo)
scope.foo = false
realvim.command('echo ' .. scope_abbr .. ':foo')
end
| local realvim = vim
local scope = scope
local scope_abbr = scope_abbr
module('scope_test', vim.bridge)
local env = getfenv(1)
for _, scope in ipairs { env[scope], env[scope_abbr] } do
scope.foo = 'bar'
realvim.command('echo ' .. scope_abbr .. ':foo')
scope.foo = 189
realvim.command('echo ' .. scope_abbr .. ':foo')
realvim.command('let ' .. scope_abbr .. ':foo = 179')
print(scope.foo)
realvim.command('let ' .. scope_abbr .. ':foo = "baz"')
print(scope.foo)
scope.foo = nil
realvim.command('echo exists("' .. scope_abbr .. ':foo")')
print(scope.foo)
scope.foo = 17
print(scope.foo)
realvim.command('unlet ' .. scope_abbr .. ':foo')
print(scope.foo)
scope.foo = true
print(scope.foo)
scope.foo = false
realvim.command('echo ' .. scope_abbr .. ':foo')
realvim.command('unlet ' .. scope_abbr .. ':foo')
realvim.command('let ' .. scope_abbr .. ':foo = []')
scope.foo = 17
scope.foo = nil
end
| Add tests for changing a variable's type | Add tests for changing a variable's type
| Lua | mit | hoelzro/queqiao |
32842ffb28078d1258be4b6be7d1aa3b4e4344c3 | examples/websocket.lua | examples/websocket.lua | --- Turbo.lua Hello WebSocket example
--
-- Copyright 2013 John Abrahamsen
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
_G.TURBO_SSL = true
local turbo = require "turbo"
local WSExHandler = class("WSExHandler", turbo.websocket.WebSocketHandler)
function WSExHandler:on_message(msg)
print(msg)
end
turbo.web.Application({{"^/ws$", WSExHandler}}):listen(8888)
turbo.ioloop.instance():start()
| --- Turbo.lua Hello WebSocket example
--
-- Copyright 2013 John Abrahamsen
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
_G.TURBO_SSL = true
local turbo = require "turbo"
local WSExHandler = class("WSExHandler", turbo.websocket.WebSocketHandler)
function WSExHandler:on_message(msg)
self:write_message("Hello World.")
end
turbo.web.Application({{"^/ws$", WSExHandler}}):listen(8888)
turbo.ioloop.instance():start()
| Write a message in simple WebSocket example. | Write a message in simple WebSocket example.
| Lua | apache-2.0 | YuanPeir-Chen/turbo-support-mipsel,ddysher/turbo,luastoned/turbo,zcsteele/turbo,luastoned/turbo,zcsteele/turbo,mniestroj/turbo,YuanPeir-Chen/turbo-support-mipsel,kernelsauce/turbo,ddysher/turbo |
22975ae67a593890fc5383ca87a46e8e6afd0dde | demos/modipulate-lua/console/conf.lua | demos/modipulate-lua/console/conf.lua | function love.conf(t)
t.title = "Modipulate Console"
t.author = "Eric Gregory; Stevie Hryciw"
t.version = '0.9.0'
t.identity = modipulate_console
t.console = true
t.release = false
t.modules.audio = false
t.modules.sound = false
t.window.width = 300
t.window.height = 140
t.window.resizable = true
end
| function love.conf(t)
t.title = "Modipulate Console"
t.author = "Eric Gregory; Stevie Hryciw"
t.version = '0.9.0'
t.identity = modipulate_console
t.console = true
t.release = false
t.modules.audio = true
t.modules.sound = true
t.window.width = 300
t.window.height = 140
t.window.resizable = true
end
| Fix for lua console demo | Fix for lua console demo
| Lua | bsd-3-clause | MrEricSir/Modipulate,MrEricSir/Modipulate |
a86a21fae8a66132b455c2505813f9933a5751f1 | tests/testPoisson.lua | tests/testPoisson.lua | require 'randomkit'
local myTest = {}
local tester = torch.Tester()
function myTest.poissonPDF()
tester:assertalmosteq(randomkit.poissonPDF(0, 2), 0.1353352832366126918939994949, 1e-15)
tester:assertalmosteq(randomkit.poissonPDF(0, 1), 0.3678794411714423215955237701, 1e-15)
tester:assertalmosteq(randomkit.poissonPDF(1, 1), 0.3678794411714423215955237701, 1e-15)
tester:assertalmosteq(randomkit.poissonPDF(2, 1), 0.1839397205857211607977618850, 1e-15)
end
tester:add(myTest)
tester:run()
| require 'randomkit'
local myTest = {}
local tester = torch.Tester()
function myTest.poissonPDF()
tester:assertalmosteq(randomkit.poissonPDF(0, 2), 0.135335283236612, 1e-15)
tester:assertalmosteq(randomkit.poissonPDF(0, 1), 0.367879441171442, 1e-15)
tester:assertalmosteq(randomkit.poissonPDF(1, 1), 0.367879441171442, 1e-15)
tester:assertalmosteq(randomkit.poissonPDF(2, 1), 0.183939720585721, 1e-15)
tester:assertalmosteq(randomkit.poissonPDF(0, 10), 0.000045399929762, 1e-15)
tester:assertalmosteq(randomkit.poissonPDF(1, 10), 0.000453999297625, 1e-15)
tester:assertalmosteq(randomkit.poissonPDF(2, 10), 0.002269996488124, 1e-15)
end
tester:add(myTest)
tester:run()
| Tidy and extend poissionPDF tests | Tidy and extend poissionPDF tests
| Lua | bsd-3-clause | fastturtle/torch-randomkit,deepmind/torch-randomkit,deepmind/torch-randomkit,fastturtle/torch-randomkit |
c2b44f99dbe32cfbf55a015d1a80e7c9b88dcfdf | tests/test-leaks.lua | tests/test-leaks.lua | return require('lib/tap')(function (test)
test("lots-o-timers", function (print, p, expect, uv)
collectgarbage()
local before = uv.resident_set_memory()
local timer
for i = 1, 0x10000 do
timer = uv.new_timer()
uv.close(timer)
if i % 0x1000 == 0 then
timer = nil
collectgarbage()
p(i, uv.resident_set_memory())
end
end
collectgarbage()
local after = uv.resident_set_memory()
p{
before = before,
after = after,
}
assert(after < before * 1.1, "Leak in timers")
end)
end)
| Add failing memory leak test | Add failing memory leak test
| Lua | apache-2.0 | brimworks/luv,NanXiao/luv,brimworks/luv,kidaa/luv,DBarney/luv,RomeroMalaquias/luv,zhaozg/luv,daurnimator/luv,DBarney/luv,RomeroMalaquias/luv,mkschreder/luv,kidaa/luv,mkschreder/luv,xpol/luv,leecrest/luv,joerg-krause/luv,daurnimator/luv,zhaozg/luv,luvit/luv,joerg-krause/luv,daurnimator/luv,NanXiao/luv,luvit/luv,leecrest/luv,RomeroMalaquias/luv,xpol/luv | |
78b8702fd2e9be580fd803a32ba726a6c99f30c5 | prototype/luamake/luafile.lua | prototype/luamake/luafile.lua | require("compose")
require("mutation")
local function dumptable(bt, tablename)
local tabledef = {}
local output = {}
local prefix = ""
if tablename then
prefix = "$1."
end
for k, v in pairs(bt) do
if type(k) == "string" then
if type(v) == "table" then
if #v > 0 then
-- This is an ordered list value
table.insert(tabledef, prefix .. k .. " = " .. table.concat(v, " "))
else
if tablename then
-- This is a nested definition
table.insert(output, dumptable(v, tablename .. "/" .. k))
else
-- This is a top-level definition
table.insert(output, dumptable(v, k))
end
end
else
-- This is a string value
table.insert(tabledef, prefix .. k .. " = " .. tostring(v))
end
end
end
if #tabledef > 0 then
if tablename then
table.insert(output, "define " .. tablename)
table.insert(output, table.concat(tabledef, "\n"))
table.insert(output, "endef")
else
table.insert(output, table.concat(tabledef, "\n"))
end
end
return table.concat(output, "\n")
end
function luafile(name)
return dumptable(require(name))
end
| require("compose")
require("mutation")
local function dumptable(bt, tablename)
local tabledef = {}
local output = {}
local prefix = ""
if tablename then
prefix = "$1."
end
for k, v in pairs(bt) do
if type(k) == "string" then
if type(v) == "table" then
if #v > 0 then
-- This is an ordered list value
table.insert(tabledef, prefix .. k .. " = " .. table.concat(v, " "))
else
if tablename then
-- This is a nested definition
table.insert(output, dumptable(v, tablename .. "/" .. k))
else
-- This is a top-level definition
table.insert(output, dumptable(v, k))
end
end
else
-- This is a string value
table.insert(tabledef, prefix .. k .. " = " .. tostring(v))
-- TODO: think about how we can support multi-line string definitions
-- at the top-level and avoid multi-line problems within tables
end
end
end
if #tabledef > 0 then
if tablename then
table.insert(output, "define " .. tablename)
table.insert(output, table.concat(tabledef, "\n"))
table.insert(output, "endef")
else
table.insert(output, table.concat(tabledef, "\n"))
end
end
return table.concat(output, "\n")
end
function luafile(name)
return dumptable(require(name))
end
| Add TODO on multi-line strings | Add TODO on multi-line strings
| Lua | mit | sjanhunen/moss,sjanhunen/moss,sjanhunen/gnumake-molds |
1334656c6ac726938bedb0cadaed09caf459c0b5 | src/xenia/cpu/ppc/testing/premake5.lua | src/xenia/cpu/ppc/testing/premake5.lua | project_root = "../../../../.."
include(project_root.."/tools/build")
group("tests")
project("xenia-cpu-ppc-tests")
uuid("2a57d5ac-4024-4c49-9cd3-aa3a603c2ef8")
kind("ConsoleApp")
language("C++")
links({
"gflags",
"xenia-base",
"xenia-core",
"xenia-cpu",
"xenia-cpu-backend-x64",
})
files({
"ppc_testing_main.cc",
"../../../base/main_"..platform_suffix..".cc",
})
files({
"*.s",
})
includedirs({
project_root.."/third_party/gflags/src",
})
filter("files:*.s")
flags({"ExcludeFromBuild"})
filter("platforms:Windows")
debugdir(project_root)
debugargs({
"--flagfile=scratch/flags.txt",
"2>&1",
"1>scratch/stdout-testing.txt",
})
-- xenia-base needs this
links({"xenia-ui"})
| project_root = "../../../../.."
include(project_root.."/tools/build")
group("tests")
project("xenia-cpu-ppc-tests")
uuid("2a57d5ac-4024-4c49-9cd3-aa3a603c2ef8")
kind("ConsoleApp")
language("C++")
links({
"xenia-cpu-backend-x64",
"xenia-cpu",
"xenia-core",
"xenia-base",
"gflags",
"capstone", -- cpu-backend-x64
})
files({
"ppc_testing_main.cc",
"../../../base/main_"..platform_suffix..".cc",
})
files({
"*.s",
})
includedirs({
project_root.."/third_party/gflags/src",
})
filter("files:*.s")
flags({"ExcludeFromBuild"})
filter("platforms:Windows")
debugdir(project_root)
debugargs({
"--flagfile=scratch/flags.txt",
"2>&1",
"1>scratch/stdout-testing.txt",
})
-- xenia-base needs this
links({"xenia-ui"})
| Adjust link order for clang | xenia-cpu-ppc-tests: Adjust link order for clang
| Lua | bsd-3-clause | maxton/xenia,sephiroth99/xenia,maxton/xenia,sephiroth99/xenia,sephiroth99/xenia,maxton/xenia |
f8c2d3b6098c6ac31cddb1a9f09e6289c895891c | hammerspoon/hyper.lua | hammerspoon/hyper.lua | -- A global variable for Hyper Mode
hyperMode = hs.hotkey.modal.new({}, 'F18')
-- Keybindings for launching apps in Hyper Mode
hyperModeAppMappings = {
{ 'a', 'iTunes' }, -- "A" for "Apple Music"
{ 'b', 'Google Chrome' }, -- "B" for "Browser"
{ 'c', 'Slack' }, -- "C for "Chat"
{ 'd', 'Remember The Milk' }, -- "D" for "Do!" ... or "Done!"
{ 'e', 'Atom Beta' }, -- "E" for "Editor"
{ 'f', 'Finder' }, -- "F" for "Finder"
{ 'g', 'Mailplane 3' }, -- "G" for "Gmail"
{ 't', 'iTerm' }, -- "T" for "Terminal"
}
for i, mapping in ipairs(hyperModeAppMappings) do
hyperMode:bind({}, mapping[1], function()
hs.application.launchOrFocus(mapping[2])
end)
end
-- Enter Hyper Mode when F17 (right option key) is pressed
pressedF17 = function()
hyperMode:enter()
end
-- Leave Hyper Mode when F17 (right option key) is released.
releasedF17 = function()
hyperMode:exit()
end
-- Bind the Hyper key
f17 = hs.hotkey.bind({}, 'F17', pressedF17, releasedF17)
| -- A global variable for Hyper Mode
hyperMode = hs.hotkey.modal.new({}, 'F18')
-- Keybindings for launching apps in Hyper Mode
hyperModeAppMappings = {
{ 'a', 'iTunes' }, -- "A" for "Apple Music"
{ 'b', 'Google Chrome' }, -- "B" for "Browser"
{ 'c', 'Hackable Slack Client' }, -- "C for "Chat"
{ 'd', 'Remember The Milk' }, -- "D" for "Do!" ... or "Done!"
{ 'e', 'Atom Beta' }, -- "E" for "Editor"
{ 'f', 'Finder' }, -- "F" for "Finder"
{ 'g', 'Mailplane 3' }, -- "G" for "Gmail"
{ 't', 'iTerm' }, -- "T" for "Terminal"
}
for i, mapping in ipairs(hyperModeAppMappings) do
hyperMode:bind({}, mapping[1], function()
hs.application.launchOrFocus(mapping[2])
end)
end
-- Enter Hyper Mode when F17 (right option key) is pressed
pressedF17 = function()
hyperMode:enter()
end
-- Leave Hyper Mode when F17 (right option key) is released.
releasedF17 = function()
hyperMode:exit()
end
-- Bind the Hyper key
f17 = hs.hotkey.bind({}, 'F17', pressedF17, releasedF17)
| Use Hackable Slack Client as chat app | Use Hackable Slack Client as chat app
| Lua | mit | jasonrudolph/keyboard,jasonrudolph/keyboard |
8388e2a0dfef0a8ca415495911ea7c183c6ff44d | spec/unit/ffi_wrapper.lua | spec/unit/ffi_wrapper.lua | -- don't try to overwrite metatables so we can use --auto-insulate-tests
-- shamelessly copied from https://github.com/Olivine-Labs/busted/commit/db6d8b4be8fd099ab387efeb8232cfd905912abb
local ffi = require "ffi"
local old_metatype = ffi.metatype
local exists = {}
ffi.metatype = function(def, mttable)
if exists[def] then return exists[def] end
exists[def] = old_metatype(def, mttable)
return exists[def]
end
| -- Check if we're running a busted version recent enough that we don't need to deal with the LuaJIT hacks...
-- That currently means > 2.0.0 (i.e., scm-2, which isn't on LuaRocks...).
local busted_ok = false
for name, _ in pairs(package.loaded) do
if name == "busted.luajit" then
busted_ok = true
break
end
end
-- Whee!
if busted_ok then
return
end
-- Don't try to overwrite metatables so we can use --auto-insulate-tests
-- Shamelessly copied from https://github.com/Olivine-Labs/busted/commit/2dfff99bda01fd3da56fd23415aba5a2a4cc0ffd
local ffi = require "ffi"
local original_metatype = ffi.metatype
local original_store = {}
ffi.metatype = function (primary, ...)
if original_store[primary] then
return original_store[primary]
end
local success, result, err = pcall(original_metatype, primary, ...)
if not success then
-- hard error was thrown
error(result, 2)
end
if not result then
-- soft error was returned
return result, err
end
-- it worked, store and return
original_store[primary] = result
return result
end
| Update the busted ffi.metatype wrapper | Tests: Update the busted ffi.metatype wrapper
| Lua | agpl-3.0 | NiLuJe/koreader-base,NiLuJe/koreader-base,Frenzie/koreader-base,NiLuJe/koreader-base,koreader/koreader-base,Frenzie/koreader-base,koreader/koreader-base,koreader/koreader-base,NiLuJe/koreader-base,Frenzie/koreader-base,koreader/koreader-base,Frenzie/koreader-base |
3b9d73ed6af80fcff9690479d11fbb26aac651da | src/cosy/redis/conf.lua | src/cosy/redis/conf.lua | return function (loader)
local Default = loader.load "cosy.configuration.layers".default
Default.redis = {
interface = "localhost",
port = 6379,
database = 0,
pool_size = 5,
}
end
| return function (loader)
local Default = loader.load "cosy.configuration.layers".default
Default.redis = {
interface = "127.0.0.1",
port = 6379,
database = 0,
pool_size = 5,
}
end
| Use 127.0.0.1 for redis instead of localhost, because it does not work in ubuntu. | Use 127.0.0.1 for redis instead of localhost, because it does not work in ubuntu.
| Lua | mit | CosyVerif/library,CosyVerif/library,CosyVerif/library |
1e89857ceece282c5d32e73ca1cc19216f7d205c | premake5.lua | premake5.lua | newoption {
trigger = 'enable-big-endian',
description = 'Enable big-endian byte order support (default is little-endian)'
}
solution "spillover"
configurations { "Debug", "Release" }
platforms { "x64", "x32" }
project "spillover"
kind "StaticLib"
language "C"
targetdir "bin/%{cfg.platform}/%{cfg.buildcfg}"
includedirs { "./include" }
files { "**.h", "src/**.c" }
filter "configurations:Debug"
defines { "DEBUG" }
flags {
"Symbols",
"FatalWarnings",
"FatalCompileWarnings"
}
filter "configurations:Release"
defines { "NDEBUG" }
optimize "On"
project "spillover-tests"
kind "ConsoleApp"
language "C"
targetdir "bin/%{cfg.platform}/%{cfg.buildcfg}"
includedirs { "./include" }
links { "spillover" }
files { "**.h", "test/**.c" }
filter "configurations:Debug"
defines { "DEBUG" }
flags {
"Symbols",
}
filter "configurations:Release"
defines { "NDEBUG" }
optimize "On"
| newoption {
trigger = 'enable-big-endian',
description = 'Enable big-endian byte order support (default is little-endian)'
}
solution "spillover"
configurations { "Debug", "Release" }
platforms { "x64", "x32" }
project "spillover"
kind "StaticLib"
language "C"
targetdir "bin/%{cfg.platform}/%{cfg.buildcfg}"
includedirs { "./include" }
files { "**.h", "src/**.c" }
filter "configurations:Debug"
defines { "DEBUG" }
flags {
"Symbols",
"FatalWarnings",
"FatalCompileWarnings"
}
filter "configurations:Release"
defines { "NDEBUG" }
optimize "On"
project "spillover-tests"
kind "ConsoleApp"
language "C"
targetdir "bin/%{cfg.platform}/%{cfg.buildcfg}"
includedirs { "./include" }
files { "**.h", "test/**.c" }
links { "spillover" }
configurations { "windows" }
links { "Ws2_32.lib" }
filter "configurations:Debug"
defines { "DEBUG" }
flags {
"Symbols",
}
filter "configurations:Release"
defines { "NDEBUG" }
optimize "On"
| Add Ws2_32.lib library for spillover-tests project | Add Ws2_32.lib library for spillover-tests project
| Lua | mit | morphim/spillover |
5a51ccd3d232c0d514203f309f67a25733929b3d | server/playerdeath.lua | server/playerdeath.lua | -- Player death
-- deadPlayer - The player (character) whose hitpoints have just been set to zero
require("base.common")
module("server.playerdeath", package.seeall)
function playerDeath(deadPlayer)
world:makeSound(25,deadPlayer.pos);
showDeathDialog(deadPlayer);
--vilarion: Please insert the death consequences here.
end
function showDeathDialog(deadPlayer)
local callback = function(nothing) end; --empty callback
if deadPlayer:getPlayerLanguage() == 0 then
dialog = MessageDialog("Tod", "Du bist gestorben. Die Welt um dich herum verblasst und du bereitest dich darauf vor, den Gttern in Chergas Reich der Toten gegenberzutreten.", callback);
else
dialog = MessageDialog("Death", "You have died. The world around you fades and you prepare yourself to face the Gods in the afterlife of Cherga's Realm.", callback);
end
deadPlayer:requestMessageDialog(dialog); --showing the text
end | -- Player death
-- deadPlayer - The player (character) whose hitpoints have just been set to zero
require("base.common")
module("server.playerdeath", package.seeall)
DURABILITY_LOSS = 10
BLOCKED_ITEM = 228
function playerDeath(deadPlayer)
for i=Character.head,Character.coat do
local item = deadPlayer:getItemAt(i)
local common = world:getItemStats(item)
if item.id > 0 and item.id ~= BLOCKEDITEM and item.quality > 100 and not common.isStackable then
local durability = item.quality % 100
if durability <= DURABILITY_LOSS then
deadPlayer:increaseAtPos(i, -1)
else
item.quality = item.quality - DURABILITY_LOSS
world:changeItem(item)
end
end
end
world:makeSound(25,deadPlayer.pos);
showDeathDialog(deadPlayer);
end
function showDeathDialog(deadPlayer)
local callback = function(nothing) end; --empty callback
if deadPlayer:getPlayerLanguage() == 0 then
dialog = MessageDialog("Tod", "Du bist gestorben. Die Welt um dich herum verblasst und du bereitest dich darauf vor, den Gttern in Chergas Reich der Toten gegenberzutreten.", callback);
else
dialog = MessageDialog("Death", "You have died. The world around you fades and you prepare yourself to face the Gods in the afterlife of Cherga's Realm.", callback);
end
deadPlayer:requestMessageDialog(dialog); --showing the text
end
| Reduce item durability upon player death | Reduce item durability upon player death
| Lua | agpl-3.0 | vilarion/Illarion-Content,LaFamiglia/Illarion-Content,Illarion-eV/Illarion-Content,KayMD/Illarion-Content,Baylamon/Illarion-Content |
581eb3f4a1a13bc2bac9be1ea4874ca45edadb6b | modulefiles/emop.lua | modulefiles/emop.lua | load("gcc/4.8.2")
load("python/2.7.8")
load("beautifulsoup4") --local
load("leptonica/1.71")
load("icu/52.1")
load("tesseract/3.03-rc1")
load("java/1.7.0_67")
| load("gcc/4.8.2")
load("python/2.7.8")
load("beautifulsoup4") --local
load("leptonica/1.71")
load("icu/52.1")
--load("tesseract/3.03-rc1")
load("tesseract/3.02-r889")
load("java/1.7.0_67")
| Use older version of tesseract | Use older version of tesseract
| Lua | apache-2.0 | Early-Modern-OCR/hOCR-De-Noising |
147d04a68ca1f24ad72a11f332782403bb34070e | zebra/core/models.lua | zebra/core/models.lua | local Models = {}
function Models.load(module_name)
local m = require(module_name)
m.db:define(m)
end
return Models
| local Models = {}
function Models.load(module_name)
local m = require(module_name)
m.db:define(m)
return m
end
return Models
| Allow modules to run in controllers. | Allow modules to run in controllers.
| Lua | mit | ostinelli/gin,istr/gin |
865a987752c65fc691c85ff4f9eb96af755b7e70 | examples/osx-bundle/tundra.lua | examples/osx-bundle/tundra.lua |
Build {
Configs = {
Config {
Name = "macosx-clang",
DefaultOnHost = "macosx",
Tools = { "clang-osx" },
},
},
SyntaxExtensions = { "osx-bundle" },
Units = "units.lua",
}
|
Build {
Configs = {
Config {
Name = "macosx-clang",
DefaultOnHost = "macosx",
Tools = { "clang-osx" },
},
},
SyntaxExtensions = { "tundra.syntax.osx-bundle" },
Units = "units.lua",
}
| Fix "osx-bundle" example following "use explicit package names" for syntax modules Commit id: d9ad231f27be72db6796bdcc1f2da69cb55055d2 | Fix "osx-bundle" example following "use explicit package names" for syntax modules
Commit id: d9ad231f27be72db6796bdcc1f2da69cb55055d2
| Lua | mit | deplinenoise/tundra,bmharper/tundra,deplinenoise/tundra,bmharper/tundra,deplinenoise/tundra,bmharper/tundra,bmharper/tundra |
fca14238b503da807b71736601ed3d2629b2c999 | wow/Frame-Events.lua | wow/Frame-Events.lua | require "wow/Frame";
local Delegate = OOP.Class();
function Delegate:Constructor(frame)
self.frame = frame;
self.eventHandlers = {};
end;
function Delegate:HasScript(event)
return true;
end;
function Delegate:FireEvent(event, ...)
local handler = self.eventHandlers[event];
if handler then
handler(self.frame, event, ...);
end;
end;
function Delegate:SetScript(event, handler)
if not self:HasScript(event) then
return;
end;
trace(event);
self.eventHandlers[event] = handler;
end;
function Delegate:GetScript(event)
return self.eventHandlers[event];
end;
function Delegate:HookScript(event, handler)
error("Hooking is not supported");
end;
function Delegate:IsEventRegistered()
error("Global events cannot be registered from frames");
end;
function Delegate:RegisterEvent(event)
error("Global events cannot be registered from frames");
end;
function Delegate:UnregisterEvent(event)
error("Global events cannot be registered from frames");
end;
WoW.SetFrameDelegate("Frame", "event", Delegate, "New");
| require "wow/Frame";
local Delegate = OOP.Class();
function Delegate:Constructor(frame)
self.frame = frame;
self.eventHandlers = {};
end;
function Delegate:HasScript(event)
return true;
end;
function Delegate:FireEvent(event, ...)
local handler = self.eventHandlers[event];
if handler then
handler(self.frame, ...);
end;
end;
function Delegate:SetScript(event, handler)
if not self:HasScript(event) then
return;
end;
trace(event);
self.eventHandlers[event] = handler;
end;
function Delegate:GetScript(event)
return self.eventHandlers[event];
end;
function Delegate:HookScript(event, handler)
error("Hooking is not supported");
end;
function Delegate:IsEventRegistered()
error("Global events cannot be registered from frames");
end;
function Delegate:RegisterEvent(event)
error("Global events cannot be registered from frames");
end;
function Delegate:UnregisterEvent(event)
error("Global events cannot be registered from frames");
end;
WoW.SetFrameDelegate("Frame", "event", Delegate, "New");
| Fix a bad signature for FireEvent | Fix a bad signature for FireEvent
| Lua | mit | Thonik/rainback |
2ac61eafc2c702a57bb7252f86777fa4f3eb3ac3 | test/lua/unit/mempool.lua | test/lua/unit/mempool.lua | context("Memory pool unit tests", function()
test("Mempool variables", function()
local mempool = require "rspamd_mempool"
local pool = mempool.create()
assert_not_nil(pool)
-- string
pool:set_variable('a', 'bcd')
local var = pool:get_variable('a')
assert_equal(var, 'bcd')
-- integer
pool:set_variable('a', 1)
var = pool:get_variable('a', 'double')
assert_equal(var, 1)
-- float
pool:set_variable('a', 1.01)
var = pool:get_variable('a', 'double')
assert_equal(var, 1.01)
-- boolean
pool:set_variable('a', false)
var = pool:get_variable('a', 'bool')
assert_equal(var, false)
-- multiple
pool:set_variable('a', 'bcd', 1, 1.01, false)
local v1, v2, v3, v4 = pool:get_variable('a', 'string,double,double,bool')
assert_equal(v1, 'bcd')
assert_equal(v2, 1)
assert_equal(v3, 1.01)
assert_equal(v4, false)
end)
end) | context("Memory pool unit tests", function()
test("Mempool variables", function()
local mempool = require "rspamd_mempool"
local pool = mempool.create()
assert_not_nil(pool)
-- string
pool:set_variable('a', 'bcd')
local var = pool:get_variable('a')
assert_equal(var, 'bcd')
-- integer
pool:set_variable('a', 1)
var = pool:get_variable('a', 'double')
assert_equal(var, 1)
-- float
pool:set_variable('a', 1.01)
var = pool:get_variable('a', 'double')
assert_equal(var, 1.01)
-- boolean
pool:set_variable('a', false)
var = pool:get_variable('a', 'bool')
assert_equal(var, false)
-- multiple
pool:set_variable('a', 'bcd', 1, 1.01, false)
local v1, v2, v3, v4 = pool:get_variable('a', 'string,double,double,bool')
assert_equal(v1, 'bcd')
assert_equal(v2, 1)
assert_equal(v3, 1.01)
assert_equal(v4, false)
pool:destroy()
end)
end) | Destroy memory pool in test. | Destroy memory pool in test.
| Lua | bsd-2-clause | andrejzverev/rspamd,dark-al/rspamd,AlexeySa/rspamd,minaevmike/rspamd,AlexeySa/rspamd,minaevmike/rspamd,AlexeySa/rspamd,AlexeySa/rspamd,minaevmike/rspamd,amohanta/rspamd,AlexeySa/rspamd,andrejzverev/rspamd,andrejzverev/rspamd,minaevmike/rspamd,AlexeySa/rspamd,minaevmike/rspamd,amohanta/rspamd,amohanta/rspamd,dark-al/rspamd,andrejzverev/rspamd,andrejzverev/rspamd,dark-al/rspamd,AlexeySa/rspamd,minaevmike/rspamd,andrejzverev/rspamd,andrejzverev/rspamd,minaevmike/rspamd,amohanta/rspamd,AlexeySa/rspamd,minaevmike/rspamd,andrejzverev/rspamd,minaevmike/rspamd,AlexeySa/rspamd,dark-al/rspamd,amohanta/rspamd,dark-al/rspamd |
0e297f2cbcd81ff165c13f407ee204b5d1669897 | src/program/alarms/get_state/get_state.lua | src/program/alarms/get_state/get_state.lua | module(..., package.seeall)
function run (args)
local opts = { command='get-alarms-state', with_path=true, is_config=false }
args = common.parse_command_line(args, opts)
local response = common.call_leader(
args.instance_id, 'get-alarms-state',
{ schema = args.schema_name, revision = args.revision_date,
path = args.path, print_default = args.print_default,
format = args.format })
common.print_and_exit(response, "state")
end
| Add subprogram to fetch alarms state | Add subprogram to fetch alarms state
| Lua | apache-2.0 | snabbco/snabb,Igalia/snabbswitch,dpino/snabb,snabbco/snabb,Igalia/snabbswitch,snabbco/snabb,dpino/snabbswitch,eugeneia/snabb,alexandergall/snabbswitch,dpino/snabbswitch,dpino/snabb,snabbco/snabb,snabbco/snabb,alexandergall/snabbswitch,eugeneia/snabbswitch,alexandergall/snabbswitch,SnabbCo/snabbswitch,Igalia/snabb,SnabbCo/snabbswitch,eugeneia/snabb,dpino/snabb,Igalia/snabb,Igalia/snabb,alexandergall/snabbswitch,dpino/snabb,Igalia/snabb,Igalia/snabbswitch,SnabbCo/snabbswitch,eugeneia/snabb,Igalia/snabb,dpino/snabbswitch,Igalia/snabb,Igalia/snabbswitch,snabbco/snabb,eugeneia/snabb,eugeneia/snabb,dpino/snabb,SnabbCo/snabbswitch,dpino/snabb,Igalia/snabbswitch,eugeneia/snabbswitch,dpino/snabb,alexandergall/snabbswitch,alexandergall/snabbswitch,dpino/snabbswitch,eugeneia/snabbswitch,eugeneia/snabb,eugeneia/snabb,snabbco/snabb,Igalia/snabb,eugeneia/snabbswitch,alexandergall/snabbswitch,Igalia/snabb,snabbco/snabb,eugeneia/snabb,alexandergall/snabbswitch | |
87ca1ae446f82fd96ce2478737bd2dab8e76e21b | lua/entities/gmod_wire_button/shared.lua | lua/entities/gmod_wire_button/shared.lua | ENT.Type = "anim"
ENT.Base = "base_wire_entity"
ENT.PrintName = "Wire Button"
ENT.Author = ""
ENT.Contact = ""
ENT.Purpose = ""
ENT.Instructions = ""
ENT.Spawnable = false
ENT.AdminSpawnable = false
function ENT:SetOn( bOn )
self:SetNetworkedBool( "OnOff", bOn, true )
end
function ENT:GetOn()
return self:GetNetworkedBool( "OnOff" )
end
| ENT.Type = "anim"
ENT.Base = "base_wire_entity"
ENT.PrintName = "Wire Button"
ENT.Author = ""
ENT.Contact = ""
ENT.Purpose = ""
ENT.Instructions = ""
ENT.Spawnable = false
ENT.AdminSpawnable = false
ENT.Editable = true
function ENT:SetupDataTables()
self:NetworkVar( "Bool", 0, "On", { KeyName = "on", Edit = { type = "Bool" } } )
end
| Use the new Data Tables method for the on/off state. | gmod_wire_button: Use the new Data Tables method for the on/off state.
| Lua | apache-2.0 | thegrb93/wire,wiremod/wire,Grocel/wire,Python1320/wire,notcake/wire,garrysmodlua/wire,plinkopenguin/wiremod,NezzKryptic/Wire,bigdogmat/wire,CaptainPRICE/wire,dvdvideo1234/wire,immibis/wiremod,mms92/wire,mitterdoo/wire,sammyt291/wire,rafradek/wire |
9275f152795797f6612031c946db0a621780a2b8 | third_party/vulkan/loader/premake5.lua | third_party/vulkan/loader/premake5.lua | group("third_party")
project("vulkan-loader")
uuid("07d77359-1618-43e6-8a4a-0ee9ddc5fa6a")
kind("StaticLib")
language("C")
defines({
"_LIB",
"API_NAME=\"vulkan\"",
})
removedefines({
"_UNICODE",
"UNICODE",
})
includedirs({
".",
})
recursive_platform_files()
-- Included elsewhere
removefiles("vk_loader_extensions.c")
filter("platforms:Windows")
warnings("Off") -- Too many warnings.
characterset("MBCS")
defines({
"VK_USE_PLATFORM_WIN32_KHR",
})
filter("platforms:not Windows")
removefiles("dirent_on_windows.c")
filter("platforms:Linux")
defines({
[[SYSCONFDIR="\"/etc\""]],
[[DATADIR="\"/usr/share\""]],
})
| group("third_party")
project("vulkan-loader")
uuid("07d77359-1618-43e6-8a4a-0ee9ddc5fa6a")
kind("StaticLib")
language("C")
defines({
"_LIB",
"API_NAME=\"vulkan\"",
})
removedefines({
"_UNICODE",
"UNICODE",
})
includedirs({
".",
})
recursive_platform_files()
-- Included elsewhere
removefiles("vk_loader_extensions.c")
filter("platforms:Windows")
warnings("Off") -- Too many warnings.
characterset("MBCS")
defines({
"VK_USE_PLATFORM_WIN32_KHR",
})
filter("platforms:not Windows")
removefiles("dirent_on_windows.c")
filter("platforms:Linux")
defines({
[[SYSCONFDIR="\"/etc\""]],
[[FALLBACK_CONFIG_DIRS="\"/etc/xdg\""]],
[[DATADIR="\"/usr/share\""]],
[[FALLBACK_DATA_DIRS="\"/usr/share:/usr/local/share\""]],
})
| Add missing consts for default vulkan config dirs on linux | Add missing consts for default vulkan config dirs on linux
| Lua | bsd-3-clause | sephiroth99/xenia,sephiroth99/xenia,sephiroth99/xenia |
751c414a03d068de3d9578b23aa8cd239f49ed4f | prototype-code/wmii_event_broadcast.lua | prototype-code/wmii_event_broadcast.lua | #!/bin/env lua
-- Proof of concept to broadcast wmii events to DBus
local l2dbus = require('l2dbus')
local l2dbus_service = require('l2dbus.service')
local dump = require("pl.pretty").dump
-- This enables the passed message types
l2dbus.Trace.setFlags(l2dbus.Trace.ERROR, l2dbus.Trace.WARN)
--l2dbus.Trace.setFlags(l2dbus.Trace.ALL)
-- Our DBus interface
local interface_name = "com.bs.wmii_event_broadcast"
local wmii_event_interface = {
signals = {
{name = "Key",
args = {{sig = "s", name = "key"}}
},
{name = "ClientFocus",
args = {{sig = "s", name = "client_id"}}
},
{name = "AreaFocus",
args = {{sig = "s", name = "area"}}
},
{name = "ColumnFocus",
args = {{sig = "s", name = "column"}}
},
{name = "FocusTag",
args = {{sig = "s", name = "tag"}}
},
{name = "UnfocusTag",
args = {{sig = "s", name = "tag"}}
},
{name = "FocusFloating"}
}
}
-- Using the service module, we create a new service and object.
-- Since we are only emitting signals, we don't need any event
-- handler(s)
local svc = l2dbus_service.new("/com/bs/wmii_event_broadcast", false, nil)
svc:addInterface(interface_name, wmii_event_interface)
-- create the event loop, dispatcher, connection
local mainLoop = require("l2dbus_glib").MainLoop.new()
local dispatcher = l2dbus.Dispatcher.new(mainLoop)
assert( nil ~= dispatcher )
local conn = l2dbus.Connection.openStandard(dispatcher, l2dbus.Dbus.BUS_SESSION)
assert( nil ~= conn )
-- attach the service to the connection
svc:attach(conn)
-- callback to handle wmii events by broadcasting them as DBus signals
function on_wmii_event(watch, evTable, fd)
if evTable.READ then
local event, arg
local event_text = fd:read()
for word in event_text:gmatch("[%w-]+") do
if event then
arg = word
elseif arg then
error("Bad event text: " .. event_text)
else
event = word
end
end
svc:emit(conn, interface_name, event, arg)
end
end
-- open the stream of wmii events
local fd = io.popen("wmiir read /event", "r")
-- add the stream to the fd set being watched
local watch = l2dbus.Watch.new(dispatcher, fd, l2dbus.Watch.READ, on_wmii_event, fd)
watch:setEnable(true)
-- start event loop
dispatcher:run(l2dbus.Dispatcher.DISPATCH_WAIT)
| Add Proof of concept to broadcast wmii events to DBus | Add Proof of concept to broadcast wmii events to DBus
| Lua | mit | jbalint/banshee-sympatico,jbalint/banshee-sympatico,jbalint/banshee-sympatico,jbalint/banshee-sympatico,jbalint/banshee-sympatico,jbalint/banshee-sympatico,jbalint/banshee-sympatico,jbalint/banshee-sympatico | |
19f62286ccef2889aa71e97a6dbaeb53c257b581 | hammerspoon/.hammerspoon/launch-apps.lua | hammerspoon/.hammerspoon/launch-apps.lua | local module = {}
appLauncher = function (bundleID)
return function()
local focusedApp = hs.application.frontmostApplication()
if focusedApp:bundleID() == bundleID then
focusedApp:hide()
else
hs.application.open(bundleID)
end
end
end
module.init = function()
hs.hotkey.bind({'cmd', 'shift'}, 'space', appLauncher('com.googlecode.iterm2'))
hs.hotkey.bind({'ctrl', 'alt', 'shift'}, 'space', appLauncher('io.dynalist'))
end
return module
| local module = {}
appLauncher = function (bundleID)
return function()
local focusedApp = hs.application.frontmostApplication()
if focusedApp:bundleID() == bundleID then
focusedApp:hide()
else
hs.application.launchOrFocusByBundleID(bundleID)
end
end
end
module.init = function()
hs.hotkey.bind({'cmd', 'shift'}, 'space', appLauncher('com.googlecode.iterm2'))
hs.hotkey.bind({'ctrl', 'alt', 'shift'}, 'space', appLauncher('io.dynalist'))
end
return module
| Use better function for launching apps | Use better function for launching apps
| Lua | mit | spinningarrow/.files,spinningarrow/.files |
dec6e1605b70927212b956604037117f3545d899 | scripts/format.lua | scripts/format.lua | -- Filter and format messages
-- return empty string to filter the message
function main(event)
if event.type ~= "Code-Review" and event.type ~= "WaitForVerification" and event.type ~= "Verified" then
return ""
end
if string.match(event.type, "WaitForVerification") then
icon = "⌛"
elseif event.value > 0 then
icon = "👍"
elseif event.value == 0 then
icon = "👉"
else
icon = "👎"
end
sign = ""
if event.value > 0 then
sign = "+"
end
-- TODO: when Spark will allow to format text with different colors, set
-- green resp. red color here.
f = "[%s](%s) (%s) %s %s%s (%s) from %s"
msg = string.format(f, event.subject, event.url, event.project, icon, sign, event.value, event.type, event.approver)
len = 0
lines = {}
for line in string.gmatch(event.comment, "[^\r\n]+") do
if event.is_human then
table.insert(lines, "> " .. line)
len = len + 1
elseif string.match(line, "FAILURE") then
table.insert(lines, "> " .. line)
len = len + 1
end
end
if len == 0 then
return msg
else
lines = table.concat(lines, "<br>\n")
return msg .. "\n\n" .. lines
end
end
| -- Filter and format messages
-- return empty string to filter the message
function main(event)
if event.type ~= "Code-Review" and event.type ~= "WaitForVerification" and event.type ~= "Verified" then
return ""
end
if string.match(event.type, "WaitForVerification") then
icon = "⌛"
elseif event.value > 0 then
icon = "👍"
elseif event.value == 0 then
icon = "📝"
else
icon = "👎"
end
sign = ""
if event.value > 0 then
sign = "+"
end
-- TODO: when Spark will allow to format text with different colors, set
-- green resp. red color here.
f = "[%s](%s) (%s) %s %s%s (%s) from %s"
msg = string.format(f, event.subject, event.url, event.project, icon, sign, event.value, event.type, event.approver)
len = 0
lines = {}
for line in string.gmatch(event.comment, "[^\r\n]+") do
if event.is_human then
table.insert(lines, "> " .. line)
len = len + 1
elseif string.match(line, "FAILURE") then
table.insert(lines, "> " .. line)
len = len + 1
end
end
if len == 0 then
return msg
else
lines = table.concat(lines, "<br>\n")
return msg .. "\n\n" .. lines
end
end
| Use memo emoji when getting Code-Review: 0, since it's always a human comment. | Use memo emoji when getting Code-Review: 0, since it's always a human comment.
| Lua | apache-2.0 | boxdot/gerritbot-rs,boxdot/gerritbot-rs,boxdot/gerritbot-rs |
3106df6ba2aeb23aaee1e69201fb84299ac0fe75 | hammerspoon/.hammerspoon/launch-apps.lua | hammerspoon/.hammerspoon/launch-apps.lua | local module = {}
function appLauncher(bundleID)
return function()
local focusedApp = hs.application.frontmostApplication()
if focusedApp:bundleID() == bundleID then
focusedApp:hide()
else
hs.application.launchOrFocusByBundleID(bundleID)
end
end
end
module.init = function()
hs.hotkey.bind({'cmd', 'shift'}, 'space', appLauncher('com.apple.Terminal'))
hs.hotkey.bind({'ctrl', 'alt', 'shift'}, 'space', appLauncher('io.dynalist'))
end
return module
| local module = {}
function appLauncher(bundleID)
return function()
local focusedApp = hs.application.frontmostApplication()
if focusedApp:bundleID() == bundleID then
focusedApp:hide()
else
hs.application.launchOrFocusByBundleID(bundleID)
end
end
end
module.init = function()
hs.hotkey.bind({'cmd', 'shift'}, 'space', appLauncher('com.apple.Terminal'))
end
return module
| Remove dynalist from app hotkeys | Remove dynalist from app hotkeys
I don't use it any more
| Lua | mit | spinningarrow/.files,spinningarrow/.files |
9e6be0f2d25e0707e387a5f76a0b66118c6bb6ff | himan-scripts/snwc-radiation.lua | himan-scripts/snwc-radiation.lua | --
-- SmartMet NWC parameters
--
-- Create radiation parameters to SNWC using data from "edited data"
-- and fixing the raditation if total cloudiness has changed.
--
local MISS = missing
local editor_prod = producer(181, "SMARTMET")
editor_prod:SetCentre(86)
editor_prod:SetProcess(181)
local editor_origintime = raw_time(radon:GetLatestTime(editor_prod, "", 0))
local editor_time = forecast_time(editor_origintime, current_time:GetValidDateTime())
local SW = luatool:FetchWithProducer(editor_time, level(HPLevelType.kHeight, 0), param("RADGLO-WM2"), current_forecast_type, editor_prod, "")
local LW = luatool:FetchWithProducer(editor_time, level(HPLevelType.kHeight, 0), param("RADLW-WM2"), current_forecast_type, editor_prod, "")
local CC = luatool:FetchWithType(current_time, level(HPLevelType.kHeight, 0), param("N-0TO1"), current_forecast_type)
local CC_ORIG = luatool:FetchWithProducer(editor_time, level(HPLevelType.kHeight, 0), param("N-PRCNT"), current_forecast_type, editor_prod, "")
if not SW or not LW or not CC or not CC_ORIG then
return
end
local _SW = {}
local _LW = {}
for i=1, #SW do
local cc = CC[i]
local cc_orig = CC_ORIG[i] * 0.01
_SW[i] = MISS
_LW[i] = MISS
if cc == cc and SW[i] == SW[i] and LW[i] == LW[i] and CC_ORIG[i] == CC_ORIG[i] then
_SW[i] = (1 - 0.67 * math.pow(cc, 3.32)) / (1 - 0.67 * math.pow(cc_orig, 3.32)) * SW[i]
_LW[i] = (1 + 0.22 * math.pow(cc, 2.75)) / (1 + 0.22 * math.pow(cc_orig, 2.75)) * LW[i]
if (_SW[i] > 0 and ElevationAngle_(result:GetLatLon(i), current_time:GetValidDateTime()) <= 0) then
_SW[i] = 0
end
_SW[i] = math.max(0, _SW[i])
end
end
result:SetParam(param("RADGLO-WM2"))
result:SetValues(_SW)
luatool:WriteToFile(result)
result:SetParam(param("RADLW-WM2"))
result:SetValues(_LW)
luatool:WriteToFile(result)
| Add script to produce radiation parameters | STU-14421: Add script to produce radiation parameters
| Lua | mit | fmidev/himan,fmidev/himan,fmidev/himan | |
b4c3ad85906a75c00251ec7da3da826fc32c03f3 | test/dom/Document-title.lua | test/dom/Document-title.lua | local parse = require("gumbo").parse
local assert = assert
local _ENV = nil
assert(parse("<title> test x y </title>").title == "test x y")
assert(parse("<title>Hello world!</title>").title == "Hello world!")
assert(parse("<title> foo \t\rb\n\far\r\n</title>").title == "foo b ar")
assert(parse("<title></title>").title == "")
assert(parse("<title> </title>").title == "")
assert(parse("<title> \n\t \f \r </title>").title == "")
assert(parse("").title == "")
| local parse = require("gumbo").parse
local assert = assert
local _ENV = nil
assert(parse("<title> test x y </title>").title == "test x y")
assert(parse("<title>Hello world!</title>").title == "Hello world!")
assert(parse("<title> foo \t\rb\n\far\r\n</title>").title == "foo b ar")
assert(parse("<title></title>").title == "")
assert(parse("<title> </title>").title == "")
assert(parse("<title> \n\t \f \r </title>").title == "")
assert(parse("").title == "")
do
local document = assert(parse("<title>Initial Title</title>"))
assert(document.title == "Initial Title")
local newTitle = "\t \r\n\r\n Setter Test \n\n"
document.title = newTitle
assert(document.titleElement.childNodes[1].data == newTitle)
assert(document.title == "Setter Test")
end
| Add some test coverage for Document.setters:title() | Add some test coverage for Document.setters:title()
| Lua | apache-2.0 | craigbarnes/lua-gumbo,craigbarnes/lua-gumbo,craigbarnes/lua-gumbo |
3d12bdcec313fc9a041d7c86880a85bb21882e42 | xc/priority_auths.lua | xc/priority_auths.lua | local redis_pool = require 'lib/redis_pool'
local AUTH_REQUESTS_CHANNEL = 'xc_channel_auth_requests'
local AUTH_RESPONSES_CHANNEL_PREFIX = 'xc_channel_auth_response:'
local _M = { }
local function request_msg(service_id, user_key, metric)
return service_id..':'..user_key..':'..metric
end
local function auth_responses_channel(service_id, user_key, metric)
return AUTH_RESPONSES_CHANNEL_PREFIX..service_id..':'..user_key..':'..metric
end
local function auth_from_msg(msg)
local auth, reason
if msg:sub(1, 1) == '0' then
auth = false
if msg:len() >= 3 then
reason = msg:sub(3, -1)
end
elseif msg:sub(1, 1) == '1' then
auth = true
end
return auth, reason
end
-- @return true if the authorization could be retrieved, false otherwise
-- @return true if authorized, false if denied, nil if unknown
-- @return reason why the authorization is denied (optional, required only when denied)
function _M.authorize(service_id, user_key, metric)
local redis_pub, ok_pub = redis_pool.acquire()
if not ok_pub then
return false, nil
end
local redis_sub, ok_sub = redis_pool.acquire()
if not ok_sub then
redis_pool.release(redis_pub)
return false, nil
end
local res_pub = redis_pub:publish(AUTH_REQUESTS_CHANNEL,
request_msg(service_id, user_key, metric))
redis_pool.release(redis_pub)
if not res_pub then
redis_pool.release(redis_sub)
return false, nil
end
local res_sub = redis_sub:subscribe(
auth_responses_channel(service_id, user_key, metric))
if not res_sub then
redis_pool.release(redis_sub)
return false, nil
end
local channel_reply = redis_sub:read_reply()
if not channel_reply then
return false, nil
end
local auth_msg = channel_reply[3] -- the value returned is in pos 3
redis_pool.release(redis_sub)
if not auth_msg then
return false, nil
end
local auth, reason = auth_from_msg(auth_msg)
return true, auth, reason
end
return _M
| Add module to get prioritary auths using Redis pubsub | Add module to get prioritary auths using Redis pubsub
| Lua | apache-2.0 | 3scale/apicast-xc | |
b5e73d7ce08cd022d879274d5d87738abb6053f8 | src/conf.lua | src/conf.lua | function love.conf(t)
t.title = "Journey to the Center of Hawkthorne v0.0.52"
t.author = "Kyle Conroy"
t.version = "0.8.0"
t.identity = "hawkthorne"
t.screen.width = 912
t.screen.height = 528
t.screen.fullscreen = false
t.console = false
t.modules.physics = false
t.modules.joystick = false
t.release = false
end
| function love.conf(t)
t.title = "Journey to the Center of Hawkthorne v0.0.53"
t.author = "Kyle Conroy"
t.version = "0.8.0"
t.identity = "hawkthorne"
t.screen.width = 912
t.screen.height = 528
t.screen.fullscreen = false
t.console = false
t.modules.physics = false
t.modules.joystick = false
t.release = false
end
| Bump release version to v0.0.53 | Bump release version to v0.0.53
| Lua | mit | hawkthorne/hawkthorne-server-lua,hawkthorne/hawkthorne-client-lua,hawkthorne/hawkthorne-server-lua,hawkthorne/hawkthorne-client-lua |
b732e726bb97a2fc54d49c9477b8254f4dbce12e | tests/test-process.lua | tests/test-process.lua | require('helper')
local spawn = require('childprocess').spawn
local os = require('os')
local environmentTestResult = false
function test()
local options = {
env = { TEST1 = 1 }
}
local child
if os.type() == 'win32' then
child = spawn('cmd.exe', {'/C', 'set'}, options)
else
child = spawn('bash', {'-c', 'set'}, options)
end
child.stdout:on('data', function(chunk)
print(chunk)
if chunk:find('TEST1=1') then
environmentTestResult = true
end
end)
end
test()
assert(process.pid ~= nil)
process:on('exit', function()
assert(environmentTestResult == true)
end)
| require('helper')
local spawn = require('childprocess').spawn
local os = require('os')
local environmentTestResult = false
function test()
local options = {
env = { TEST1 = 1 }
}
local child
if os.type() == 'win32' then
child = spawn('cmd.exe', {'/C', 'set'}, options)
else
child = spawn('env', {}, options)
end
child.stdout:on('data', function(chunk)
print(chunk)
if chunk:find('TEST1=1') then
environmentTestResult = true
end
end)
end
test()
assert(process.pid ~= nil)
process:on('exit', function()
assert(environmentTestResult == true)
end)
| Use `env` for clean env reading | fix(tests): Use `env` for clean env reading
| Lua | apache-2.0 | GabrielNicolasAvellaneda/luvit-upstream,rjeli/luvit,DBarney/luvit,kaustavha/luvit,DBarney/luvit,boundary/luvit,boundary/luvit,rjeli/luvit,sousoux/luvit,GabrielNicolasAvellaneda/luvit-upstream,kaustavha/luvit,DBarney/luvit,GabrielNicolasAvellaneda/luvit-upstream,sousoux/luvit,luvit/luvit,zhaozg/luvit,sousoux/luvit,sousoux/luvit,kaustavha/luvit,DBarney/luvit,sousoux/luvit,rjeli/luvit,luvit/luvit,boundary/luvit,boundary/luvit,boundary/luvit,bsn069/luvit,bsn069/luvit,rjeli/luvit,sousoux/luvit,GabrielNicolasAvellaneda/luvit-upstream,bsn069/luvit,boundary/luvit,zhaozg/luvit |
76c7b8c836ac272855479df134d3f388914ecb25 | gateway/libexec/boot.lua | gateway/libexec/boot.lua | package.path = package.path .. ";./src/?.lua;"
require('apicast.loader')
local configuration = require 'apicast.configuration_loader'
local config = configuration.boot()
ngx.say(config)
| -- Clean warning on openresty 1.15.8.1, where some global variables are set,
-- and a warning message is show during startup outside apicast packages.
-- Code related: https://github.com/openresty/lua-nginx-module/blob/61e4d0aac8974b8fad1b5b93d0d3d694d257d328/src/ngx_http_lua_util.c#L795-L839
(getmetatable(_G) or {}).__newindex = nil
package.path = package.path .. ";./src/?.lua;"
require('apicast.loader')
local configuration = require 'apicast.configuration_loader'
local config = configuration.boot()
ngx.say(config)
| Reset _G table to avoid invalid warning message | Reset _G table to avoid invalid warning message
Clean warning on openresty 1.15.8.1, where some global variables are
set, and a warning message is show during startup outside apicast
packages.
Code related: https://github.com/openresty/lua-nginx-module/blob/61e4d0aac8974b8fad1b5b93d0d3d694d257d328/src/ngx_http_lua_util.c#L795-L839
Signed-off-by: Eloy Coto <2a8acc28452926ceac4d9db555411743254cf5f9@gmail.com>
| Lua | mit | 3scale/apicast,3scale/apicast,3scale/apicast,3scale/apicast,3scale/docker-gateway,3scale/docker-gateway |
2b36b3cf6bd015c5ee030c1da4b496ca30de0272 | main.lua | main.lua | require('luvi').bundle.register("luvit-require", "modules/require.lua");
local uv = require('uv')
local require = require('luvit-require')()("bundle:main.lua")
_G.p = require('pretty-print').prettyPrint
local version = require('./package').version
coroutine.wrap(function ()
local log = require('./lib/log')
local success, err = xpcall(function ()
log("lit version", version)
args[1] = args[1] or "help"
log("command", table.concat(args, " "), "highlight")
require("./commands/" .. args[1] .. ".lua")
end, debug.traceback)
if success then
log("done", "success", "success")
print()
os.exit(0)
else
log("fail", err, "failure")
print()
os.exit(-1)
end
end)()
uv.run()
| require('luvi').bundle.register("luvit-require", "modules/require.lua");
local uv = require('uv')
local require = require('luvit-require')()("bundle:main.lua")
_G.p = require('pretty-print').prettyPrint
local version = require('./package').version
coroutine.wrap(function ()
local log = require('./lib/log')
local success, err = xpcall(function ()
log("lit version", version)
args[1] = args[1] or "help"
if args[1] == "version" then os.exit(0) end
log("command", table.concat(args, " "), "highlight")
require("./commands/" .. args[1] .. ".lua")
end, debug.traceback)
if success then
log("done", "success", "success")
print()
os.exit(0)
else
log("fail", err, "failure")
print()
os.exit(-1)
end
end)()
uv.run()
| Add lit version special command | Add lit version special command
| Lua | apache-2.0 | james2doyle/lit,kaustavha/lit,1yvT0s/lit,kidaa/lit,luvit/lit,squeek502/lit,DBarney/lit,lduboeuf/lit,zhaozg/lit |
4f7a69f9bf1fb233e5bc98c1db3e45de2d22c0ff | hammerspoon/hyper.lua | hammerspoon/hyper.lua | local status, hyperModeAppMappings = pcall(require, 'keyboard.hyper-apps')
if not status then
hyperModeAppMappings = require('keyboard.hyper-apps-defaults')
end
for i, mapping in ipairs(hyperModeAppMappings) do
hs.hotkey.bind({'shift', 'ctrl', 'alt', 'cmd'}, mapping[1], function()
hs.application.launchOrFocus(mapping[2])
end)
end
| local status, hyperModeAppMappings = pcall(require, 'keyboard.hyper-apps')
if not status then
hyperModeAppMappings = require('keyboard.hyper-apps-defaults')
end
for i, mapping in ipairs(hyperModeAppMappings) do
hs.hotkey.bind({'shift', 'ctrl', 'alt', 'cmd'}, mapping[1], function()
local appName = mapping[2]
local app = hs.application.get(appName)
if app then
app:activate()
else
hs.application.launchOrFocus(appName)
end
end)
end
| Fix "launchOrFocus" behavior for Atom | Fix "launchOrFocus" behavior for Atom
Some time in the last few weeks, something seems to have changed such
that Hyper+E always opens a *new* Atom instance, even when there's
already an exising Atom instance running. I would expect
hs.application.launchOrFocus to focus the currently-running Atom
instance, but that's not happening for some reason. This change seems to
be a successful workaround for this issue.
| Lua | mit | jasonrudolph/keyboard,jasonrudolph/keyboard |
ebca5c5acd6f176287b0f3e0ec9076f7b41f64e3 | usr/vendor/genivi/pkg/audio-manager.lua | usr/vendor/genivi/pkg/audio-manager.lua | return {
source = {
type = 'git',
location = 'https://github.com/GENIVI/AudioManager.git',
branch = '7.5',
ignore_dirty = true
},
patches = {
{ 'audio-manager-pass-all-LDFLAGS-of-the-found-CommonAPI-to-the-build', 1 }
},
build = {
type = 'CMake',
options = {
'-DWITH_TESTS=OFF',
'-DWITH_DOCUMENTATION=OFF',
'-DWITH_DLT=OFF',
'-DWITH_TELNET=OFF',
'-DWITH_SYSTEMD_WATCHDOG=OFF',
'-DGLIB_DBUS_TYPES_TOLERANT=ON',
'-DWITH_CAPI_WRAPPER=ON',
'-DWITH_DBUS_WRAPPER=OFF',
'-DWITH_SHARED_UTILITIES=ON',
'-DWITH_SHARED_CORE=ON',
}
},
requires = {
'capicxx-core-runtime'
}
}
| return {
source = {
type = 'git',
location = 'https://github.com/GENIVI/AudioManager.git',
branch = '7.5',
ignore_dirty = true
},
patches = {
{ 'audio-manager-pass-all-LDFLAGS-to-linker-when-building-wrappers', 1 }
},
build = {
type = 'CMake',
options = {
'-DWITH_TESTS=OFF',
'-DWITH_DOCUMENTATION=OFF',
'-DWITH_DLT=OFF',
'-DWITH_TELNET=OFF',
'-DWITH_SYSTEMD_WATCHDOG=OFF',
'-DGLIB_DBUS_TYPES_TOLERANT=ON',
'-DWITH_CAPI_WRAPPER=ON',
'-DWITH_DBUS_WRAPPER=ON',
'-DWITH_SHARED_UTILITIES=ON',
'-DWITH_SHARED_CORE=ON',
}
},
requires = {
'capicxx-core-runtime'
}
}
| Enable build of DBus wrapper for AudioManager | Enable build of DBus wrapper for AudioManager
| Lua | mit | bazurbat/jagen |
4fd2acc4238cecc6a4ffc8fa27ca68d55726c1ba | test/simple/test-tcp.lua | test/simple/test-tcp.lua | local TCP = require('tcp')
local PORT = 8080
local server = TCP.create_server("127.0.0.1", PORT, function (client)
client:on("data", function (chunk)
p('server:client:on("data")', chunk)
assert(chunk == "ping")
client:write("pong", function (err)
p("server:client:write")
assert(err == nil)
client:close()
end)
end)
end)
server:on("error", function (err)
p('server:on("error")')
assert(false)
end)
local client = TCP.new()
client:connect("127.0.0.1", PORT)
client:on("complete", function ()
p('client:on("complete")')
client:read_start()
client:write("ping", function (err)
p("client:write")
assert(err == nil)
client:on("data", function (data)
p('client:on("data")', data)
assert(data == "pong")
client:close()
server:close()
-- `server:close()` is needed only in this test case, to ensure that
-- process exits after it's done.
end)
end)
end)
client:on("error", function (err)
p('client:on("error")', err)
assert(false)
end)
| Add simple test for TCP server and client | Add simple test for TCP server and client
Client sends `'ping'`, server responds with `'pong'`
| Lua | apache-2.0 | AndrewTsao/luvit,boundary/luvit,kaustavha/luvit,DBarney/luvit,sousoux/luvit,luvit/luvit,connectFree/lev,bsn069/luvit,rjeli/luvit,boundary/luvit,AndrewTsao/luvit,sousoux/luvit,sousoux/luvit,kaustavha/luvit,GabrielNicolasAvellaneda/luvit-upstream,sousoux/luvit,zhaozg/luvit,DBarney/luvit,kaustavha/luvit,brimworks/luvit,GabrielNicolasAvellaneda/luvit-upstream,bsn069/luvit,GabrielNicolasAvellaneda/luvit-upstream,AndrewTsao/luvit,boundary/luvit,DBarney/luvit,GabrielNicolasAvellaneda/luvit-upstream,DBarney/luvit,rjeli/luvit,connectFree/lev,zhaozg/luvit,sousoux/luvit,sousoux/luvit,boundary/luvit,boundary/luvit,rjeli/luvit,bsn069/luvit,boundary/luvit,rjeli/luvit,luvit/luvit | |
121c1424cf59a32c95160ebaf8171ecc268700a1 | src/output/junit.lua | src/output/junit.lua | --[[
--jUnit output formatter for busted
--ReMake Electric ehf 2012
--Considered to be released under your choice of Apache, 2 clause BSD, ISC or MIT licenses
--]]
--
local output = function()
local function make_test_xml(index, blob)
local xx = string.format([[<testcase classname="%s" name="%s">]],
blob.info.short_src:gsub(".lua", ""), blob["description"])
local failtext = ""
if (blob["type"] == "failure") then
failtext = "\n" .. string.format([[
<failure type="busted.generalfailure">%s</failure>
]], blob.err)
end
return (xx .. failtext .. "</testcase>")
end
return {
header = function(context_tree)
return [[<?xml version="1.0" encoding="UTF-8" ?>]]
end,
footer = function(context_tree)
-- current busted is busted ;)
--return("</testsuite>")
end,
formatted_status = function(status, options, ms)
io.write([[<testsuite name="busted_luatests">]], "\n")
for i,v in ipairs(status) do
local test_xml = make_test_xml(i, v)
io.write(test_xml, "\n")
end
io.write("</testsuite>", "\n")
return ("")
end,
currently_executing = function(test_status, options)
return ("")
end
}
end
return output
| --[[
--jUnit output formatter for busted
--ReMake Electric ehf 2012
--Considered to be released under your choice of Apache, 2 clause BSD, ISC or MIT licenses
--]]
--
local output = function()
local function make_test_xml(index, blob)
local xx = string.format([[<testcase classname="%s" name="%s">]],
blob.info.short_src:gsub(".lua", ""), blob["description"])
local failtext = ""
if (blob["type"] == "failure") then
failtext = "\n" .. string.format([[
<failure type="busted.generalfailure">%s</failure>
]], blob.err)
end
return (xx .. failtext .. "</testcase>")
end
return {
header = function(context_tree)
return [[<?xml version="1.0" encoding="UTF-8" ?>]]
end,
footer = function(context_tree)
-- current busted is busted ;)
--return("</testsuite>")
end,
formatted_status = function(status, options, ms)
io.write([[<testsuite name="busted_luatests">]], "\n")
for i,v in ipairs(status) do
local test_xml = make_test_xml(i, v)
io.write(test_xml, "\n")
end
io.write("</testsuite>", "\n")
return ("")
end,
currently_executing = function(test_status, options)
return ("")
end
}
end
return output
| Switch to 2 space tabs as requested upstream | Switch to 2 space tabs as requested upstream
| Lua | mit | DorianGray/busted,istr/busted,o-lim/busted,Olivine-Labs/busted,ryanplusplus/busted,xyliuke/busted,leafo/busted,sobrinho/busted,nehz/busted,mpeterv/busted,azukiapp/busted |
165c74eba6c8cc87e4e916c7d5ee25b4345afe01 | dataset/process_ptb.lua | dataset/process_ptb.lua | local Processer = require 'dataset.processer'
local cmd = torch.CmdLine()
cmd:option('-batch_size', 32, 'batch size')
local opt = cmd:parse(arg)
local directory = 'dataset/ptb/'
local train_file = directory .. 'train.txt'
local test_file = directory .. 'test.txt'
local valid_file = directory .. 'valid.txt'
local tensor_train_file = directory .. 'train.t7'
local tensor_test_file = directory .. 'test.t7'
local tensor_valid_file = directory .. 'valid.t7'
local vocab_file = directory .. 'vocab.t7'
local proc = Processer()
proc:process(train_file, tensor_train_file, vocab_file)
proc:process_with_vocab(valid_file, vocab_file, tensor_valid_file)
proc:process_with_vocab(test_file, vocab_file, tensor_test_file)
proc:processAndBatch(tensor_valid_file, tensor_valid_file, opt.batch_size)
proc:processAndBatch(tensor_train_file, tensor_train_file, opt.batch_size)
proc:processAndBatch(tensor_test_file, tensor_test_file, opt.batch_size)
| local Processer = require 'dataset.processer'
local cmd = torch.CmdLine()
cmd:option('-batch_size', 64, 'batch size')
local opt = cmd:parse(arg)
local directory = 'dataset/ptb/'
local train_file = directory .. 'train.txt'
local test_file = directory .. 'test.txt'
local valid_file = directory .. 'valid.txt'
local tensor_train_file = directory .. 'train.t7'
local tensor_test_file = directory .. 'test.t7'
local tensor_valid_file = directory .. 'valid.t7'
local vocab_file = directory .. 'vocab.t7'
local proc = Processer()
proc:process(train_file, tensor_train_file, vocab_file)
proc:process_with_vocab(valid_file, vocab_file, tensor_valid_file)
proc:process_with_vocab(test_file, vocab_file, tensor_test_file)
proc:processAndBatch(tensor_valid_file, tensor_valid_file, opt.batch_size)
proc:processAndBatch(tensor_train_file, tensor_train_file, opt.batch_size)
proc:processAndBatch(tensor_test_file, tensor_test_file, opt.batch_size)
| Fix bug on batch size | Fix bug on batch size
| Lua | mit | ctallec/bigart |
efc93c9a4eb1de59a925dbfb4ce6740bb09f2543 | nesms.lua | nesms.lua | msg = "";
function write_file (filename, text)
output = io.open(filename, "w");
io.output(output);
io.write(text);
io.close(output);
end;
function read_file (filename)
input = io.open(filename, "r");
io.input(input);
input_content = io.read();
io.close(input);
return input_content;
end;
while (true) do
input_content = read_file("input.txt");
if(input_content ~= nil) then
msg = input_content
gui.text(0, 50, msg);
end;
emu.frameadvance();
end;
| prev = "";
msg = "";
function write_file (filename, text)
output = io.open(filename, "w");
io.output(output);
io.write(text);
io.close(output);
end;
function read_file (filename)
input = io.open(filename, "r");
io.input(input);
input_content = io.read();
io.close(input);
return input_content;
end;
function handle_input ()
local address = tonumber(read_file("address.txt"), 16);
local value = tonumber(read_file("value.txt"), 16);
if(address ~= "None" and address ~= nil and value ~= nil) then
memory.writebyte(address, value);
end;
end;
while (true) do
input_content = read_file("input.txt");
if(input_content ~= nil) then
msg = input_content
gui.text(0, 50, msg);
end;
if(msg ~= prev) then
prev = msg;
handle_input()
end;
emu.frameadvance();
end;
| Add infrastructure for arbitrary code entry via sms | Add infrastructure for arbitrary code entry via sms
| Lua | mit | sagnew/NESMS,sagnew/NESMS |
edfb0205cc193f6b02a9c09b52c9b6066f6c7927 | packages/debug/init.lua | packages/debug/init.lua | local function registerCommands (class)
class:registerCommand("debug", function (options, _)
for k, v in pairs(options) do
SILE.debugFlags[k] = SU.boolean(v, true)
end
end)
class:registerCommand("disable-pushback", function (_, _)
SILE.typesetter.pushBack = function() end
end)
end
return {
registerCommands = registerCommands,
documentation = [[
\begin{document}
This package provides two commands: \autodoc:command{\debug}, which turns
on and off SILE’s internal debugging flags (similar to using \code{--debug=...}
on the command line); and \autodoc:command{\disable-pushback} which is used
by SILE’s developers to turn off the typesetter’s pushback routine, because we
don’t really trust it very much.
\end{document}
]]
}
| local base = require("packages.base")
local package = pl.class(base)
package._name = "debug"
function package:registerCommands ()
self.class:registerCommand("debug", function (options, _)
for k, v in pairs(options) do
SILE.debugFlags[k] = SU.boolean(v, true)
end
end)
self.class:registerCommand("disable-pushback", function (_, _)
SILE.typesetter.pushBack = function() end
end)
end
package.documentation = [[
\begin{document}
This package provides two commands: \autodoc:command{\debug}, which turns on and off SILE’s internal debugging flags (similar to using \code{--debug=...} on the command line); and \autodoc:command{\disable-pushback} which is used by SILE’s developers to turn off the typesetter’s pushback routine, because we don’t really trust it very much.
\end{document}
]]
return package
| Update debug package with new interface | refactor(packages): Update debug package with new interface
| Lua | mit | alerque/sile,alerque/sile,alerque/sile,alerque/sile |
6a99becfb6ce392c0b888544852a915316054742 | samples/complex_platforms/premake4.lua | samples/complex_platforms/premake4.lua | solution "MySolution"
configurations {
"Debug",
"Deployment",
"Profiling",
"Release"
}
platforms {
"Win32 Static SCRT",
"Win32 Static DCRT",
"Win32 DLL",
"Win64 Static SCRT",
"Win64 Static DCRT",
"Win64 DLL",
"PS3 PPU GCC",
"PS3 PPU SN",
"PS3 SPU GCC",
"PS3 SPU SN"
}
--
-- Map the platforms to their underlying architectures.
--
configuration { "Win32 *" }
architecture "x32"
os "windows"
configuration { "Win64 *" }
architecture "x64"
os "windows"
configuration { "* PPU *" }
architecture "ps3ppu"
configuration { "* SPU *" }
architecture "ps3spu"
configuration { "* GCC" }
compiler "gcc"
configuration { "* SN" }
compiler "sn"
| Add sample script for new platform API | Add sample script for new platform API
| Lua | bsd-3-clause | annulen/premake-dev-rgeary,annulen/premake-dev-rgeary,annulen/premake-dev-rgeary | |
954d616ec5639447f200a781d1cc1c1eb21e4993 | lib/pkg/android-standalone-arm-r16b.lua | lib/pkg/android-standalone-arm-r16b.lua | return {
build = {
type = 'android-standalone-toolchain',
toolchain = 'android-ndk-r16b',
arch = 'arm',
system = 'arm-linux-androideabi'
},
export = {
cmake_options = {
'-DCMAKE_TOOLCHAIN_FILE=${toolchain_source_dir}/build/cmake/android.toolchain.cmake',
'-DANDROID_ABI=armeabi-v7a',
'-DANDROID_PLATFORM=android-23'
}
}
}
| return {
build = {
type = 'android-standalone-toolchain',
toolchain = 'android-ndk-r16b',
arch = 'arm',
system = 'arm-linux-androideabi',
cc = 'clang',
cxx = 'clang++',
},
export = {
cmake_options = {
'-DCMAKE_TOOLCHAIN_FILE=${toolchain_source_dir}/build/cmake/android.toolchain.cmake',
'-DANDROID_ABI=armeabi-v7a',
'-DANDROID_PLATFORM=android-23'
}
}
}
| Set default cc and cxx for android-standalone-arm to clang | Set default cc and cxx for android-standalone-arm to clang
| Lua | mit | bazurbat/jagen |
382a6a5d5c65cf02bf3102b6b0046cde8e6e7b89 | spec/functional_spec.lua | spec/functional_spec.lua | package.path = package.path .. ";spec/?.lua"
ngx = require("fake_ngx")
local cassandra = require("cassandra")
describe("cassandra", function()
before_each(function()
cql = cassandra.new()
cql:set_timeout(1000)
ok, err = cql:connect("127.0.0.1", 9042)
end)
it("should be possible to connect", function()
assert.truthy(ok)
end)
it("should be queryble", function()
local rows, err = cql:execute("select cql_version, native_protocol_version, release_version from system.local");
assert.same(1, #rows)
assert.same(rows[1].native_protocol_version, "2")
end)
end) | package.path = package.path .. ";spec/?.lua"
ngx = require("fake_ngx")
local cassandra = require("cassandra")
describe("cassandra", function()
before_each(function()
cql = cassandra.new()
cql:set_timeout(1000)
ok, err = cql:connect("127.0.0.1", 9042)
end)
it("should be possible to connect", function()
assert.truthy(ok)
end)
it("should be queryble", function()
local rows, err = cql:execute("select cql_version, native_protocol_version, release_version from system.local");
assert.same(1, #rows)
assert.same(rows[1].native_protocol_version, "2")
end)
end)
| Add newline at end of file | Add newline at end of file
| Lua | mit | kidaa/lua-resty-cassandra,jbochi/lua-resty-cassandra,thibaultCha/lua-resty-cassandra,Mashape/lua-resty-cassandra |
cbea9c7432f9cdd12797ef32b1316f7a534b280a | spec/time_spec.lua | spec/time_spec.lua | local system = require 'system.core'
describe('Test time functions', function()
it('gettime returns current time', function()
assert.is_near(os.time(), system.gettime(), 1.0)
end)
it('sleep will wait for specified amount of time', function()
local starttime = system.gettime()
system.sleep(0.5)
assert.is_near(0.5, system.gettime() - starttime, 0.1)
end)
end)
| local system = require 'system.core'
describe('Test time functions', function()
it('gettime returns current time', function()
local starttime = system.gettime()
local expected = os.time()
local endtime = system.gettime()
local delta = endtime - starttime
local avg = starttime + delta/2
assert.is_true(expected >= math.floor(starttime))
assert.is_true(expected <= math.ceil(endtime))
assert.is_near(expected, avg, 1 + delta)
end)
it('sleep will wait for specified amount of time', function()
local starttime = system.gettime()
system.sleep(0.5)
assert.is_near(0.5, system.gettime() - starttime, 0.1)
end)
end)
| Make test for `gettime` more robust | Make test for `gettime` more robust
| Lua | mit | o-lim/luasystem,o-lim/luasystem |
edc94c70e7ac3f8b40d97b92ac7ebd26c3722f16 | samples/bob/index.lua | samples/bob/index.lua | -- From the example for https://github.com/xyproto/permissions2
print("Has user bob: " .. tostring(HasUser("bob")))
print("Logged in on server: " .. tostring(IsLoggedIn("bob")))
print("Is confirmed: " .. tostring(IsConfirmed("bob")))
print("Username stored in cookie (or blank): " .. Username())
print("Current user is logged in, has a valid cookie and *user rights*: " .. tostring(UserRights()))
print("Current user is logged in, has a valid cookie and *admin rights*: " .. tostring(AdminRights()))
print("Try: /register, /confirm, /remove, /login, /logout, /clear, /data, /makeadmin and /admin")
| -- From the example for https://github.com/xyproto/permissions2
print("Has user bob: " .. tostring(HasUser("bob")))
print("Logged in on server: " .. tostring(IsLoggedIn("bob")))
print("Is confirmed: " .. tostring(IsConfirmed("bob")))
print("Username stored in cookie (or blank): " .. Username())
print("Current user is logged in, has a valid cookie and *user rights*: " .. tostring(UserRights()))
print("Current user is logged in, has a valid cookie and *admin rights*: " .. tostring(AdminRights()))
print("Try: /register, /confirm, /remove, /login, /logout, /clear, /data, /makeadmin and /admin")
if urlpath() ~= "/" then
print[[NOTE: The current URL path is not "/". For the default URL permissions to work, Algernon must either be run from this direcotry, or the URL prefixes must be configured correctly]]
end
| Add notification when running the permissions sample from an unsupported directory | Add notification when running the permissions sample from an unsupported
directory
| Lua | bsd-3-clause | xyproto/algernon,xyproto/algernon,xyproto/algernon,xyproto/algernon |
768d9c0cb72194c49f59ca782ff4c48826d35e2a | package.lua | package.lua | return {
name = "luvit/lit",
version = "2.3.0",
homepage = "https://github.com/luvit/lit",
description = "The Luvit Invention Toolkit is a luvi app that handles dependencies and luvi builds.",
tags = {"lit", "meta"},
license = "Apache 2",
author = { name = "Tim Caswell" },
luvi = {
version = "2.5.0",
flavor = "regular",
},
dependencies = {
"luvit/require@1.2.2",
"luvit/pretty-print@1.0.7",
"luvit/http-codec@1.0.0",
"luvit/json@2.5.0",
"creationix/coro-fs@1.3.0",
"creationix/coro-net@1.1.1",
"creationix/coro-http@1.2.1",
"creationix/coro-tls@1.4.0",
"creationix/coro-wrapper@1.0.0",
"creationix/coro-spawn@0.2.1",
"creationix/coro-split@0.1.1",
"creationix/semver@1.0.4",
"creationix/git@2.0.3",
"creationix/prompt@1.0.3",
"creationix/ssh-rsa@1.0.0",
"creationix/websocket-codec@1.0.7",
},
files = {
"commands/README",
"**.lua",
"!test*"
}
}
| return {
name = "luvit/lit",
version = "2.3.1",
homepage = "https://github.com/luvit/lit",
description = "The Luvit Invention Toolkit is a luvi app that handles dependencies and luvi builds.",
tags = {"lit", "meta"},
license = "Apache 2",
author = { name = "Tim Caswell" },
luvi = {
version = "2.5.1",
flavor = "regular",
},
dependencies = {
"luvit/require@1.2.2",
"luvit/pretty-print@1.0.7",
"luvit/http-codec@1.0.0",
"luvit/json@2.5.0",
"creationix/coro-fs@1.3.0",
"creationix/coro-net@1.1.1",
"creationix/coro-http@1.2.1",
"creationix/coro-tls@1.4.0",
"creationix/coro-wrapper@1.0.0",
"creationix/coro-spawn@0.2.1",
"creationix/coro-split@0.1.1",
"creationix/semver@1.0.4",
"creationix/git@2.0.3",
"creationix/prompt@1.0.3",
"creationix/ssh-rsa@1.0.0",
"creationix/websocket-codec@1.0.7",
},
files = {
"commands/README",
"**.lua",
"!test*"
}
}
| Update luvi to get zip timestamp fix | Update luvi to get zip timestamp fix
| Lua | apache-2.0 | zhaozg/lit,luvit/lit,squeek502/lit,james2doyle/lit |
1572fba94f0ca77d5080642064e244c1fdf98381 | src/patch/ui/hooks/frontend/mainmenu/mainmenu_status.lua | src/patch/ui/hooks/frontend/mainmenu/mainmenu_status.lua | -- Copyright (c) 2015-2017 Lymia Alusyia <lymia@lymiahugs.com>
--
-- 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
-- furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in
-- all copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-- THE SOFTWARE.
pcall(function()
local versionString
if not _mpPatch then
versionString = Locale.Lookup("TXT_KEY_MPPATCH_UNKNOWN_FAILURE")
elseif not _mpPatch.loaded then
versionString = Locale.Lookup("TXT_KEY_MPPATCH_BINARY_NOT_PATCHED")
else
versionString = "MpPatch v".._mpPatch.versionString
end
Controls.VersionNumber:SetText(Controls.VersionNumber:GetText().." w/ "..versionString)
end) | -- Copyright (c) 2015-2017 Lymia Alusyia <lymia@lymiahugs.com>
--
-- 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
-- furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in
-- all copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-- THE SOFTWARE.
pcall(function()
local versionString
if not _mpPatch then
versionString = Locale.Lookup("TXT_KEY_MPPATCH_UNKNOWN_FAILURE")
elseif not _mpPatch.loaded then
versionString = Locale.Lookup("TXT_KEY_MPPATCH_BINARY_NOT_PATCHED")
else
versionString = "MpPatch v".._mpPatch.versionString
end
Controls.VersionNumber:SetText(Controls.VersionNumber:GetText().." -- "..versionString)
end) | Revert mainmenu version seperator change. | Revert mainmenu version seperator change.
| Lua | mit | Lymia/MPPatch,Lymia/CivV_Mod2DLC,Lymia/MPPatch,Lymia/MultiverseModManager,Lymia/MultiverseModManager,Lymia/MPPatch,Lymia/MPPatch |
4005352c574e4cc7f3e5e15447d5eb2cc8315cb2 | .config/nvim/lua/config/lsp/settings/tsserver.lua | .config/nvim/lua/config/lsp/settings/tsserver.lua | return {
init_options = {
preferences = {
importModuleSpecifierPreference = "relative",
},
},
}
| return {
init_options = {
preferences = {
importModuleSpecifierPreference = "non-relative",
},
},
}
| Fix importModuleSpecifierPreference { relative => non-relative } | [nvim] Fix importModuleSpecifierPreference { relative => non-relative }
| Lua | mit | masa0x80/dotfiles,masa0x80/dotfiles,masa0x80/dotfiles,masa0x80/dotfiles |
60ed8717cb7928d7ed5dd865287c2269fdfe32f6 | modulefiles/Core/freesurfer/5.3.0.lua | modulefiles/Core/freesurfer/5.3.0.lua | help(
[[
This module loads Freesurfer 5.3.0 into the environment. Freesurfer is
an open source software suite for processing and analyzing (human) brain
MRI images.
]])
whatis("Loads the freesurfer application")
local version = "5.3.0"
local base = "/cvmfs/oasis.opensciencegrid.org/osg/modules/freesurfer/"..version
prepend_path("PATH", pathJoin(base, "bin"))
prepend_path("LD_LIBRARY_PATH", pathJoin(base, "lib"))
pushenv("FREESURFER_HOME", base)
pushenv("SUBJECTS_DIR", pathJoin(base, "subjects"))
pushenv("FUNCTIONALS_DIR", pathJoin(base, "sessions"))
family('freesurfer')
| help(
[[
This module loads Freesurfer 5.3.0 into the environment. Freesurfer is
an open source software suite for processing and analyzing (human) brain
MRI images.
]])
whatis("Loads the freesurfer application")
local version = "5.3.0"
local base = "/cvmfs/oasis.opensciencegrid.org/osg/modules/freesurfer/"..version
prepend_path("PATH", pathJoin(base, "bin"))
prepend_path("LD_LIBRARY_PATH", pathJoin(base, "lib"))
pushenv("FREESURFER_HOME", base)
pushenv("SUBJECTS_DIR", pathJoin(base, "subjects"))
pushenv("FUNCTIONALS_DIR", pathJoin(base, "sessions"))
pushenv("FSFAST_HOME", pathJoin(base, "fsfast"))
pushenv("MNI_DIR", pathJoin(base, "mni"))
family('freesurfer')
| Add MNI and FSFAST locations for freesurfer | Add MNI and FSFAST locations for freesurfer
| Lua | apache-2.0 | OSGConnect/modulefiles,OSGConnect/modulefiles,OSGConnect/modulefiles |
f35b3ebe5db707e8eace4f93cf90f4a83c76353b | backend/nginx/lua/project_access.lua | backend/nginx/lua/project_access.lua | local url = ngx.var.uri
local elements = url.split("/")
local project_index = -1
for k, v in pairs(elements) do
if v == "projects" then
project_index = k
end
end
if project_index == -1 then
ngx.exit(ngx.HTTP_BAD_REQUEST)
end
local apikey = get_apikey()
if apikey == nil then
ngx.log(ngx.WARN, "No APIKEY")
ngx.exit(ngx.HTTP_UNAUTHORIZED)
end
local res = ngx.location.capture("/authenticate_project/" .. elements[project_index],
{args = { apikey: apikey}})
if res.status ~= 200 then
ngx.log(ngx.WARN, "No access to project")
ngx.exit(ngx.HTTP_UNAUTHORIZED)
end
| local url = ngx.var.uri
local elements = url.split("/")
local project_index = -1
for k, v in pairs(elements) do
if v == "projects" then
project_index = k
end
end
if project_index == -1 then
ngx.exit(ngx.HTTP_BAD_REQUEST)
end
local apikey = get_apikey()
if apikey == nil then
ngx.log(ngx.WARN, "No APIKEY")
ngx.exit(ngx.HTTP_UNAUTHORIZED)
end
local res = ngx.location.capture("/authenticate_project/" .. elements[project_index+1],
{args = { apikey: apikey}})
if res.status ~= 200 then
ngx.log(ngx.WARN, "No access to project")
ngx.exit(ngx.HTTP_UNAUTHORIZED)
end
| Access correct spot in url for the project. | Access correct spot in url for the project.
| Lua | mit | materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org |
6ff98754b73ef9a5740dee7da3cf0f507e86e405 | src/lgix-Gtk-3_0.lua | src/lgix-Gtk-3_0.lua | ------------------------------------------------------------------------------
--
-- LGI Gtk3 override module.
--
-- Copyright (c) 2010 Pavel Holejsovsky
-- Licensed under the MIT license:
-- http://www.opensource.org/licenses/mit-license.php
--
------------------------------------------------------------------------------
local lgi = require 'lgi'
local Gtk = lgi.Gtk
-- Initialize GTK.
Gtk.init()
| Add Gtk override, for now only automatically initializes Gtk. | Add Gtk override, for now only automatically initializes Gtk.
| Lua | mit | psychon/lgi,pavouk/lgi,zevv/lgi | |
90922cc64f2d5b3ca4b02b7a168f6c39879d1a03 | extensions/audiodevice/init.lua | extensions/audiodevice/init.lua | --- === hs.audiodevice ===
---
--- Manipulate the system's audio devices.
---
--- This module is based primarily on code from the previous incarnation of Mjolnir by [Steven Degutis](https://github.com/sdegutis/).
local module = require("hs.audiodevice.internal")
-- private variables and methods -----------------------------------------
-- Public interface ------------------------------------------------------
--- hs.audiodevice.current() -> table
--- Function
--- Convenience function which returns a table with the following keys and values:
--- ~~~lua
--- {
--- name = defaultoutputdevice():name(),
--- uid = module.defaultoutputdevice():uid(),
--- muted = defaultoutputdevice():muted(),
--- volume = defaultoutputdevice():volume(),
--- device = defaultoutputdevice(),
--- }
--- ~~~
module.current = function()
return {
name = module.defaultoutputdevice():name(),
uid = module.defaultoutputdevice():uid(),
muted = module.defaultoutputdevice():muted(),
volume = module.defaultoutputdevice():volume(),
device = module.defaultoutputdevice(),
}
end
-- Return Module Object --------------------------------------------------
return module
| --- === hs.audiodevice ===
---
--- Manipulate the system's audio devices.
---
--- This module is based primarily on code from the previous incarnation of Mjolnir by [Steven Degutis](https://github.com/sdegutis/).
local module = require("hs.audiodevice.internal")
local fnutils = require("hs.fnutils")
-- private variables and methods -----------------------------------------
-- Public interface ------------------------------------------------------
--- hs.audiodevice.current() -> table
--- Function
--- Convenience function which returns a table with the following keys and values:
--- ~~~lua
--- {
--- name = defaultoutputdevice():name(),
--- uid = module.defaultoutputdevice():uid(),
--- muted = defaultoutputdevice():muted(),
--- volume = defaultoutputdevice():volume(),
--- device = defaultoutputdevice(),
--- }
--- ~~~
module.current = function()
return {
name = module.defaultoutputdevice():name(),
uid = module.defaultoutputdevice():uid(),
muted = module.defaultoutputdevice():muted(),
volume = module.defaultoutputdevice():volume(),
device = module.defaultoutputdevice(),
}
end
--- hs.audiodevice.findbyname(name) -> device or nil
--- Function
--- Convenience function which returns an audiodevice based on its name, or nil if it can't be found
module.findbyname = function(name)
return fnutils.find(module.alloutputdevices(), function(dev) return (dev:name() == name) end)
end
-- Return Module Object --------------------------------------------------
return module
| Add a helper function to hs.audiodevice to find devices by name | Add a helper function to hs.audiodevice to find devices by name
| Lua | mit | knl/hammerspoon,ocurr/hammerspoon,chrisjbray/hammerspoon,dopcn/hammerspoon,knl/hammerspoon,tmandry/hammerspoon,heptal/hammerspoon,CommandPost/CommandPost-App,tmandry/hammerspoon,dopcn/hammerspoon,Stimim/hammerspoon,latenitefilms/hammerspoon,ocurr/hammerspoon,knu/hammerspoon,Habbie/hammerspoon,joehanchoi/hammerspoon,bradparks/hammerspoon,CommandPost/CommandPost-App,zzamboni/hammerspoon,wsmith323/hammerspoon,Stimim/hammerspoon,zzamboni/hammerspoon,wsmith323/hammerspoon,chrisjbray/hammerspoon,CommandPost/CommandPost-App,wvierber/hammerspoon,Habbie/hammerspoon,lowne/hammerspoon,junkblocker/hammerspoon,knl/hammerspoon,Hammerspoon/hammerspoon,hypebeast/hammerspoon,cmsj/hammerspoon,peterhajas/hammerspoon,nkgm/hammerspoon,hypebeast/hammerspoon,dopcn/hammerspoon,asmagill/hammerspoon,zzamboni/hammerspoon,peterhajas/hammerspoon,knu/hammerspoon,emoses/hammerspoon,emoses/hammerspoon,TimVonsee/hammerspoon,TimVonsee/hammerspoon,latenitefilms/hammerspoon,hypebeast/hammerspoon,CommandPost/CommandPost-App,chrisjbray/hammerspoon,wsmith323/hammerspoon,lowne/hammerspoon,latenitefilms/hammerspoon,chrisjbray/hammerspoon,junkblocker/hammerspoon,heptal/hammerspoon,emoses/hammerspoon,joehanchoi/hammerspoon,Hammerspoon/hammerspoon,ocurr/hammerspoon,knl/hammerspoon,chrisjbray/hammerspoon,CommandPost/CommandPost-App,asmagill/hammerspoon,lowne/hammerspoon,heptal/hammerspoon,lowne/hammerspoon,TimVonsee/hammerspoon,Habbie/hammerspoon,junkblocker/hammerspoon,latenitefilms/hammerspoon,joehanchoi/hammerspoon,Habbie/hammerspoon,trishume/hammerspoon,asmagill/hammerspoon,Hammerspoon/hammerspoon,bradparks/hammerspoon,tmandry/hammerspoon,wvierber/hammerspoon,wsmith323/hammerspoon,Habbie/hammerspoon,zzamboni/hammerspoon,bradparks/hammerspoon,nkgm/hammerspoon,heptal/hammerspoon,trishume/hammerspoon,knu/hammerspoon,asmagill/hammerspoon,lowne/hammerspoon,chrisjbray/hammerspoon,CommandPost/CommandPost-App,cmsj/hammerspoon,dopcn/hammerspoon,cmsj/hammerspoon,hypebeast/hammerspoon,Habbie/hammerspoon,kkamdooong/hammerspoon,knu/hammerspoon,heptal/hammerspoon,kkamdooong/hammerspoon,Hammerspoon/hammerspoon,ocurr/hammerspoon,Stimim/hammerspoon,zzamboni/hammerspoon,wsmith323/hammerspoon,emoses/hammerspoon,ocurr/hammerspoon,asmagill/hammerspoon,cmsj/hammerspoon,knu/hammerspoon,bradparks/hammerspoon,wvierber/hammerspoon,nkgm/hammerspoon,emoses/hammerspoon,latenitefilms/hammerspoon,knu/hammerspoon,peterhajas/hammerspoon,TimVonsee/hammerspoon,trishume/hammerspoon,Hammerspoon/hammerspoon,nkgm/hammerspoon,Hammerspoon/hammerspoon,wvierber/hammerspoon,wvierber/hammerspoon,Stimim/hammerspoon,joehanchoi/hammerspoon,zzamboni/hammerspoon,cmsj/hammerspoon,junkblocker/hammerspoon,cmsj/hammerspoon,hypebeast/hammerspoon,joehanchoi/hammerspoon,latenitefilms/hammerspoon,dopcn/hammerspoon,bradparks/hammerspoon,TimVonsee/hammerspoon,asmagill/hammerspoon,junkblocker/hammerspoon,kkamdooong/hammerspoon,nkgm/hammerspoon,kkamdooong/hammerspoon,peterhajas/hammerspoon,peterhajas/hammerspoon,kkamdooong/hammerspoon,knl/hammerspoon,Stimim/hammerspoon |
3aa648f9db6291c5143b4514b47e029a0035b872 | apicast/src/policy/cors.lua | apicast/src/policy/cors.lua | local policy = require('policy')
local _M = policy.new('CORS Policy')
local function set_cors_headers()
local origin = ngx.var.http_origin
if not origin then return end
ngx.header['Access-Control-Allow-Headers'] = ngx.var.http_access_control_request_headers
ngx.header['Access-Control-Allow-Methods'] = ngx.var.http_access_control_request_method
ngx.header['Access-Control-Allow-Origin'] = origin
ngx.header['Access-Control-Allow-Credentials'] = 'true'
end
local function cors_preflight_response()
set_cors_headers()
ngx.status = 204
ngx.exit(ngx.status)
end
local function is_cors_preflight()
return ngx.req.get_method() == 'OPTIONS' and
ngx.var.http_origin and
ngx.var.http_access_control_request_method
end
function _M.rewrite()
if is_cors_preflight() then
return cors_preflight_response()
end
end
function _M.header_filter()
set_cors_headers()
end
return _M
| Convert existing CORS module into a policy | Convert existing CORS module into a policy
The functionality is exactly the same.
| Lua | mit | 3scale/apicast,3scale/apicast,3scale/apicast,3scale/docker-gateway,3scale/docker-gateway,3scale/apicast | |
542bee95b7c1521c4ebb814444efa84255b314a5 | modulefiles/Core/freesurfer/5.3.0.lua | modulefiles/Core/freesurfer/5.3.0.lua | help(
[[
This module loads Freesurfer 5.3.0 into the environment. Freesurfer is
an open source software suite for processing and analyzing (human) brain
MRI images.
]])
whatis("Loads the freesurfer application")
local version = "5.3.0"
local base = "/cvmfs/oasis.opensciencegrid.org/osg/modules/freesurfer/"..version
prepend_path("PATH", pathJoin(base, "bin"))
prepend_path("LD_LIBRARY_PATH", pathJoin(base, "lib"))
pushenv("FREESURFER_HOME", base)
pushenv("SUBJECTS_DIR", pathJoin(base, "subjects"))
pushenv("FUNCTIONALS_DIR", pathJoin(base, "sessions"))
pushenv("FSFAST_HOME", pathJoin(base, "fsfast"))
pushenv("MNI_DIR", pathJoin(base, "mni"))
family('freesurfer')
| help(
[[
This module loads Freesurfer 5.3.0 into the environment. Freesurfer is
an open source software suite for processing and analyzing (human) brain
MRI images.
]])
whatis("Loads the freesurfer application")
local version = "5.3.0"
local base = "/cvmfs/oasis.opensciencegrid.org/osg/modules/freesurfer/"..version
prepend_path("PATH", pathJoin(base, "bin"))
prepend_path("LD_LIBRARY_PATH", pathJoin(base, "lib"))
pushenv("FREESURFER_HOME", base)
pushenv("SUBJECTS_DIR", pathJoin(base, "subjects"))
pushenv("FUNCTIONALS_DIR", pathJoin(base, "sessions"))
pushenv("FSFAST_HOME", pathJoin(base, "fsfast"))
pushenv("FMRI_ANALYSIS_DIR", pathJoin(base, "fsfast"))
pushenv("FSF_OUTPUT_FORMAT", "nii.gz")
pushenv("FSL_DIR", pathJoin(base, "fsl"))
pushenv("FSL_BIN", pathJoin(base, "fsl", "bin"))
pushenv("FSLOUTPUTTYPE", "NIFTI_GZ")
pushenv("MNI_DIR", pathJoin(base, "mni"))
pushenv("MINC_BIN_DIR", pathJoin(base, "mni", "bin"))
pushenv("MINC_LIB_DIR", pathJoin(base, "mni", "lib"))
pushenv("MNI_DATAPATH", pathJoin(base, "mni", "data"))
pushenv("MNI_PERL5LIB", pathJoin(base, "mni", "lib", "perl5", "5.8.5"))
prepend_path("PERL5LIB", pathJoin(base, "mni", "lib", "perl5", "5.8.5"))
pushenv("FIX_VERTEX_AREA", "1")
family('freesurfer')
| Add more vars needed for freesurfer | Add more vars needed for freesurfer
| Lua | apache-2.0 | OSGConnect/modulefiles,OSGConnect/modulefiles,OSGConnect/modulefiles |
ccd4a9039580f6a2cc752b187c190b026007175e | docs/lua-api/inventory.lua | docs/lua-api/inventory.lua | --- Provides inventory functions.
-- @module rpgplus.inventory
--- Checks if the player has the given items.
-- @param player player
-- @param ... items to check for (each as an @{rpgplus.types.itemstack} or a string of the form `id:data:amount`)
-- @return `true` if the player has the items or `false` if not
--
function hasItems(player, ...) end
--- Gives items to a player.
-- @param player player
-- @param ... items to give to the player (each as an @{rpgplus.types.itemstack} or a string of the form `id:data:amount`)
-- @return amount of each specified item that didn't fit into the inventory, as multiple return values
--
function giveItems(player, ...) end
--- Takes items from a player. The items are taken even if they are not enough.
-- @param player player
-- @param ... items to take from the player (each as an @{rpgplus.types.itemstack} or a string of the form `id:data:amount`)
-- @return missing amount of each specified item, as multiple return values
--
function takeItems(player, ...) end
--- Opens an inventory.
-- @param player player
-- @param size size of the inventory (rows of 9)
-- @param title title of the inventory
-- @param items table of items in the inventory, with slots as keys
-- @return Inventory inventory
--
function openChest(player, size, title, items) end
| --- Provides inventory functions.
-- @module rpgplus.inventory
--- Checks if the player has the given items.
-- @param player player
-- @param ... items to check for (each as an @{rpgplus.types.itemstack} or a string of the form `id:data:amount`)
-- @return `true` if the player has the items or `false` if not
--
function hasItems(player, ...) end
--- Gives items to a player.
-- @param player player
-- @param ... items to give to the player (each as an @{rpgplus.types.itemstack} or a string of the form `id:data:amount`)
-- @return amount of each specified item that didn't fit into the inventory, as multiple return values
--
function giveItems(player, ...) end
--- Takes items from a player. The items are taken even if they are not enough.
-- @param player player
-- @param ... items to take from the player (each as an @{rpgplus.types.itemstack} or a string of the form `id:data:amount`)
-- @return missing amount of each specified item, as multiple return values
--
function takeItems(player, ...) end
--- Opens an inventory.
-- @param player player
-- @param size size of the inventory (rows of 9)
-- @param title title of the inventory
-- @param items table of items in the inventory, with slots as keys
-- @treturn Inventory inventory
--
function openChest(player, size, title, items) end
| Fix return type for openChest function in luadoc. | Fix return type for openChest function in luadoc.
| Lua | mit | leMaik/RpgPlus |
189b8412a79b41b4ead962d9491185d310ba65bf | tests/coro-http-server-leak.lua | tests/coro-http-server-leak.lua | require('coro-http').createServer("127.0.0.1", 8080, function(req)
p(req)
return {
code = 200,
reason = "OK",
{"Content-Length", "6"},
{"Connection", "close"},
}, "hello\n"
end)
p 'http://localhost:8080/'
| Add simple coro-http server test | Add simple coro-http server test
| Lua | apache-2.0 | zhaozg/lit,luvit/lit | |
6ed153ae0b7eb187f42f9e8e93f96b0cac0c0f34 | lua/reinsertUnprocessed.lua | lua/reinsertUnprocessed.lua | local queue = KEYS[1]
local maxMessages = tonumber(ARGV[1])
local queueKey = '{' .. queue .. '}:messages'
local processingKey = '{' .. queue .. '}:processing'
local processingMessages = redis.call('LRANGE', processingKey, 0 - maxMessages, -1)
local ids = {}
for _, id in ipairs(processingMessages) do
local messageKey = queueKey .. ':' .. id
local messageProcessingKey = messageKey .. ':processing'
local stillProcessing = redis.call('EXISTS', messageProcessingKey)
if stillProcessing == 0 then
table.insert(ids, id)
redis.call('RPUSH', queueKey, id)
redis.call('LREM', processingKey, -1, id)
end
end
return ids | local queue = KEYS[1]
local maxMessages = tonumber(ARGV[1])
local queueKey = '{' .. queue .. '}:messages'
local processingKey = '{' .. queue .. '}:processing'
local processingMessages = redis.call('LRANGE', processingKey, 0 - maxMessages, -1)
local ids = {}
for _, id in ipairs(processingMessages) do
local messageKey = queueKey .. ':' .. id
local messageProcessingKey = messageKey .. ':processing'
local stillProcessing = redis.call('EXISTS', messageProcessingKey)
if stillProcessing == 0 then
table.insert(ids, id)
redis.call('RPUSH', queueKey, id)
redis.call('LREM', processingKey, -1, id)
else
return ids
end
end
return ids | Stop scanning for failed messages upon finding processing messages | Stop scanning for failed messages upon finding processing messages
| Lua | mit | fenichelar/BQueue |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.