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 |
|---|---|---|---|---|---|---|---|---|---|
9e48d7e8c2f75eb0619af29009abe06aa025d5f4 | src/bindings/lua/gface.lua | src/bindings/lua/gface.lua | local ffi = require "ffi"
ffi.cdef [[
bool gface_init(const char*);
wchar_t *gface_acquire();
void gface_shutdown();
]]
local C, ffistr = ffi.C, ffi.string
return {
init = function(license_key) return C.gface_init(license_key) end,
acquire = function() return ffistr(C.gface_acquire()) end,
shutdown = function() C.gface_shutdown() end
}
| local ffi = require "ffi"
ffi.cdef [[
bool gface_init(const char*);
wchar_t *gface_acquire();
void gface_shutdown();
size_t wcstombs(char *dest, const wchar_t *src, size_t max);
]]
local C, ffiload, ffinew, ffistr = ffi.C, ffi.load, ffi.new, ffi.string
local wstr_to_str = function(wstr)
local buf = ffinew("char[128]") -- large enough for us
C.wcstombs(buf, wstr, 128)
return ffistr(buf)
end
local gfacelib
return {
init = function(license_key)
gfacelib = ffi.load "gface"
if not gfacelib then return false end
return gfacelib.gface_init(license_key)
end,
acquire = function()
if not gfacelib then return nil end
return wstr_to_str(gfacelib.gface_acquire())
end,
shutdown = function()
gfacelib.gface_shutdown()
gfacelib = nil
end
}
| Update Lua bindings to work with wchar_t properly. | Update Lua bindings to work with wchar_t properly.
| Lua | agpl-3.0 | Shizmob/libgface,Shizmob/libgface,Shizmob/libgface,Shizmob/libgface |
ab763d4cbbe0742d3eef0e790950bdf23fa3dec9 | src/conf.lua | src/conf.lua | function love.conf(t)
t.title = "Journey to the Center of Hawkthorne v0.0.46"
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.47"
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.47 | Bump release version to v0.0.47
| Lua | mit | hawkthorne/hawkthorne-server-lua,hawkthorne/hawkthorne-client-lua,hawkthorne/hawkthorne-client-lua,hawkthorne/hawkthorne-server-lua |
4e15b7ec2f08515288b3a2396acb708e5c92eb43 | state.lua | state.lua | local state
local lastState
local renderList = {}
local update = function(dt)
local initial = state ~= lastState
lastState = state
renderList = state(dt, initial)
end
local getRenderList = function()
return renderList
end
local setState = function(newState)
state = newState
end
return {
update = update,
getRenderList = getRenderList,
setState = setState,
}
| local state
local lastState
local clearInput = require('input').clear
local renderList = {}
local update = function(dt)
local initial = state ~= lastState
lastState = state
renderList = state(dt, initial)
clearInput()
end
local getRenderList = function()
return renderList
end
local setState = function(newState)
state = newState
end
return {
update = update,
getRenderList = getRenderList,
setState = setState,
}
| Clear input queue after each update | Clear input queue after each update
| Lua | mit | TEAMBUTT/LD35 |
1a09ad319fef7faa8cd5a3bad97f8aedb43d5599 | init.lua | init.lua | require("packer").startup(function()
use 'wbthomason/packer.nvim'
use 'tpope/vim-sensible'
end)
vim.cmd [[autocmd BufWritePre * :%s/\s\+$//e]]
vim.opt.fileencoding = "utf-8"
vim.opt.smartindent = true
vim.opt.swapfile = false; vim.opt.backup = false
vim.opt.tabstop = 4; vim.opt.sw = 4; vim.opt.sts = 4; vim.opt.expandtab= true
| require("packer").startup(function()
use 'wbthomason/packer.nvim'
use 'tpope/vim-sensible'
end)
vim.cmd [[autocmd BufWritePre * :%s/\s\+$//e]]
vim.opt.fileencoding = "utf-8"
vim.opt.smartindent = true
vim.opt.swapfile = false; vim.opt.backup = false
vim.opt.tabstop = 4; vim.opt.sw = 4; vim.opt.sts = 4; vim.opt.expandtab= true
vim.cmd([[
augroup ft_git
autocmd!
autocmd BufNewFile,BufRead gitconfig setlocal filetype=gitconfig
autocmd FileType gitcommit setlocal spell spelllang=en_us
augroup END
]])
| Improve options for gitconfig and commits | nvim: Improve options for gitconfig and commits
Enable spell checking when editing commit messages.
An autocmd has also been added to properly set the file type when
editing gitconfig. This is required since nvim only "detects" .gitconfig
by default (named with a leading ".").
| Lua | unlicense | cenouro/dotfiles |
3c02628d8a6438c05ccfa7ce42d5b6b3ead37327 | includes/module.lua | includes/module.lua | function module_invoke_all(hook, ...)
local result, r = {}
for name, m in pairs(ophal.modules) do
if m[hook] then
-- TODO: Error handling
r = m[hook](...) -- call hook implementation
if type(r) == 'table' then
for k, v in pairs(r) do
v.module = name -- register module name
result[k] = v
end
elseif r then
table.insert(result, r)
end
end
end
return result
end | function module_invoke_all(hook, ...)
local result, r = {}
for name, m in pairs(ophal.modules) do
if m[hook] then
r, err = m[hook](...) -- call hook implementation
if err then
return nil, err
end
if type(r) == 'table' then
for k, v in pairs(r) do
v.module = name -- register module name
result[k] = v
end
elseif r then
table.insert(result, r)
end
end
end
return result
end
| Allow hooks to break and return a custom error. | Allow hooks to break and return a custom error.
| Lua | agpl-3.0 | ophal/core,coinzen/coinage,ophal/core,coinzen/coinage,coinzen/coinage,ophal/core |
5a38c9925c196b7af9b5441cc290a9a3ac5cc00a | Hydra/mode.lua | Hydra/mode.lua | -- mode.lua v2014.07.04
ext.mode = {}
local function _enter()
hydra.alert('ENTERED MODE')
end
local function _exit()
hydra.alert('EXITED MODE')
end
local mode = {_uid = 1, _enter = _enter, _exit = _exit}
function mode:bind(mods, key, fn)
self[self._uid] = hotkey.new(mods, key, fn)
self._uid = self._uid + 1
return self
end
function mode:disable()
self.hk:disable()
return self
end
function mode:enable()
self.hk:enable()
return self
end
function mode:enter()
self._enter()
self:disable()
for n=1,(self._uid-1) do
self[n]:enable()
end
return self
end
function mode:exit()
for n=1,(self._uid-1) do
self[n]:disable()
end
self._exit()
self:enable()
return self
end
-------------------------------------------
---------------- mode API -----------------
-------------------------------------------
local mode_metatable = {__index = mode}
function ext.mode.bind(mods, key, enter, exit)
local mode = {_exit = exit, _enter = enter}
mode = setmetatable(mode, mode_metatable)
mode.hk = hotkey.bind(mods, key, function() mode.enter(mode) end)
return mode
end
| Add simple Hotkey Mode functionality | Add simple Hotkey Mode functionality
This adds a simple mode.lua library to Hydra.
Example usage, using the grid.lua library:
```lua
moom = ext.mode.bind({'shift', 'cmd'}, 'M',
function() hydra.alert('Move Windows', 3) end,
function() end)
moom:bind({}, 'ESCAPE', function() moom:exit() end)
moom:bind({}, 'w', ext.grid.pushwindow_up)
moom:bind({}, 'z', ext.grid.pushwindow_down)
moom:bind({}, 'a', ext.grid.pushwindow_left)
moom:bind({}, 's', ext.grid.pushwindow_right)
moom:bind({}, 'm', ext.grid.maximize_window)
```
Closes #138
| Lua | mit | kkamdooong/hammerspoon,latenitefilms/hammerspoon,cmsj/hammerspoon,dopcn/hammerspoon,joehanchoi/hammerspoon,tmandry/hammerspoon,wsmith323/hammerspoon,dopcn/hammerspoon,kkamdooong/hammerspoon,Hammerspoon/hammerspoon,Habbie/hammerspoon,emoses/hammerspoon,zzamboni/hammerspoon,TimVonsee/hammerspoon,zzamboni/hammerspoon,CommandPost/CommandPost-App,lowne/hammerspoon,lowne/hammerspoon,Stimim/hammerspoon,Habbie/hammerspoon,tmandry/hammerspoon,knu/hammerspoon,trishume/hammerspoon,cmsj/hammerspoon,CommandPost/CommandPost-App,peterhajas/hammerspoon,zzamboni/hammerspoon,wsmith323/hammerspoon,knl/hammerspoon,peterhajas/hammerspoon,chrisjbray/hammerspoon,wsmith323/hammerspoon,bradparks/hammerspoon,asmagill/hammerspoon,wvierber/hammerspoon,asmagill/hammerspoon,emoses/hammerspoon,kkamdooong/hammerspoon,Stimim/hammerspoon,ocurr/hammerspoon,latenitefilms/hammerspoon,joehanchoi/hammerspoon,lowne/hammerspoon,nkgm/hammerspoon,junkblocker/hammerspoon,nkgm/hammerspoon,cmsj/hammerspoon,Hammerspoon/hammerspoon,junkblocker/hammerspoon,Stimim/hammerspoon,ocurr/hammerspoon,zzamboni/hammerspoon,emoses/hammerspoon,cmsj/hammerspoon,bradparks/hammerspoon,Stimim/hammerspoon,bradparks/hammerspoon,emoses/hammerspoon,Habbie/hammerspoon,latenitefilms/hammerspoon,heptal/hammerspoon,emoses/hammerspoon,chrisjbray/hammerspoon,latenitefilms/hammerspoon,latenitefilms/hammerspoon,wvierber/hammerspoon,trishume/hammerspoon,hypebeast/hammerspoon,chrisjbray/hammerspoon,Habbie/hammerspoon,knu/hammerspoon,wsmith323/hammerspoon,cmsj/hammerspoon,knl/hammerspoon,heptal/hammerspoon,asmagill/hammerspoon,lowne/hammerspoon,junkblocker/hammerspoon,junkblocker/hammerspoon,peterhajas/hammerspoon,Hammerspoon/hammerspoon,joehanchoi/hammerspoon,cmsj/hammerspoon,nkgm/hammerspoon,wvierber/hammerspoon,Habbie/hammerspoon,hypebeast/hammerspoon,CommandPost/CommandPost-App,zzamboni/hammerspoon,Hammerspoon/hammerspoon,ocurr/hammerspoon,knl/hammerspoon,heptal/hammerspoon,Hammerspoon/hammerspoon,CommandPost/CommandPost-App,junkblocker/hammerspoon,peterhajas/hammerspoon,peterhajas/hammerspoon,ocurr/hammerspoon,joehanchoi/hammerspoon,asmagill/hammerspoon,bradparks/hammerspoon,trishume/hammerspoon,Habbie/hammerspoon,wvierber/hammerspoon,heptal/hammerspoon,hypebeast/hammerspoon,zzamboni/hammerspoon,CommandPost/CommandPost-App,TimVonsee/hammerspoon,Stimim/hammerspoon,chrisjbray/hammerspoon,chrisjbray/hammerspoon,lowne/hammerspoon,TimVonsee/hammerspoon,knl/hammerspoon,asmagill/hammerspoon,dopcn/hammerspoon,bradparks/hammerspoon,CommandPost/CommandPost-App,joehanchoi/hammerspoon,Hammerspoon/hammerspoon,wsmith323/hammerspoon,ocurr/hammerspoon,knu/hammerspoon,tmandry/hammerspoon,nkgm/hammerspoon,kkamdooong/hammerspoon,kkamdooong/hammerspoon,heptal/hammerspoon,knl/hammerspoon,wvierber/hammerspoon,TimVonsee/hammerspoon,dopcn/hammerspoon,hypebeast/hammerspoon,asmagill/hammerspoon,chrisjbray/hammerspoon,knu/hammerspoon,hypebeast/hammerspoon,knu/hammerspoon,latenitefilms/hammerspoon,nkgm/hammerspoon,dopcn/hammerspoon,TimVonsee/hammerspoon,knu/hammerspoon | |
83fbda777314da1d7fa52b8d8b17db92010b42cc | src/cosy/cli/runner.lua | src/cosy/cli/runner.lua | local Cli = require "cosy.cli"
Cli.configure (arg)
Cli.start ()
| local Cli = require "cosy.cli"
local cli = Cli.new ()
cli:start ()
| Use the Cli.new function and transform call to start into a method call. | Use the Cli.new function and transform call to start into a method call.
| Lua | mit | CosyVerif/library,CosyVerif/library,CosyVerif/library |
966db53ee8f1fe180870c50468191361c181f6d5 | solutions/uri/1006/1006.lua | solutions/uri/1006/1006.lua | a = tonumber(io.read("*n"))
b = tonumber(io.read("*n"))
c = tonumber(io.read("*n"))
print(string.format('MEDIA = %.1f', (a * 2.0 + b * 3.0 + c * 5.0) / 10.0))
| Solve Average 2 in lua | Solve Average 2 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 | |
f006bdf5481c54d67410488412fee2e3348249e7 | 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
local timer
for i = 1, 0x10000 do
timer = uv.new_timer()
uv.close(timer)
if i % 0x1000 == 0 then
timer = nil
uv.run()
collectgarbage()
local now = uv.resident_set_memory()
if not before then before = now end
p(i, now)
end
end
uv.run()
collectgarbage()
local after = uv.resident_set_memory()
p{
before = before,
after = after,
}
assert(after < before * 1.1, "Leak in timers")
end)
end)
| return require('lib/tap')(function (test)
test("lots-o-timers", function (print, p, expect, uv)
collectgarbage()
local before
local timer
for i = 1, 0x10000 do
timer = uv.new_timer()
uv.close(timer)
if i % 0x2000 == 0 then
timer = nil
uv.run()
collectgarbage()
local now = uv.resident_set_memory()
if not before then before = now end
p(i, now)
end
end
uv.run()
collectgarbage()
local after = uv.resident_set_memory()
p{
before = before,
after = after,
}
assert(after < before * 1.5, "Leak in timers")
end)
end)
| Make leak test less sensitive | Make leak test less sensitive
| Lua | apache-2.0 | zhaozg/luv,DBarney/luv,xpol/luv,leecrest/luv,joerg-krause/luv,daurnimator/luv,daurnimator/luv,xpol/luv,kidaa/luv,NanXiao/luv,luvit/luv,DBarney/luv,mkschreder/luv,brimworks/luv,RomeroMalaquias/luv,joerg-krause/luv,zhaozg/luv,luvit/luv,RomeroMalaquias/luv,NanXiao/luv,brimworks/luv,RomeroMalaquias/luv,leecrest/luv,kidaa/luv,daurnimator/luv,mkschreder/luv |
252076d707be9a291cba12a692c831d07c61b109 | agents/monitoring/init.lua | agents/monitoring/init.lua | --[[
Copyright 2012 Rackspace
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.
--]]
local logging = require('logging')
local Entry = {}
local argv = require("options")
:usage('Usage: ')
:describe("e", "entry module")
:describe("s", "state directory path")
:describe("c", "config file path")
:describe("p", "pid file path")
:argv("he:p:c:s:")
function Entry.run()
local mod = argv.args.e and argv.args.e or 'default'
mod = './modules/monitoring/' .. mod
logging.set_level(logging.INFO)
logging.log(logging.DEBUG, 'Running Module ' .. mod)
local err, msg = pcall(function()
require(mod).run(argv.args)
end)
if err == false then
logging.log(logging.ERR, msg)
end
end
return Entry
| --[[
Copyright 2012 Rackspace
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.
--]]
local logging = require('logging')
local Entry = {}
local argv = require("options")
:usage('Usage: ')
:describe("e", "entry module")
:describe("s", "state directory path")
:describe("c", "config file path")
:describe("p", "pid file path")
:describe("d", "enable debug logging")
:argv("dhe:p:c:s:")
function Entry.run()
local mod = argv.args.e and argv.args.e or 'default'
mod = './modules/monitoring/' .. mod
if argv.args.d then
logging.set_level(logging.EVERYTHING)
else
logging.set_level(logging.INFO)
end
logging.log(logging.DEBUG, 'Running Module ' .. mod)
local err, msg = pcall(function()
require(mod).run(argv.args)
end)
if err == false then
logging.log(logging.ERR, msg)
end
end
return Entry
| Add command line flag to enable debug logging | Add command line flag to enable debug logging
| Lua | apache-2.0 | kans/zirgo,kans/zirgo,kans/zirgo |
9081c5ec91259f9347d833ab5b750eb544ea416c | src/cosy.lua | src/cosy.lua | #! /usr/bin/env lua
-- Default values for the program options:
local defaults = {}
local loader = require "cosy.loader"
local cli = loader "cliargs"
cli:set_name (arg [0])
local args = cli:parse_args ()
if not args then
cli:print_help ()
os.exit (1)
end
loader.server.start ()
| #! /usr/bin/env lua
-- Default values for the program options:
local defaults = {}
local loader = require "cosy.loader"
local cli = loader "cliargs"
cli:set_name (arg [0])
cli:add_option (
"-c, --clean",
"clean redis database"
)
local args = cli:parse_args ()
if not args then
cli:print_help ()
os.exit (1)
end
if args.clean then
local redis = loader "redis"
local host = loader.configuration.redis.host._
local port = loader.configuration.redis.port._
local database = loader.configuration.redis.database._
local client = redis.connect (host, port)
client:select (database)
client:flushdb ()
package.loaded.redis = nil
end
loader.server.start ()
| Add --clean option to clean redis database before run. | Add --clean option to clean redis database before run.
| Lua | mit | CosyVerif/library,CosyVerif/library,CosyVerif/library |
af8f015145bdfceb5f60811d3e91d7e861521117 | src/lib/numa.lua | src/lib/numa.lua | module(..., package.seeall)
local S = require("syscall")
function set_cpu (cpu)
local cpu_set = S.sched_getaffinity()
cpu_set:zero()
cpu_set:set(cpu)
S.sched_setaffinity(0, cpu_set)
local policy = S.get_mempolicy()
mask:zero()
mask:set(cpu) -- fixme should be numa node
S.set_mempolicy(policy.mode, policy.mask)
if not S.sched_setscheduler(0, "fifo", 1) then
fatal('Failed to enable real-time scheduling. Try running as root.')
end
end
function selftest ()
print(S.sched_getaffinity())
print(S.get_mempolicy().mask)
end
| Add beginnings of NUMA module for Snabb | Add beginnings of NUMA module for Snabb
| Lua | apache-2.0 | mixflowtech/logsensor,dpino/snabbswitch,kbara/snabb,Igalia/snabb,snabbco/snabb,mixflowtech/logsensor,dpino/snabbswitch,mixflowtech/logsensor,Igalia/snabb,alexandergall/snabbswitch,snabbco/snabb,alexandergall/snabbswitch,eugeneia/snabb,Igalia/snabb,Igalia/snabbswitch,Igalia/snabb,eugeneia/snabb,dpino/snabb,heryii/snabb,alexandergall/snabbswitch,snabbco/snabb,dpino/snabbswitch,alexandergall/snabbswitch,dpino/snabb,heryii/snabb,mixflowtech/logsensor,dpino/snabbswitch,eugeneia/snabbswitch,Igalia/snabbswitch,eugeneia/snabbswitch,eugeneia/snabb,alexandergall/snabbswitch,SnabbCo/snabbswitch,Igalia/snabbswitch,snabbco/snabb,dpino/snabb,dpino/snabb,alexandergall/snabbswitch,dpino/snabb,Igalia/snabb,Igalia/snabbswitch,Igalia/snabbswitch,Igalia/snabb,eugeneia/snabb,eugeneia/snabb,alexandergall/snabbswitch,dpino/snabb,kbara/snabb,eugeneia/snabbswitch,kbara/snabb,snabbco/snabb,kbara/snabb,heryii/snabb,mixflowtech/logsensor,alexandergall/snabbswitch,dpino/snabb,Igalia/snabb,heryii/snabb,Igalia/snabb,kbara/snabb,SnabbCo/snabbswitch,heryii/snabb,eugeneia/snabb,heryii/snabb,SnabbCo/snabbswitch,snabbco/snabb,snabbco/snabb,eugeneia/snabb,SnabbCo/snabbswitch,eugeneia/snabbswitch,snabbco/snabb,eugeneia/snabb,kbara/snabb | |
af48e2630a90674e08fa39dceeeffc784774dfce | tests/lua/tests/gl.lua | tests/lua/tests/gl.lua | local gl = require 'engine.gl'
local ffi = require 'ffi'
local fileutil = require 'engine.fileutil'
local render_test = nil
local program, posAttrib = nil, nil
function _render()
gl.glUseProgram(program)
gl.glVertexAttribPointer(posAttrib, 2, gl.GL_FLOAT, gl.GL_FALSE, 0, nil)
gl.glEnableVertexAttribArray(posAttrib)
gl.glDrawArrays(gl.GL_TRIANGLES, 0, 3)
end
function _init()
local vertexSource = [[
#version 330
in vec2 position;
void main()
{
gl_Position = vec4(position, 0.0, 1.0);
}
]]
local fragmentSource = [[
#version 330
out vec4 outColor;
void main()
{
outColor = vec4(1.0, 1.0, 1.0, 1.0);
}
]]
local vertices = ffi.new('float[6]', { 0.0, 0.5, 0.5, -0.5, -0.5, -0.5} )
local vbo = ffi.new 'GLuint[1]'
gl.glGenBuffers(1, vbo)
gl.glBindBuffer(gl.GL_ARRAY_BUFFER, vbo[1])
gl.glBufferData(gl.GL_ARRAY_BUFFER, ffi.sizeof(vertices), vertices, gl.GL_STATIC_DRAW);
program = gl.createProgram(vertexSource, fragmentSource)
posAttrib = gl.glGetAttribLocation(program, 'position')
local vao = ffi.new 'GLuint[1]'
gl.glGenVertexArrays(1, vao);
gl.glBindVertexArray(vao[1]);
render_test = _render
end
render_test = _init
return {
process = function(dt)
end,
render = function()
render_test()
end
}
| Add Lua OpenGL binding tests | Add Lua OpenGL binding tests
| Lua | mit | lzubiaur/woot,lzubiaur/woot,lzubiaur/woot,lzubiaur/woot,lzubiaur/woot,lzubiaur/woot,lzubiaur/woot | |
89d238085d88db340e7778ba299118ecf35b11af | Identity.lua | Identity.lua | local Identity, _ = torch.class('nn.Identity', 'nn.Module')
function Identity:updateOutput(input)
self.output:set(input:storage(), input:storageOffset(), input:size(), input:stride())
return self.output
end
function Identity:updateGradInput(input, gradOutput)
self.gradInput:set(gradOutput:storage(), gradOutput:storageOffset(), gradOutput:size(), gradOutput:stride())
return self.gradInput
end
| local Identity, _ = torch.class('nn.Identity', 'nn.Module')
function Identity:updateOutput(input)
self.output = input
return self.output
end
function Identity:updateGradInput(input, gradOutput)
self.gradInput = gradOutput
return self.gradInput
end
| Revert "State variable pointers should never change." | Revert "State variable pointers should never change."
| Lua | bsd-3-clause | Moodstocks/nn,jhjin/nn,apaszke/nn,jonathantompson/nn,caldweln/nn,elbamos/nn,andreaskoepf/nn,witgo/nn,eriche2016/nn,kmul00/nn,joeyhng/nn,sagarwaghmare69/nn,lukasc-ch/nn,xianjiec/nn,colesbury/nn,diz-vara/nn,mlosch/nn,nicholas-leonard/nn,PraveerSINGH/nn |
4e587438ca20b2b304825e941c7988fe2e8911df | sample/tutorial/hellopacket/hellopacket.lua | sample/tutorial/hellopacket/hellopacket.lua | -- Use this file with hakapcap tool:
--
-- hakapcap hellopacket.pcap hellopacket.lua
-- (adjust paths)
--The require lines tolds Haka which dissector
--it has to register. Those dissectors gives hook
--to interfere with it.
require("protocol/ipv4")
require("protocol/tcp")
--This is a rule
haka.rule {
--The hooks tells where this rule is applied
hooks = {"ipv4-up"},
--Each rule have an eval function
--Eval function is always build with (self, name)
--First parameter, self, is mandatory
--Second parameter can be named whatever you want
eval = function (self, pkt)
--All fields is accessible through accessors
--following wireshark/tcpdump semantics
--Documentation give the complet list of accessors
haka.log("debug","Hello packet from %s to %s", pkt.src, pkt.dst)
end
}
--Any number of rule is authorized
haka.rule {
--The rule is evaluated at TCP connection establishment
hooks = {"tcp-connection-new"},
eval = function (self, pkt)
--Fields from previous layer is accessible too
haka.log("debug","Hello TCP connection from %s:%d to %s:%d", pkt.tcp.ip.src, pkt.tcp.srcport, pkt.tcp.ip.dst, pkt.tcp.dstport)
end
}
| -- Use this file with hakapcap tool:
--
-- hakapcap hellopacket.pcap hellopacket.lua
-- (adjust paths)
--The require lines tolds Haka which dissector
--it has to register. Those dissectors gives hook
--to interfere with it.
require("protocol/ipv4")
require("protocol/tcp")
--This is a rule
haka.rule {
--The hooks tells where this rule is applied
hooks = {"ipv4-up"},
--Each rule have an eval function
--Eval function is always build with (self, name)
--First parameter, self, is mandatory
--Second parameter can be named whatever you want
eval = function (self, pkt)
--All fields is accessible through accessors
--following wireshark/tcpdump semantics
--Documentation give the complet list of accessors
haka.log("Hello", "packet from %s to %s", pkt.src, pkt.dst)
end
}
--Any number of rule is authorized
haka.rule {
--The rule is evaluated at TCP connection establishment
hooks = {"tcp-connection-new"},
eval = function (self, pkt)
--Fields from previous layer is accessible too
haka.log("Hello", "TCP connection from %s:%d to %s:%d", pkt.tcp.ip.src, pkt.tcp.srcport, pkt.tcp.ip.dst, pkt.tcp.dstport)
end
}
| Write better message on output | Write better message on output
| Lua | mpl-2.0 | lcheylus/haka,LubyRuffy/haka,LubyRuffy/haka,haka-security/haka,Wingless-Archangel/haka,lcheylus/haka,nabilbendafi/haka,Wingless-Archangel/haka,lcheylus/haka,nabilbendafi/haka,nabilbendafi/haka,haka-security/haka,haka-security/haka |
3d11c94933333b086613ad14fe015fac7daa6aa8 | src/Image.lua | src/Image.lua | local System = require 'System'
local Image = {}
local padding = 8
local function calculate_size(dir)
return System.pread('*n', 'du -sm "%s"', dir)
end
local function run(format, ...)
if not System.exec(format, ...) then
local command = string.format(format, ...)
error('failed to run: '..command, 2)
end
end
local function srun(format, ...)
return run('sudo '..format, ...)
end
function Image:create(src_dir, out_file)
local size = calculate_size(src_dir) + padding
local mount_path = '/mnt/image'
local ok, err
run('dd if=/dev/zero of="%s" bs=1 count=0 seek=%sM', out_file, size)
run('mke2fs -F -t ext4 -O ^huge_file "%s" %sM', out_file, size)
srun('mkdir -p "%s"', mount_path)
srun('mount -t ext4 "%s" "%s"', out_file, mount_path)
ok, err = pcall(srun, 'rsync -a "%s/" "%s"', src_dir, mount_path)
srun('umount "%s"', mount_path)
if not ok then
error(err)
end
end
return Image
| local System = require 'System'
local Log = require 'Log'
local Image = {}
local padding = 8
local function calculate_size(dir)
return System.pread('*n', 'du -sm "%s"', dir)
end
local function run(format, ...)
if not System.exec(format, ...) then
local command = string.format(format, ...)
error('failed to run: '..command, 2)
end
end
local function srun(format, ...)
return run('sudo '..format, ...)
end
function Image:create(src_dir, out_file)
local size = calculate_size(src_dir) + padding
local mount_path = '/mnt/image'
local ok, err
run('dd if=/dev/zero of="%s" bs=1 count=0 seek=%sM', out_file, size)
run('mke2fs -F -t ext4 -O ^huge_file "%s" %sM', out_file, size)
srun('mkdir -p "%s"', mount_path)
srun('mount -t ext4 "%s" "%s"', out_file, mount_path)
ok, err = pcall(srun, 'rsync -a "%s/" "%s"', src_dir, mount_path)
srun('umount "%s"', mount_path)
if not ok then
error(err)
end
Log.message('Image created: %s', out_file)
end
return Image
| Add message with image path | Add message with image path
| Lua | mit | bazurbat/jagen |
84c51ddaf6363c96a527954e4f398da0de9350fd | examples/bench/method_call.nobj.lua | examples/bench/method_call.nobj.lua | object "method_call" {
c_source[[
typedef struct method_call method_call;
#define DEFAULT_PTR ((method_call *)0xDEADBEEF)
method_call *method_call_create() {
return DEFAULT_PTR;
}
void method_call_destroy(method_call *call) {
assert(call == DEFAULT_PTR);
}
int method_call_null(method_call *call) {
return 0;
}
]],
-- create object
constructor {
c_call "method_call *" "method_call_create" {},
},
-- destroy object
destructor "close" {
c_method_call "void" "method_call_destroy" {},
},
method "simple" {
c_source[[
if(${this} != DEFAULT_PTR) {
luaL_error(L, "INVALID PTR: %p != %p", ${this}, DEFAULT_PTR);
}
]],
},
method "null" {
c_method_call "int" "method_call_null" {},
},
}
| object "method_call" {
c_source[[
typedef struct method_call method_call;
#define DEFAULT_PTR ((method_call *)0xDEADBEEF)
method_call *method_call_create() {
return DEFAULT_PTR;
}
void method_call_destroy(method_call *call) {
assert(call == DEFAULT_PTR);
}
int method_call_null(method_call *call) {
return 0;
}
]],
-- create object
constructor {
c_call "method_call *" "method_call_create" {},
},
-- destroy object
destructor "close" {
c_method_call "void" "method_call_destroy" {},
},
method "simple" {
c_source[[
if(${this} != DEFAULT_PTR) {
luaL_error(L, "INVALID PTR: %p != %p", ${this}, DEFAULT_PTR);
}
]],
ffi_source[[
if(${this} == nil) then
error(string.format("INVALID PTR: %s != %s", tostring(${this}), tostring(DEFAULT_PTR)));
end
]],
},
method "null" {
c_method_call "int" "method_call_null" {},
},
}
| Add FFI code to 'simple' method. | Add FFI code to 'simple' method.
| Lua | mit | Neopallium/LuaNativeObjects |
5ed1252d3474ae537b3242da1ed64d834301e7c2 | server.lua | server.lua | --
-- For use with Algernon / Lua
--
-- Project page: https://github.com/xyproto/algernon
-- Web page: http://algernon.roboticoverlords.org/
--
-- Set the headers
content("application/javascript")
setheader("Cache-Control", "no-cache")
-- Use a Redis list for the comments
comments = List("comments")
-- Handle requests
if method() == "POST" then
-- Add the form data to the comment list, as JSON
comments:add(JSON(formdata()))
else
-- Combine all the JSON comments to a JSON document
print("["..table.concat(comments:getall(), ",").."]")
end
| --
-- For use with Algernon / Lua
--
-- Project page: https://github.com/xyproto/algernon
-- Web page: http://algernon.roboticoverlords.org/
--
-- Set the headers
content("application/javascript")
setheader("Cache-Control", "no-cache")
-- Use a JSON file for the comments
comments = JFile("comments.json")
-- Handle requests
if method() == "POST" then
-- Add the form data table to the JSON document
comments:add(ToJSON(formdata()))
else
-- Return the contents of the JSON file
print(tostring(comments))
end
| Use the JSON document for storing comments | Use the JSON document for storing comments
| Lua | mit | nicrocs/react-form-builder,nfelix/primeNameChecker,Capocaccia/reacting,nicrocs/react-form-builder,nfelix/primeNameChecker,Capocaccia/reacting |
a4b1b5ae561257b7aae45b0ec84537dd234bb01f | package.lua | package.lua | return {
name = "creationix/rye",
version = "0.0.1",
dependencies = {
"creationix/git@0.1.0",
"creationix/require@1.0.2",
"creationix/coro-tcp@1.0.1",
"creationix/coro-fs@1.2.3",
"creationix/pretty-print@0.1.0",
"luvit/http-codec@0.1.0",
},
files = {
"!rye"
}
}
| return {
name = "creationix/rye",
version = "0.0.1",
dependencies = {
"creationix/git@0.1.0",
"creationix/require@1.0.2",
"creationix/coro-tcp@1.0.3",
"creationix/coro-fs@1.2.3",
"creationix/coro-wrapper@0.1.0",
"creationix/pretty-print@0.1.0",
"luvit/http-codec@0.1.0",
},
files = {
"!rye"
}
}
| Update deps to fix networking bugs | Update deps to fix networking bugs
| Lua | isc | creationix/rye,creationix/rye |
9dbc0bf53fa7bc2726f9f4e14c5c73fdde90ff52 | src/conf.lua | src/conf.lua | function love.conf(t)
t.title = "Journey to the Center of Hawkthorne v0.0.56"
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.57"
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.57 | Bump release version to v0.0.57
| Lua | mit | hawkthorne/hawkthorne-server-lua,hawkthorne/hawkthorne-client-lua,hawkthorne/hawkthorne-client-lua,hawkthorne/hawkthorne-server-lua |
cf363452e07d4735d30cd02dff5e3a0db4be6427 | src/cosy/cli/conf.lua | src/cosy/cli/conf.lua | local Default = require "cosy.configuration.layers".default
Default.cli = {
data = os.getenv "HOME" .. "/.cosy/cli.data",
directory = os.getenv "HOME" .. "/.cosy",
locale = (os.getenv "LANG" or "en"):match "[^%.]+":gsub ("_", "-"),
log = os.getenv "HOME" .. "/.cosy/cli.log",
server = "http://cosyverif.org/",
}
| local Default = require "cosy.configuration.layers".default
Default.cli = {
data = os.getenv "HOME" .. "/.cosy/cli.data",
directory = os.getenv "HOME" .. "/.cosy",
locale = (os.getenv "LANG" or "en"):match "[^%.]+":gsub ("_", "-"),
log = os.getenv "HOME" .. "/.cosy/cli.log",
packages_directory = os.getenv "HOME" .. "/.cosy/lua",
packages_data = os.getenv "HOME" .. "/.cosy/lua.data",
server = "http://cosyverif.org/",
}
| Add a data file and path to store packages. | Add a data file and path to store packages.
| Lua | mit | CosyVerif/library,CosyVerif/library,CosyVerif/library |
b75054aa8c2d05e260a6689cddeacca6221cd68a | src/luacheck/get_report.lua | src/luacheck/get_report.lua | local check = require "luacheck.check"
local luacompiler = require "metalua.compiler"
local luaparser = luacompiler.new()
--- Checks a file.
-- Returns a file report.
-- See luacheck function.
local function get_report(file, options)
local ok, source = pcall(function()
local handler = io.open(file, "rb")
local source = assert(handler:read("*a"))
handler:close()
return source
end)
if not ok then
return {error = "I/O", file = file}
end
local ast
ok, ast = pcall(function() return luaparser:src_to_ast(source) end)
if not ok then
return {error = "syntax", file = file}
else
local report = check(ast, options)
report.file = file
return report
end
end
return get_report
| local check = require "luacheck.check"
local luacompiler = require "metalua.compiler"
local luaparser = luacompiler.new()
--- Checks a file.
-- Returns a file report.
-- See luacheck function.
local function get_report(file, options)
local filename = file == "-" and "stdin" or file
local src
if not pcall(function()
local handler = file == "-" and io.stdin or io.open(file, "rb")
src = assert(handler:read("*a"))
handler:close() end) then
return {error = "I/O", file = filename}
end
local ast
if not pcall(function()
ast = luaparser:src_to_ast(src) end) then
return {error = "syntax", file = filename}
end
local report = check(ast, options)
report.file = filename
return report
end
return get_report
| Allow checking stdin by passing `-` as filename | Allow checking stdin by passing `-` as filename
| Lua | mit | kidaa/luacheck,mpeterv/luacheck,adan830/luacheck,tst2005/luacheck,xpol/luacheck,adan830/luacheck,xpol/luacheck,xpol/luacheck,linuxmaniac/luacheck,linuxmaniac/luacheck,mpeterv/luacheck,mpeterv/luacheck,tst2005/luacheck,kidaa/luacheck |
36605b6be15eefb690ad293398ed00ef8f5ba7e6 | conf/rate_limit.lua | conf/rate_limit.lua | local inspect = require "inspect"
local distributed_rate_limit_queue = require "distributed_rate_limit_queue"
return function(settings, user)
if settings["rate_limit_mode"] == "unlimited" then
return
end
local limits = settings["rate_limits"]
for _, limit in ipairs(limits) do
local limit_by = limit["limit_by"]
if not user or user.throttle_by_ip then
limit_by = "ip"
end
local key = limit["limit_by"] .. "-" .. limit["duration"] .. "-"
if limit_by == "apiKey" then
key = key .. user["api_key"]
elseif limit_by == "ip" then
key = key .. ngx.ctx.remote_addr
else
ngx.log(ngx.ERR, "stats unknown limit by")
end
local count, err = ngx.shared.stats:incr(key, 1)
if err == "not found" then
count = 1
local success, err = ngx.shared.stats:set(key, count, limit["duration"] / 1000)
if not success then
ngx.log(ngx.ERR, "stats set err" .. err)
return
end
elseif err then
ngx.log(ngx.ERR, "stats incr err" .. err)
return
end
distributed_rate_limit_queue.push(key, limit)
local remaining = limit["limit"] - count
ngx.header["X-RateLimit-Limit"] = limit["limit"]
ngx.header["X-RateLimit-Remaining"] = remaining
if remaining <= 0 then
return "over_rate_limit"
end
end
end
| local inspect = require "inspect"
local distributed_rate_limit_queue = require "distributed_rate_limit_queue"
return function(settings, user)
if settings["rate_limit_mode"] == "unlimited" then
return
end
local limits = settings["rate_limits"]
for _, limit in ipairs(limits) do
local limit_by = limit["limit_by"]
if not user or user.throttle_by_ip then
limit_by = "ip"
end
local key = limit["limit_by"] .. "-" .. limit["duration"] .. "-"
if limit_by == "apiKey" then
key = key .. user["api_key"]
elseif limit_by == "ip" then
key = key .. ngx.ctx.remote_addr
else
ngx.log(ngx.ERR, "stats unknown limit by")
end
local count, err = ngx.shared.stats:incr(key, 1)
if err == "not found" then
count = 1
local success, err = ngx.shared.stats:set(key, count, limit["duration"] / 1000)
if not success then
ngx.log(ngx.ERR, "stats set err" .. err)
return
end
elseif err then
ngx.log(ngx.ERR, "stats incr err" .. err)
return
end
distributed_rate_limit_queue.push(key, limit)
local remaining = limit["limit"] - count
ngx.header["X-RateLimit-Limit"] = limit["limit"]
ngx.header["X-RateLimit-Remaining"] = remaining
if remaining < 0 then
return "over_rate_limit"
end
end
end
| Fix rate limits being applied 1 request too soon. | Fix rate limits being applied 1 request too soon.
| Lua | mit | apinf/api-umbrella,NREL/api-umbrella,NREL/api-umbrella,NREL/api-umbrella,apinf/api-umbrella,NREL/api-umbrella,apinf/api-umbrella,apinf/api-umbrella,apinf/api-umbrella |
fb22235aac0f9c0e42ab6876f0516cee9445a11f | ardivink.lua | ardivink.lua | ci = require("ci")
--godi = require("godi")
oasis = require("oasis")
git = require("git")
ci.init()
-- godi.init()
git.init()
oasis.init()
--godi.bootstrap("3.12")
--godi.update()
--godi.upgrade()
--godi.build_many(
-- {"godi-findlib",
-- "godi-ocaml-fileutils",
-- "godi-ocaml-data-notation",
-- "godi-ocaml-expect",
-- "godi-ounit",
-- "apps-ocamlmod",
-- "apps-ocamlify"})
oasis.std_process("--enable-tests")
git.create_tag(oasis.package_version())
| ci = require("ci")
--godi = require("godi")
oasis = require("oasis")
git = require("git")
ci.init()
-- godi.init()
ci.prependenv("PATH", "/usr/opt/godi/bin")
ci.prependenv("PATH", "/usr/opt/godi/sbin")
git.init()
oasis.init()
--godi.bootstrap("3.12")
--godi.update()
--godi.upgrade()
--godi.build_many(
-- {"godi-findlib",
-- "godi-ocaml-fileutils",
-- "godi-ocaml-data-notation",
-- "godi-ocaml-expect",
-- "godi-ounit",
-- "apps-ocamlmod",
-- "apps-ocamlify"})
oasis.std_process("--enable-tests")
git.create_tag(oasis.package_version())
| Fix path for GODI installation on deci. | Fix path for GODI installation on deci.
| Lua | lgpl-2.1 | jpdeplaix/oasis,jpdeplaix/oasis,gerdstolpmann/oasis,madroach/oasis,jpdeplaix/oasis,madroach/oasis,Chris00/oasis,gerdstolpmann/oasis,diml/oasis,RadicalZephyr/oasis,Chris00/oasis,Chris00/oasis,RadicalZephyr/oasis,gerdstolpmann/oasis,diml/oasis |
423a4ef326ebc206f8b7ffc64d295ce250b52cf0 | profiles/lib/measure.lua | profiles/lib/measure.lua | local Sequence = require('lib/sequence')
Measure = {}
-- measurements conversion constants
local inch_to_meters = 0.0254
local feet_to_inches = 12
--- according to http://wiki.openstreetmap.org/wiki/Key:maxheight
local meters_parse_patterns = Sequence {
"%d+",
"%d+.%d+",
"%d+.%d+ m",
"%d+,%d+ m", -- wrong
"%d+.%d+m", -- wrong
"%d+,%d+m", -- wrong
}
local feet_parse_patterns = Sequence {
"%d+\'%d+\'",
}
function Measure.convert_feet_to_inches(feet)
return feet * feet_to_inches
end
function Measure.convert_inches_to_meters(inches)
return inches * inch_to_meters
end
--- Parse string as a height in meters.
function Measure.parse_value_meters(value)
-- try to parse meters
for i, templ in ipairs(meters_parse_patterns) do
m = string.match(value, templ)
if m then
return tonumber(m)
end
end
-- try to parse feets/inch
for i, templ in ipairs(feet_parse_patterns) do
m = string.match(value, templ)
if m then
feet, inch = m
feet = tonumber(feet)
inch = tonumber(inch)
inch = inch + feet * feet_to_inches
return Measure.convert_inches_to_meters(inch)
end
end
return
end
--- Get maxheight of specified way in meters. If there are no
--- max height, then return nil
function Measure.get_max_height(way)
raw_value = way:get_value_by_key('maxheight')
if raw_value then
return Measure.parse_value_meters(raw_value)
end
-- TODO: parse another tags
end
--- Get maxwidth of specified way in meters.
function Measure.get_max_width(way)
raw_value = way:get_value_by_key('maxwidth')
if raw_value then
print(way:id(), raw_value)
return Measure.parse_value_meters(raw_value)
end
end
return Measure; | Add maxheight/maxwidth support into profiles | Add maxheight/maxwidth support into profiles
| Lua | bsd-2-clause | felixguendling/osrm-backend,oxidase/osrm-backend,yuryleb/osrm-backend,oxidase/osrm-backend,yuryleb/osrm-backend,bjtaylor1/osrm-backend,oxidase/osrm-backend,yuryleb/osrm-backend,felixguendling/osrm-backend,yuryleb/osrm-backend,Project-OSRM/osrm-backend,frodrigo/osrm-backend,KnockSoftware/osrm-backend,bjtaylor1/osrm-backend,Project-OSRM/osrm-backend,Project-OSRM/osrm-backend,bjtaylor1/osrm-backend,frodrigo/osrm-backend,oxidase/osrm-backend,KnockSoftware/osrm-backend,KnockSoftware/osrm-backend,frodrigo/osrm-backend,felixguendling/osrm-backend,KnockSoftware/osrm-backend,frodrigo/osrm-backend,bjtaylor1/osrm-backend,Project-OSRM/osrm-backend | |
3e5214bc23b93b0ec30ac253ea0694f1693c2f55 | agents/monitoring/default/util/constants.lua | agents/monitoring/default/util/constants.lua | local os = require('os')
local path = require('path')
local exports = {}
-- All intervals and timeouts are in milliseconds
exports.CONNECT_TIMEOUT = 6000
exports.SOCKET_TIMEOUT = 10000
exports.HEARTBEAT_INTERVAL_JITTER = 7000
exports.DATACENTER_MAX_DELAY = 5 * 60 * 1000 -- max connection delay
exports.DATACENTER_MAX_DELAY_JITTER = 7000
exports.SRV_RECORD_FAILURE_DELAY = 15 * 1000
exports.SRV_RECORD_FAILURE_DELAY_JITTER = 15 * 1000
exports.DEFAULT_MONITORING_SRV_QUERIES = {
'_monitoring_agent._tcp.lon3.prod.monitoring.api.rackspacecloud.com',
'_monitoring_agent._tcp.ord1.prod.monitoring.api.rackspacecloud.com'
}
if os.type() == 'win32' then
exports.DEFAULT_PERSISTENT_VARIABLE_PATH = './'
else
exports.DEFAULT_PERSISTENT_VARIABLE_PATH = '/var/lib/rackspace-monitoring-agent'
end
-- Custom plugins related settings
exports.DEFAULT_CUSTOM_PLUGINS_PATH = path.join(exports.DEFAULT_PERSISTENT_VARIABLE_PATH, 'plugins')
exports.DEFAULT_PLUGIN_TIMEOUT = 30 * 1000
exports.PLUGIN_TYPE_MAP = {string = 'string', int = 'int64', float = 'double', gauge = 'gauge'}
return exports
| local os = require('os')
local path = require('path')
local exports = {}
-- All intervals and timeouts are in milliseconds
exports.CONNECT_TIMEOUT = 6000
exports.SOCKET_TIMEOUT = 10000
exports.HEARTBEAT_INTERVAL_JITTER = 7000
exports.DATACENTER_MAX_DELAY = 5 * 60 * 1000 -- max connection delay
exports.DATACENTER_MAX_DELAY_JITTER = 7000
exports.SRV_RECORD_FAILURE_DELAY = 15 * 1000
exports.SRV_RECORD_FAILURE_DELAY_JITTER = 15 * 1000
exports.DEFAULT_MONITORING_SRV_QUERIES = {
'_monitoring_agent._tcp.lon3.prod.monitoring.api.rackspacecloud.com',
'_monitoring_agent._tcp.ord1.prod.monitoring.api.rackspacecloud.com'
}
if os.type() == 'win32' then
exports.DEFAULT_PERSISTENT_VARIABLE_PATH = './'
else
exports.DEFAULT_PERSISTENT_VARIABLE_PATH = '/var/lib/rackspace-monitoring-agent'
end
-- Custom plugins related settings
exports.DEFAULT_CUSTOM_PLUGINS_PATH = '/usr/lib/rackspace-monitoring-agent/plugins'
exports.DEFAULT_PLUGIN_TIMEOUT = 30 * 1000
exports.PLUGIN_TYPE_MAP = {string = 'string', int = 'int64', float = 'double', gauge = 'gauge'}
return exports
| Change the default custom plugins path to /usr/lib/rackspace-monitoring-agent/plugins. | Change the default custom plugins path to
/usr/lib/rackspace-monitoring-agent/plugins.
| Lua | apache-2.0 | kans/zirgo,kans/zirgo,kans/zirgo |
2a984267c8abc1435901bf713037fd799a3bf726 | term/cursor.lua | term/cursor.lua | -- Copyright (c) 2009 Rob Hoelz <rob@hoelzro.net>
--
-- 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.
local term = require 'term.core'
return {
goto = term.maketermfunc '%d;%dH',
goup = term.maketermfunc '%d;A',
godown = term.maketermfunc '%d;B',
goright = term.maketermfunc '%d;C',
goleft = term.maketermfunc '%d;D',
save = term.maketermfunc 's',
restore = term.maketermfunc 'u',
}
| -- Copyright (c) 2009 Rob Hoelz <rob@hoelzro.net>
--
-- 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.
local term = require 'term.core'
return {
['goto'] = term.maketermfunc '%d;%dH',
goup = term.maketermfunc '%d;A',
godown = term.maketermfunc '%d;B',
goright = term.maketermfunc '%d;C',
goleft = term.maketermfunc '%d;D',
save = term.maketermfunc 's',
restore = term.maketermfunc 'u',
}
| Fix parse error on 5.2 | Fix parse error on 5.2
Better yet would be an alias for the 'goto' function, but that can
be added later.
| Lua | mit | hoelzro/lua-term |
c7e595a9c40490e79cb8c57057c68c98e0bd982c | src/conf.lua | src/conf.lua | function love.conf(t)
t.title = "Journey to the Center of Hawkthorne v0.0.6"
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.7"
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.7 | Bump release version to v0.0.7
| Lua | mit | hawkthorne/hawkthorne-server-lua,hawkthorne/hawkthorne-server-lua,hawkthorne/hawkthorne-client-lua,hawkthorne/hawkthorne-client-lua |
0bd6a3916227608d5a1f952a05e70238de8d79c7 | bin/busted.lua | bin/busted.lua | if ngx ~= nil then
ngx.exit = function()end
end
if os.getenv('CI') == 'true' then
local luacov = require('luacov.runner')
local pwd = os.getenv('PWD')
for _, option in ipairs({"statsfile", "reportfile"}) do
-- properly expand current working dir, workaround for https://github.com/openresty/resty-cli/issues/35
luacov.defaults[option] = pwd .. package.config:sub(1, 1) .. luacov.defaults[option]
end
table.insert(arg, '--coverage')
end
-- Busted command-line runner
require 'busted.runner'({ standalone = false })
| -- Clean warning on openresty 1.15.8.1, where some global variables are set
-- using ngx.timer that triggers an invalid warning message.
-- Code related: https://github.com/openresty/lua-nginx-module/blob/61e4d0aac8974b8fad1b5b93d0d3d694d257d328/src/ngx_http_lua_util.c#L795-L839
getmetatable(_G).__newindex = nil
if ngx ~= nil then
ngx.exit = function()end
end
if os.getenv('CI') == 'true' then
local luacov = require('luacov.runner')
local pwd = os.getenv('PWD')
for _, option in ipairs({"statsfile", "reportfile"}) do
-- properly expand current working dir, workaround for https://github.com/openresty/resty-cli/issues/35
luacov.defaults[option] = pwd .. package.config:sub(1, 1) .. luacov.defaults[option]
end
table.insert(arg, '--coverage')
end
-- Busted command-line runner
require 'busted.runner'({ standalone = false })
| Fix invalid warning message from openresty 1.15.8.1 | Fix invalid warning message from openresty 1.15.8.1
Signed-off-by: Eloy Coto <2a8acc28452926ceac4d9db555411743254cf5f9@gmail.com>
| Lua | mit | 3scale/docker-gateway,3scale/apicast,3scale/apicast,3scale/docker-gateway,3scale/apicast,3scale/apicast |
78a022008cc5f79aa678f58158c4e10c3a445a28 | plugins/mod_motd.lua | plugins/mod_motd.lua | -- Prosody IM
-- Copyright (C) 2008-2010 Matthew Wild
-- Copyright (C) 2008-2010 Waqas Hussain
-- Copyright (C) 2010 Jeff Mitchell
--
-- This project is MIT/X11 licensed. Please see the
-- COPYING file in the source package for more information.
--
local host = module:get_host();
local motd_text = module:get_option("motd_text") or "MOTD: (blank)";
local st = require "util.stanza";
module:hook("resource-bind",
function (event)
local session = event.session;
local motd_stanza =
st.message({ to = session.username..'@'..session.host, from = host })
:tag("body"):text(motd_text);
core_route_stanza(hosts[host], motd_stanza);
module:log("debug", "MOTD send to user %s@%s", session.username, session.host);
end);
| Add motd plugin, giving text to a user on each login. | Add motd plugin, giving text to a user on each login.
| Lua | mit | sarumjanuch/prosody,sarumjanuch/prosody | |
a175f8916d6fd665b8eed0eddf45f39cb8307b9e | premake4.lua | premake4.lua | solution "snowball"
configurations { "Debug-Static", "Release-Static", "Debug-Shared", "Release-Shared" }
project "snowball"
language "C++"
files { "src/*.cc", "src/*.hh", "include/*.h" }
includedirs { "include" }
buildoptions { "-std=c++11", "-stdlib=libc++" }
defines { "SZ_BUILDING" }
flags { "ExtraWarnings" }
configuration "Debug-*"
defines { "DEBUG" }
flags { "Symbols" }
configuration "Release-*"
defines { "NDEBUG" }
flags { "Optimize" }
configuration "*-Static"
kind "StaticLib"
configuration "*-Shared"
kind "SharedLib"
|
solution "snowball"
configurations { "Debug-Static", "Release-Static", "Debug-Shared", "Release-Shared" }
newoption {
trigger = "c++11",
description = "Enables compilation with c++11 -- uses libc++ instead\n"..
" of libstdc++ as the stdlib"
}
project "snowball"
language "C++"
files { "src/*.cc", "src/*.hh", "include/*.h" }
includedirs { "include" }
defines { "SZ_BUILDING" }
flags { "ExtraWarnings" }
configuration "c++11"
buildoptions { "-std=c++11", "-stdlib=libc++" }
configuration "Debug-*"
defines { "DEBUG" }
flags { "Symbols" }
configuration "Release-*"
defines { "NDEBUG" }
flags { "Optimize" }
configuration "*-Static"
kind "StaticLib"
configuration "*-Shared"
kind "SharedLib"
| Make C++11 a build option rather than mandatory. For now. | Make C++11 a build option rather than mandatory. For now.
I have a feeling this won't be optional for very long.
| Lua | mit | nilium/libsnowball |
75bc62577134caf49e89d404a42a1c67c0008a8f | examples/perf/upvalues.lua | examples/perf/upvalues.lua |
sum = 0
j = 1000
while (j > 0) do
i = 10000
while (i > 0) do
i = i - 1
sum = sum + 1
end
j = j - 1
end
print (sum)
| Add a test for measuring up-values. | Add a test for measuring up-values.
| Lua | mit | GaloisInc/galua,GaloisInc/galua,GaloisInc/galua,GaloisInc/galua,GaloisInc/galua,GaloisInc/galua | |
19fe051d351495f3835d708bae5a2203b283cb49 | spec/integration_spec.lua | spec/integration_spec.lua | describe('integration', function()
local port = '7070'
local url = 'http://localhost:' .. port
local toboolean = function(value)
return not not value
end
local executeCommand = function(command)
local handle = io.popen(command .. ' ' .. url)
local result = handle:read('*a')
handle:close()
return result
end
it('should return correct headers', function()
local result = executeCommand('curl --head')
local isStatusOk = toboolean(result:match('HTTP/1.1 200 OK'))
local isContentTypeOk = toboolean(result:match('Content%-Type: text%/html'))
local isContentLengthOk = toboolean(result:match('Content%-Length: 16'))
assert.is_true(isStatusOk)
assert.is_true(isContentTypeOk)
assert.is_true(isContentLengthOk)
end)
it('should return correct body', function()
local result = executeCommand('curl')
local isBodyOk = toboolean(result:match('Hello, Pegasus'))
assert.is_true(isBodyOk)
end)
end)
| describe('integration', function()
local port = '7070'
local url = 'http://localhost:' .. port
local toboolean = function(value)
return not not value
end
local executeCommand = function(command)
local handle = io.popen(command .. ' -s ' .. url)
local result = handle:read('*a')
handle:close()
return result
end
it('should return correct headers', function()
local result = executeCommand('curl --head')
local isStatusOk = toboolean(result:match('HTTP/1.1 200 OK'))
local isContentTypeOk = toboolean(result:match('Content%-Type: text%/html'))
local isContentLengthOk = toboolean(result:match('Content%-Length: 16'))
assert.is_true(isStatusOk)
assert.is_true(isContentTypeOk)
assert.is_true(isContentLengthOk)
end)
it('should return correct body', function()
local result = executeCommand('curl')
local isBodyOk = toboolean(result:match('Hello, Pegasus'))
assert.is_true(isBodyOk)
end)
end)
| Use silence mode for curl calling | Use silence mode for curl calling
| Lua | mit | EvandroLG/pegasus.lua |
d62e2c7a4e27d083b06d22742a84e1c0bcfa5628 | resources/cleanup.lua | resources/cleanup.lua | -- Lua script used to clean up tabs and spaces in C, CPP and H files.
-- Copyright (c) 2014, bel
-- MIT License (http://opensource.org/licenses/mit-license.php)
--
-- It can be used from the command line:
-- Call Lua5.1 or Lua5.2 + this script file + the C/CPP/H file to clean
--
-- It can be used in Visual Studio as an external tool:
-- command: Lua5.1.exe or Lua5.2.exe
-- argument: "X:\civetweb\resources\cleanup.lua" $(ItemPath)
--
clean = arg[1]
print("Cleaning " .. clean)
lines = io.lines(clean)
if not lines then
print("Can not open file " .. clean)
return
end
function trimright(s)
return s:match "^(.-)%s*$"
end
local lineend = false
local tabspace = false
local changed = false
local invalid = false
local newfile = {}
for l in lines do
local lt = trimright(l)
if (lt ~= l) then
lineend = true
changed = true
end
local lts = lt:gsub('\t', ' ')
if (lts ~= lt) then
tabspace = true
changed = true
end
for i=1,#lts do
local b = string.byte(lts,i)
if b<32 or b>=127 then
print("Letter " .. string.byte(l,i) .. " (" .. b .. ") found in line " .. lts)
invalid = true
end
end
newfile[#newfile + 1] = lts
end
print("Line endings trimmed: " .. tostring(lineend))
print("Tabs converted to spaces: " .. tostring(tabspace))
print("Invalid characters: " .. tostring(invalid))
if changed then
local f = io.open(clean, "w")
for i=1,#newfile do
f:write(newfile[i])
f:write("\n")
end
f:close()
print("File cleaned")
end
| Add a script to clean up tabs and spaces in the code files | Add a script to clean up tabs and spaces in the code files
| Lua | mit | GerHobbelt/civet-webserver,GerHobbelt/civet-webserver,GerHobbelt/civet-webserver,GerHobbelt/civet-webserver,GerHobbelt/civet-webserver,GerHobbelt/civet-webserver | |
8c8aa70ce94b53903acccb4b81ab41f768f75e76 | src/conf.lua | src/conf.lua | function love.conf(t)
t.title = "Journey to the Center of Hawkthorne v0.0.3"
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.4"
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.4 | Bump release version to v0.0.4
| Lua | mit | hawkthorne/hawkthorne-client-lua,hawkthorne/hawkthorne-client-lua,hawkthorne/hawkthorne-server-lua,hawkthorne/hawkthorne-server-lua |
a25509fe16469264d753c19974b640a41ef7ff8f | core/componentmanager.lua | core/componentmanager.lua |
local log = require "util.logger".init("componentmanager")
local jid_split = require "util.jid".split;
local hosts = hosts;
local components = {};
module "componentmanager"
function handle_stanza(origin, stanza)
local node, host = jid_split(stanza.attr.to);
local component = components[host];
if not component then component = components[node.."@"..host]; end -- hack to allow hooking node@server
if not component then component = components[stanza.attr.to]; end -- hack to allow hooking node@server/resource and server/resource
if component then
log("debug", "stanza being handled by component: "..host);
component(origin, stanza, hosts[host]);
else
log("error", "Component manager recieved a stanza for a non-existing component: " .. stanza.attr.to);
end
end
function register_component(host, component)
if not hosts[host] then
-- TODO check for host well-formedness
components[host] = component;
hosts[host] = {type = "component", host = host, connected = true, s2sout = {} };
log("debug", "component added: "..host);
else
log("error", "Attempt to set component for existing host: "..host);
end
end
return _M;
|
local log = require "util.logger".init("componentmanager")
local jid_split = require "util.jid".split;
local hosts = hosts;
local components = {};
module "componentmanager"
function handle_stanza(origin, stanza)
local node, host = jid_split(stanza.attr.to);
local component = components[host];
if not component then component = components[node.."@"..host]; end -- hack to allow hooking node@server
if not component then component = components[stanza.attr.to]; end -- hack to allow hooking node@server/resource and server/resource
if component then
log("debug", "stanza being handled by component: "..host);
component(origin, stanza, hosts[host]);
else
log("error", "Component manager recieved a stanza for a non-existing component: " .. stanza.attr.to);
end
end
function register_component(host, component)
if not hosts[host] then
-- TODO check for host well-formedness
components[host] = component;
hosts[host] = {type = "component", host = host, connected = true, s2sout = {} };
log("debug", "component added: "..host);
return hosts[host];
else
log("error", "Attempt to set component for existing host: "..host);
end
end
return _M;
| Return registered host table when registering a component | Return registered host table when registering a component
| Lua | mit | sarumjanuch/prosody,sarumjanuch/prosody |
f9ffcdd71b449795f4393163abf4eedcfdd97646 | src/Editor/Editor.Client/Editor.Client.lua | src/Editor/Editor.Client/Editor.Client.lua | EditorClient = {}
EditorClient.name = "Editor.Client"
project "Editor.Client"
kind "SharedLib"
language "C#"
prebuildcommands
{
--"luac -o "
}
location "."
files
{
"Editor.Client.lua",
"**.cs",
}
links {
"System",
"Editor.Shared",
"System.ComponentModel",
"System.ComponentModel.Composition",
"GUI"
} | EditorClient = {}
EditorClient.name = "Editor.Client"
project "Editor.Client"
kind "SharedLib"
language "C#"
location "."
files
{
"Editor.Client.lua",
"**.cs",
}
links
{
"System",
"System.ComponentModel",
"System.ComponentModel.Composition",
"Editor.Shared",
"Editor.Server",
"GUI"
} | Clean up the Editor client build file and add some missing links. | Clean up the Editor client build file and add some missing links.
| Lua | bsd-2-clause | FloodProject/flood,FloodProject/flood,FloodProject/flood |
deee48ea5b3c11c38ce4c0c2104ab1b9814cca47 | lua/engine/gl.lua | lua/engine/gl.lua | local fileutil = require 'engine.fileutil'
local ffi = require 'ffi'
require 'engine.gl_h'
-- return ffi.load(ffi.os == 'OSX' and 'OpenGL.framework/OpenGL' or 'GL')
return ffi.load(fileutil.getModulePath('gl3w'))
| local fileutil = require 'engine.fileutil'
local ffi = require 'ffi'
require 'engine.gl_h'
-- return ffi.load(ffi.os == 'OSX' and 'OpenGL.framework/OpenGL' or 'GL')
local bind = ffi.load(fileutil.getModulePath('gl3w'))
local mt = {
__index = bind
}
local mod = {}
setmetatable(mod,mt)
function mod.createShader(source, type)
local buf = ffi.new('char[?]', #source, source)
local pbuf = ffi.new('const char*[1]', buf)
local shader = bind.glCreateShader(type)
bind.glShaderSource(shader, 1, pbuf, nil)
bind.glCompileShader(shader)
-- Checking if a shader compiled successfully
local status = ffi.new('GLint[1]',0)
bind.glGetShaderiv(shader, bind.GL_COMPILE_STATUS, status)
-- TODO write to logging system instead of stdout
local status = tonumber(status[0])
if status ~= bind.GL_TRUE then
-- Retrieving the compile log
-- TODO get required buffer
local buffer = ffi.new 'char[512]'
bind.glGetShaderInfoLog(shader, 512, nil, buffer)
-- Write error log
print('Compile shader FAILED.')
print(ffi.string(buffer))
end
return shader
end
function mod.createProgram(vert, frag)
local program = bind.glCreateProgram()
local vertexShader = mod.createShader(vert, bind.GL_VERTEX_SHADER)
local fragmentShader = mod.createShader(frag, bind.GL_FRAGMENT_SHADER)
bind.glAttachShader(program, vertexShader)
bind.glAttachShader(program, fragmentShader)
bind.glLinkProgram(program)
local errnum = tonumber(bind.glGetError())
if errnum ~= 0 then
print('Link program FAILED: ', errnum)
end
return program
end
return mod
| Add createShader and createProgram functions | Add createShader and createProgram functions
| Lua | mit | lzubiaur/woot,lzubiaur/woot,lzubiaur/woot,lzubiaur/woot,lzubiaur/woot,lzubiaur/woot,lzubiaur/woot |
a94ae4c8e8479911f266cd9f377eab2bf66436f5 | hammerspoon/init.lua | hammerspoon/init.lua | -- http://www.hammerspoon.org/docs/hs.spotify.html#playpause
-- http://www.hammerspoon.org/go/
-- https://www.hammerspoon.org/docs/hs.keycodes.html
hs.hotkey.bind({"cmd", "alt"}, "home", function()
hs.spotify.playpause()
end)
hs.hotkey.bind({"cmd", "alt"}, "pageup", function()
hs.spotify.previous()
end)
hs.hotkey.bind({"cmd", "alt"}, "pagedown", function()
hs.spotify.next()
end)
| -- http://www.hammerspoon.org/go/
-- https://www.hammerspoon.org/docs/hs.keycodes.html
-- http://www.hammerspoon.org/docs/hs.spotify.html#playpause
--
-- Spotify commands
--
hs.hotkey.bind({"cmd", "ctrl"}, "home", function()
hs.spotify.playpause()
end)
hs.hotkey.bind({"cmd", "ctrl"}, "pageup", function()
hs.spotify.previous()
end)
hs.hotkey.bind({"cmd", "ctrl"}, "pagedown", function()
hs.spotify.next()
end)
hs.hotkey.bind({"cmd", "ctrl"}, "Left", function()
hs.spotify.rw()
end)
hs.hotkey.bind({"cmd", "ctrl"}, "Right", function()
hs.spotify.ff()
end)
--
-- Change Volume commands
--
function changeVolume(diff)
return function()
local current = hs.audiodevice.defaultOutputDevice():volume()
local new = math.min(100, math.max(0, math.floor(current + diff)))
if new > 0 then
hs.audiodevice.defaultOutputDevice():setMuted(false)
end
hs.alert.closeAll(0.0)
hs.alert.show("Volume " .. new .. "%", {}, 0.5)
hs.audiodevice.defaultOutputDevice():setVolume(new)
end
end
hs.hotkey.bind({'cmd', 'ctrl'}, 'Down', changeVolume(-3))
hs.hotkey.bind({'cmd', 'ctrl'}, 'Up', changeVolume(3))
| Update my hammerspoon configs to my latest | Update my hammerspoon configs to my latest
| Lua | mit | andxyz/.dotfiles,andxyz/.dotfiles,andxyz/.dotfiles |
17c8fdb04edfc2b803b1753ff8f6dfad4a114174 | libs/date.lua | libs/date.lua | module(..., package.seeall)
do
local timeTable = {
12 * 30 * 24 * 60 * 60, -- year
30 * 24 * 60 * 60, --month
7 * 24 * 60 * 60, --week
24 * 60 * 60, -- day
60 * 60, -- hour
60, -- minute
1, -- second
}
local timeStrings = {
'years', 'year',
'months', 'month',
'weeks', 'week',
'days', 'day',
'hours', 'hour',
'minutes', 'minute',
'seconds', 'second',
}
function relativeTime(t1,t2, T, L)
if(not t1) then return end
if(not t2) then t2 = os.time() end
if(t2 > t1) then t2, t1 = t1, t2 end
-- Fallbacks
T = T or timeTable
L = L or timeStrings
local out
local diff = t1 - t2
for i=1, #T do
local div = T[i]
local n = math.modf(diff / div)
if(n > 0) then
out = string.format(
'%s%d%s ',
out or '', n, L[(n ~= 1 and i * 2) or (i * 2) - 1])
diff = diff % div
end
end
if(out) then
return out:sub(1, -2)
end
end
end
do
local timeTable = {
7 * 24 * 60 * 60, --week
24 * 60 * 60, -- day
60 * 60, -- hour
60, -- minute
1, -- second
}
local timeStrings = {
'w', 'w', -- weeks, week
'd', 'd', -- days, day
'h', 'h', -- hours, hour
'm', 'm', -- minutes, minute
's', 's', -- seconds, second
}
function relativeTimeShort(t1, t2)
return relativeTime(t1, t2, timeTable, timeStrings)
end
end
| Add a timer library which only does relativeTime and relativeTimeShort | Add a timer library which only does relativeTime and relativeTimeShort
| Lua | mit | haste/ivar2,torhve/ivar2,torhve/ivar2,torhve/ivar2 | |
20e7028bc4ad4c8f31bc341ecb67914566e76110 | test.lua | test.lua | print(package.cpath)
local path_sep = package.config:sub(3,3)
print('path_sep = ', path_sep)
local path_match = "([^" .. path_sep .. "]+)"
print('match = ', path_match)
for path in package.cpath:gmatch(path_match) do
print(path)
end
| Fix LUA_CPATH processing for ffi binding. | Fix LUA_CPATH processing for ffi binding.
| Lua | mit | Neopallium/LuaNativeObjects | |
199020792f98697048e8cd05cf85610f3fea557a | src/cosy/platform.lua | src/cosy/platform.lua | -- Select the platform using the environment.
local global = _ENV or _G
if global.js then
return require "cosy.platform.js"
else
return require "cosy.platform.standalone"
end | -- Select the platform using the environment.
if _G.js then
return require "cosy.platform.js"
else
return require "cosy.platform.standalone"
end | Use only _G to avoid warning by luacheck. | Use only _G to avoid warning by luacheck.
| Lua | mit | CosyVerif/library,CosyVerif/library,CosyVerif/library |
cdf7a57ca13ffacbc03cf4d507570f204195dfd4 | examples/lua/page/main.lua | examples/lua/page/main.lua | local util = require 'util'
local lustache = require 'lustache'
local markdown = require 'markdown'
local fcgi = {}
local actions = {}
local template
function actions.GET(page)
local view = {page = page}
local text = util.read('pages/' .. page .. '.md') or
util.read('pages/404.md')
-- Due to unusual behavior with partials, we render twice
view.body = lustache:render(markdown(text), view)
-- XXX make test case, and file bug report if applicable
return util.response(lustache:render(template, view))
end
function fcgi.start()
template = util.read('layout.html')
return 0
end
function fcgi.accept()
local method = os.getenv('REQUEST_METHOD') or 'GET'
local url = os.getenv('REQUEST_URI') or arg[1]
local parts = util.split(url, '/')
local controller = parts[0]
local page = parts[1]
if not page then
page = 'home'
end
if not actions[method] or not controller then
page = '404'
method = 'GET'
end
return actions[method](page)
end
-- comment out in when running as fcgi
fcgi.start()
print(fcgi.accept())
--
return fcgi
| local util = require 'util'
local lustache = require 'lustache'
local markdown = require 'markdown'
local fcgi = {}
local actions = {}
local template
function actions.GET(page)
local view = {page = page}
local text = util.read('pages/' .. page .. '.md') or
util.read('pages/404.md')
-- Due to unusual behavior with partials, we render twice
view.body = lustache:render(markdown(text), view)
-- XXX make test case, and file bug report if applicable
return util.response(lustache:render(template, view))
end
function fcgi.start()
template = util.read('layout.html')
return 0
end
function fcgi.accept()
local method = os.getenv('REQUEST_METHOD') or 'GET'
local url = os.getenv('REQUEST_URI') or arg[1]
local parts = util.split(url, '/')
local controller = parts[0]
local page = parts[1]
if not page then
page = 'home'
end
if not actions[method] or not controller then
page = '404'
method = 'GET'
end
return actions[method](page)
end
-- uncomment when testing or running as CGI
-- fcgi.start()
-- print(fcgi.accept())
--
return fcgi
| Fix comment and test block | Fix comment and test block
| Lua | bsd-3-clause | TravisPaul/lua-simple-fcgi |
2891d0fc9006b1f67dacc8533d677448d973e0cf | nvim/lua/plugin/treesitter.lua | nvim/lua/plugin/treesitter.lua | require('nvim-treesitter.configs').setup {
ensure_installed = 'maintained',
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
},
}
| require('nvim-treesitter.configs').setup {
ensure_installed = 'all',
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
},
}
| Install all tree sitter parsers | Install all tree sitter parsers
| Lua | mit | MrPickles/dotfiles |
930e3ad666d31f24ea2bd1028edccd229e0c2f5e | mods/track_players/init.lua | mods/track_players/init.lua | local time_interval = 1.0
local fifo_path = "/tmp/mt_players_fifo"
function players_data()
local ps = {}
for _, player in ipairs(minetest.get_connected_players()) do
local pos = player:getpos()
local pname = player:get_player_name()
local data = {
name = pname,
x = pos.x,
y = pos.y,
z = pos.z }
table.insert(ps, data)
end
if table.getn(ps) == 0 then
return '[]\n'
end
return minetest.write_json(ps) .. '\n'
end
function time_interval_func()
local players = players_data()
local fifo = io.open(fifo_path, 'w')
if (fifo ~= nil) then
fifo:write(players)
fifo:close()
end
minetest.after(time_interval, time_interval_func)
end
minetest.after(time_interval, time_interval_func)
| local time_interval = 300.0
local fifo_path = "/tmp/mt_players_fifo"
function players_data()
local ps = {}
for _, player in ipairs(minetest.get_connected_players()) do
local pos = player:getpos()
local pname = player:get_player_name()
local data = {
name = pname,
x = pos.x,
y = pos.y,
z = pos.z }
table.insert(ps, data)
end
if table.getn(ps) == 0 then
return '[]\n'
end
return minetest.write_json(ps) .. '\n'
end
function time_interval_func()
local players = players_data()
local fifo = io.open(fifo_path, 'w')
if (fifo ~= nil) then
fifo:write(players)
fifo:close()
end
minetest.after(time_interval, time_interval_func)
end
minetest.after(time_interval, time_interval_func)
| Set player position on mapper 5 minutes refresh | Set player position on mapper 5 minutes refresh | Lua | unlicense | crabman77/minetest-minetestforfun-server,MinetestForFun/minetest-minetestforfun-server,sys4-fr/server-minetestforfun,Ombridride/minetest-minetestforfun-server,Ombridride/minetest-minetestforfun-server,Coethium/server-minetestforfun,paly2/minetest-minetestforfun-server,Gael-de-Sailly/minetest-minetestforfun-server,MinetestForFun/server-minetestforfun,paly2/minetest-minetestforfun-server,MinetestForFun/minetest-minetestforfun-server,sys4-fr/server-minetestforfun,sys4-fr/server-minetestforfun,LeMagnesium/minetest-minetestforfun-server,Coethium/server-minetestforfun,LeMagnesium/minetest-minetestforfun-server,Coethium/server-minetestforfun,crabman77/minetest-minetestforfun-server,MinetestForFun/minetest-minetestforfun-server,LeMagnesium/minetest-minetestforfun-server,Gael-de-Sailly/minetest-minetestforfun-server,MinetestForFun/server-minetestforfun,Ombridride/minetest-minetestforfun-server,MinetestForFun/server-minetestforfun,Gael-de-Sailly/minetest-minetestforfun-server,crabman77/minetest-minetestforfun-server |
e26cd9a70f8221478a127256be970bcd1c776177 | examples/text_content.lua | examples/text_content.lua | -- This example prints the plain text contents of a HTML file, excluding
-- the contents of <code> elements. This may be useful for filtering out
-- markup from a HTML document before passing it to a spell-checker or
-- other text processing tool.
local gumbo = require "gumbo"
local document = assert(gumbo.parseFile(arg[1] or io.stdin))
local codeElements = assert(document:getElementsByTagName("code"))
for i, element in ipairs(codeElements) do
element:remove()
end
io.write(document.body.textContent)
| Add an example for extracting the plain text contents of a document | Add an example for extracting the plain text contents of a document
| Lua | apache-2.0 | craigbarnes/lua-gumbo,craigbarnes/lua-gumbo,craigbarnes/lua-gumbo | |
0cc2a6a9f7e653188fcd4dde2f833740b97887fa | 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("tesseract/3.02-r889")
load("java/1.7.0_67")
if (mode() == "load") then
if (not os.getenv("EMOP_HOME")) then
LmodMessage("WARNING: EMOP_HOME is not set.")
else
local emop_home = os.getenv("EMOP_HOME")
pushenv("JUXTA_HOME", pathJoin(emop_home, "lib/juxta-cl"))
pushenv("RETAS_HOME", pathJoin(emop_home, "lib/retas"))
pushenv("SEASR_HOME", pathJoin(emop_home, "lib/seasr"))
pushenv("TESSDATA_PREFIX", "/dh/data/shared/")
pushenv("DENOISE_HOME", pathJoin(emop_home, "lib/denoise"))
end
end
| 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")
if (mode() == "load") then
if (not os.getenv("EMOP_HOME")) then
local cwd = lfs.currentdir()
LmodMessage("WARNING: EMOP_HOME is not set, setting to ", cwd)
pushenv("EMOP_HOME", cwd)
else
local emop_home = os.getenv("EMOP_HOME")
pushenv("JUXTA_HOME", pathJoin(emop_home, "lib/juxta-cl"))
pushenv("RETAS_HOME", pathJoin(emop_home, "lib/retas"))
pushenv("SEASR_HOME", pathJoin(emop_home, "lib/seasr"))
pushenv("TESSDATA_PREFIX", "/dh/data/shared/")
pushenv("DENOISE_HOME", pathJoin(emop_home, "lib/denoise"))
end
end
| Set EMOP_HOME to current working directory if unset, still issue warning | Set EMOP_HOME to current working directory if unset, still issue warning
| Lua | apache-2.0 | Early-Modern-OCR/hOCR-De-Noising |
ea506f853a4cf03d9fd28cd615b523d441298c07 | src_trunk/resources/realism-system/s_alarm.lua | src_trunk/resources/realism-system/s_alarm.lua | function pickLock(thePlayer)
if(isVehicleLocked(source))then
CarAlarm(source, thePlayer)
end
end
addEventHandler("onVehicleStartEnter", getRootElement(), pickLock)
function CarAlarm(theVehicle, thePlayer)
if ( getVehicleOverrideLights ( theVehicle ) ~= 2 ) then -- if the current state isn't 'force on'
setVehicleOverrideLights ( theVehicle, 2 ) -- force the lights on
else
setVehicleOverrideLights ( theVehicle, 1 ) -- otherwise, force the lights off
end
local carX, carY, carZ = getElementPosition( theVehicle )
local alarmSphere = createColSphere( carX, carY, carZ, 200 )
exports.pool:allocateElement(alarmSphere) -- Create the colSphere for chat output to local players
local targetPlayers = getElementsWithinColShape( alarmSphere, "player" )
for i, key in ipairs( targetPlayers ) do
playSoundFrontEnd(key, 2)
end
destroyElement (alarmSphere)
end
| function pickLock(thePlayer)
if(isVehicleLocked(source))then
--CarAlarm(source, thePlayer)
setTimer(CarAlarm, 1000, 20, source, thePlayer)
end
end
addEventHandler("onVehicleStartEnter", getRootElement(), pickLock)
function CarAlarm(theVehicle, thePlayer)
if ( getVehicleOverrideLights ( theVehicle ) ~= 2 ) then -- if the current state isn't 'force on'
setVehicleOverrideLights ( theVehicle, 2 ) -- force the lights on
else
setVehicleOverrideLights ( theVehicle, 1 ) -- otherwise, force the lights off
end
local carX, carY, carZ = getElementPosition( theVehicle )
local alarmSphere = createColSphere( carX, carY, carZ, 200 )
exports.pool:allocateElement(alarmSphere) -- Create the colSphere for chat output to local players
local targetPlayers = getElementsWithinColShape( alarmSphere, "player" )
for i, key in ipairs( targetPlayers ) do
playSoundFrontEnd(key, 2)
end
destroyElement (alarmSphere)
end
| Fix for car alarms v2 | Fix for car alarms v2
git-svn-id: 8769cb08482c9977c94b72b8e184ec7d2197f4f7@506 64450a49-1f69-0410-a0a2-f5ebb52c4f5b
| Lua | bsd-3-clause | valhallaGaming/uno,valhallaGaming/uno,valhallaGaming/uno |
3fdfd2836e0efe3b6bebf7e72e8ec7a3379e81be | Modules/qSystems/ValueObject.lua | Modules/qSystems/ValueObject.lua | local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")
local NevermoreEngine = require(ReplicatedStorage:WaitForChild("NevermoreEngine"))
local LoadCustomLibrary = NevermoreEngine.LoadLibrary
local Signal = LoadCustomLibrary("Signal")
-- @author Quenty
-- Intent: To work like value objects in ROBLOX and track a single item,
-- with .Changed events
local ValueObject = {}
ValueObject.ClassName = "ValueObject"
function ValueObject.new()
local self = setmetatable({}, ValueObject)
self.Changed = Signal.new() -- :fire(NewValue, OldValue)
return self
end
function ValueObject:__index(Index)
if Index == "Value" then
return self._Value
elseif Index == "_Value" then
return nil -- Edge case.
elseif ValueObject[Index] then
return ValueObject[Index]
else
error("'" .. tostring(Index) .. "' is not a member of ValueObject")
end
end
function ValueObject:__newindex(Index, Value)
if Index == "Value" then
if self.Value ~= Value then
local Old = self.Value
self._Value = Value
self.Changed:fire(Value, Old)
end
elseif Index == "_Value" then
rawset(self, Index, Value)
elseif Index == "Changed" then
rawset(self, Index, Value)
else
error("'" .. tostring(Index) .. "' is not a member of ValueObject")
end
end
return ValueObject | Add new value object, which is useful generic implentation of ROBLOX value objects, for tracking changes. | Add new value object, which is useful generic implentation of ROBLOX value objects, for tracking changes.
| Lua | mit | Quenty/NevermoreEngine,Quenty/NevermoreEngine,Quenty/NevermoreEngine | |
7dd487127e3b33f365dde5d0ab56f6fa61b81d9c | 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.event.newKeyEvent(modifiers, key, true):post()
hs.eventtap.event.newKeyEvent(modifiers, key, false):post()
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('control-escape')
require('delete-words')
require('hyper')
require('markdown')
require('panes')
require('super')
require('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('control-escape')
require('delete-words')
require('hyper')
require('markdown')
require('panes')
require('super')
require('windows')
hs.notify.new({title='Hammerspoon', informativeText='Ready to rock 🤘'}):send()
| Use Hammerspoon's top-level API for emitting keystroke | Use Hammerspoon's top-level API for emitting keystroke
We don't seem to be getting any benefit from using the lower-level
approach, so let's switch to using hs.eventtap.keyStroke.
| Lua | mit | jasonrudolph/keyboard,jasonrudolph/keyboard |
786c9c5dfdbdf06c8df1f2ec5ec47a49bf9d9d8c | gumbo/element.lua | gumbo/element.lua | local Element = {}
Element.__index = Element
local function attr_next(attrs, i)
local j = i + 1
local a = attrs[j]
if a then
return j, a.name, a.value, a.namespace, a.line, a.column, a.offset
end
end
function Element:attr_iter()
return attr_next, self.attr or {}, 0
end
function Element:attr_iter_sorted()
local attrs = self.attr
if not attrs then return function() return nil end end
local copy = {}
for i = 1, #attrs do
local attr = attrs[i]
copy[i] = {
name = attr.name,
value = attr.value,
namespace = attr.namespace
}
end
table.sort(copy, function(a, b)
return a.name < b.name
end)
return attr_next, copy, 0
end
return Element
| local yield = coroutine.yield
local wrap = coroutine.wrap
local sort = table.sort
local Element = {}
Element.__index = Element
local function attr_yield(attrs)
for i = 1, #attrs do
local a = attrs[i]
yield(i, a.name, a.value, a.namespace, a.line, a.column, a.offset)
end
end
function Element:attr_iter()
return wrap(function() attr_yield(self.attr) end)
end
function Element:attr_iter_sorted()
local attrs = self.attr
if not attrs then return function() return nil end end
local copy = {}
for i = 1, #attrs do
local attr = attrs[i]
copy[i] = {
name = attr.name,
value = attr.value,
namespace = attr.namespace
}
end
sort(copy, function(a, b)
return a.name < b.name
end)
return wrap(function() attr_yield(copy) end)
end
return Element
| Use coroutines for attribute iterators | Use coroutines for attribute iterators
| Lua | apache-2.0 | craigbarnes/lua-gumbo,craigbarnes/lua-gumbo,craigbarnes/lua-gumbo |
4545d94050523ebb2aea015cd3b3b1754e6b9081 | durden/firstrun.lua | durden/firstrun.lua | meta_guard_reset(true)
-- normally, add would query for a bind, don't want that to happen
dispatch_bindtarget("/target/window/destroy");
dispatch_symbol("/global/settings/titlebar/buttons/left/add=icon_destroy");
dispatch_bindtarget("/target/window/minimize");
dispatch_symbol("/global/settings/titlebar/buttons/left/add_float=icon_minimize");
dispatch_bindtarget("/target/window/move_resize/maximize");
dispatch_symbol("/global/settings/titlebar/buttons/left/add_float=icon_maximize");
-- terminal icon with a popup that also allows access to other menus
dispatch_bindtarget("/global/open/terminal");
dispatch_symbol("/global/settings/statusbar/buttons/left/add=icon_cli");
dispatch_bindtarget("/global/tools/popup/menu=/menus/cli_icon");
dispatch_symbol("/global/settings/statusbar/buttons/left/extend/alternate_click/1");
-- when this feature is more refined, everything above can be moved /
-- pushed to the scheme / profile being picked
dispatch_symbol("/global/settings/tools/profile_picker");
| meta_guard_reset(true)
-- normally, add would query for a bind, don't want that to happen
dispatch_bindtarget("/target/window/destroy");
dispatch_symbol("/global/settings/titlebar/buttons/left/add=icon_destroy");
dispatch_bindtarget("/target/window/minimize");
dispatch_symbol("/global/settings/titlebar/buttons/left/add_float=icon_minimize");
dispatch_bindtarget("/target/window/move_resize/maximize");
dispatch_symbol("/global/settings/titlebar/buttons/left/add_float=icon_maximize");
dispatch_bindtarget("/global");
dispatch_symbol("/global/settings/statusbar/buttons/left/add=Go");
-- terminal icon with a popup that also allows access to other menus
dispatch_bindtarget("/global/open/terminal");
dispatch_symbol("/global/settings/statusbar/buttons/left/add=icon_cli");
dispatch_bindtarget("/global/tools/popup/menu=/menus/cli_icon");
dispatch_symbol("/global/settings/statusbar/buttons/left/extend/alternate_click/1");
-- when this feature is more refined, everything above can be moved /
-- pushed to the scheme / profile being picked
-- dispatch_symbol("/global/settings/tools/profile_picker");
| Add 'go' button by default | Add 'go' button by default
Both this one and the dynamic display ones should have real icons
from say, fontawesome or so - placeholder for now.
| Lua | bsd-3-clause | letoram/durden |
6569da5fc37cc7eee14f9da43782c0b3890441b6 | lua/rw.lua | lua/rw.lua | local profiler = false
if profiler then
profiler = require "profiler"
profiler:start()
end
local Cosy = require "cosy.cosy"
local model = Cosy.root ["cosyverif.io/model"]
local max_i = 10
local max_j = 10
local max_k = 10
local max_l = 10
local schemes = {}
local scheme
schemes.nested_writes = function ()
scheme = "nested writes"
for i = 1, max_i do
local di = model [i]
for j = 1, max_j do
local dj = di [j]
for k = 1, max_k do
local dk = dj [k]
for l = 1, max_l do
local dl = dk [l]
dl.x = i + j + k + l
end
end
end
end
end
schemes.flat_writes = function ()
scheme = "flat writes"
for i = 1, max_i * max_j * max_k * max_l do
model [i] = i
end
end
schemes.flat_read_writes = function ()
scheme = "flat read / write"
model [0] = 1
for i = 1, max_i * max_j * max_k * max_l do
model [i] = model [i-1] ()
end
end
local arg = arg or {}
local scheme_key = arg [1]
if not scheme_key then
scheme_key = "flat_read_writes"
end
print ("scheme: " .. scheme_key)
local f = schemes [scheme_key]
if not f then
print ("Unknown scheme.")
print ("Available schemes:")
for k in pairs (schemes) do
print (" " .. k)
end
os.exit (2)
end
local start = os.time ()
f ()
local finish = os.time ()
if profiler then
profiler:stop()
profiler:writeReport("profiler.txt")
end
collectgarbage ()
print ("Scheme : " .. scheme .. ".")
local duration = finish - start
print ("Time : " .. tostring (duration) .. " seconds.")
local memory = math.ceil (collectgarbage ("count")/1024)
print ("Memory : " .. tostring (memory) .. " Mbytes.")
local count = max_i * max_j * max_k * max_l
print ("Performed : " .. tostring (count) .. " writes.")
local average_time = math.floor (count / duration)
print ("Average time : " .. tostring (average_time) .. " writes / second.")
local average_memory = math.floor (memory*1024*1024 / count)
print ("Average memory : " .. tostring (average_memory) .. " bytes / object.")
| Add example that does a lot of writes. | Add example that does a lot of writes.
| Lua | mit | CosyVerif/webclient,CosyVerif/webclient | |
be6c9cbbe6e4c1d08ba78710c4c37313dfe9a558 | hammerspoon/.hammerspoon/init.lua | hammerspoon/.hammerspoon/init.lua | --
-- Config to send escape on short ctrl press
--
-- Source: https://gist.github.com/arbelt/b91e1f38a0880afb316dd5b5732759f1
--
ctrl_table = {
sends_escape = true,
last_mods = {}
}
control_key_timer = hs.timer.delayed.new(0.15, function()
ctrl_table["send_escape"] = false
-- log.i("timer fired")
-- control_key_timer:stop()
end
)
last_mods = {}
control_handler = function(evt)
local new_mods = evt:getFlags()
if last_mods["ctrl"] == new_mods["ctrl"] then
return false
end
if not last_mods["ctrl"] then
-- log.i("control pressed")
last_mods = new_mods
ctrl_table["send_escape"] = true
-- log.i("starting timer")
control_key_timer:start()
else
-- log.i("contrtol released")
-- log.i(ctrl_table["send_escape"])
if ctrl_table["send_escape"] then
-- log.i("send escape key...")
hs.eventtap.keyStroke({}, "ESCAPE")
end
last_mods = new_mods
control_key_timer:stop()
end
return false
end
control_tap = hs.eventtap.new({12}, control_handler)
control_tap:start()
| Use Hammerspoon to fix my caps lock mappings | Use Hammerspoon to fix my caps lock mappings
This is supposed to address the issue I had after upgrade to Sierra
(which breaks Karabiner).
Credits & thanks to: @arbelt
| Lua | mit | pch/dotfiles,pch/dotfiles | |
d74eae8faee15255ca66ca4b803312afe966acc4 | src/cancellabledelay/src/Shared/cancellableDelay.lua | src/cancellabledelay/src/Shared/cancellableDelay.lua | --[=[
A version of task.delay that can be cancelled. Soon to be useless.
@class cancellableDelay
]=]
--[=[
@function cancellableDelay
@param timeoutInSeconds number
@param func function
@param ... any -- Args to pass into the function
@return function? -- Can be used to cancel
@within cancellableDelay
]=]
local function cancellableDelay(timeoutInSeconds, func, ...)
assert(type(timeoutInSeconds) == "number", "Bad timeoutInSeconds")
assert(type(func) == "function", "Bad func")
local args = table.pack(...)
local running
task.spawn(function()
running = coroutine.running()
task.wait(timeoutInSeconds)
func(table.unpack(args, 1, args.n))
end)
return function()
if running then
-- selene: allow(incorrect_standard_library_use)
coroutine.close(running)
running = nil
args = nil
end
end
end
return cancellableDelay | --[=[
A version of task.delay that can be cancelled. Soon to be useless.
@class cancellableDelay
]=]
--[=[
@function cancellableDelay
@param timeoutInSeconds number
@param func function
@param ... any -- Args to pass into the function
@return function? -- Can be used to cancel
@within cancellableDelay
]=]
local function cancellableDelay(timeoutInSeconds, func, ...)
assert(type(timeoutInSeconds) == "number", "Bad timeoutInSeconds")
assert(type(func) == "function", "Bad func")
local args = table.pack(...)
local running
task.spawn(function()
running = coroutine.running()
task.wait(timeoutInSeconds)
local localArgs = args
running = nil
args = nil
func(table.unpack(localArgs, 1, localArgs.n))
end)
return function()
if running then
-- selene: allow(incorrect_standard_library_use)
coroutine.close(running)
running = nil
args = nil
end
end
end
return cancellableDelay | Fix cancellation occuring when the resulting task yields | fix: Fix cancellation occuring when the resulting task yields
| Lua | mit | Quenty/NevermoreEngine,Quenty/NevermoreEngine,Quenty/NevermoreEngine |
9e34e514c4b747655eb0411956cbc13b1a851663 | Modules/Client/MouseShiftLock/MouseShiftLockService.lua | Modules/Client/MouseShiftLock/MouseShiftLockService.lua | ---
-- @module MouseShiftLockService
-- See: https://devforum.roblox.com/t/custom-center-locked-mouse-camera-control-toggle/205323
local require = require(game:GetService("ReplicatedStorage"):WaitForChild("Nevermore"))
local Players = game:GetService("Players")
local Promise = require("Promise")
local MouseShiftLockService = {}
function MouseShiftLockService:Init()
self._enabled = Instance.new("BoolValue")
self._enabled.Value = true
self._promiseReady = Promise.spawn(function(resolve, reject)
local playerScripts = Players.LocalPlayer:WaitForChild("PlayerScripts")
local playerModuleScript = playerScripts:WaitForChild("PlayerModule")
local cameraModuleScript = playerModuleScript:WaitForChild("CameraModule")
local mouseLockControllerScript = cameraModuleScript:WaitForChild("MouseLockController")
self._cursorImage = mouseLockControllerScript:WaitForChild("CursorImage")
self._boundKeys = mouseLockControllerScript:WaitForChild("BoundKeys")
self._lastBoundKeyValues = self._boundKeys.Value
local ok, err = pcall(function()
self._playerModule = require(playerModuleScript)
end)
if not ok then
return reject(err)
end
resolve()
end)
self._promiseReady:Then(function()
self._enabled.Changed:Connect(function()
self:_update()
end)
if not self._enabled.Value then
self:_update()
end
end)
end
function MouseShiftLockService:EnableShiftLock()
self._enabled.Value = true
end
function MouseShiftLockService:DisableShiftLock()
self._enabled.Value = false
end
function MouseShiftLockService:_update()
assert(self._promiseReady:IsFulfilled())
if self._enabled.Value then
self:_updateEnable()
else
self:_updateDisable()
end
end
function MouseShiftLockService:_updateEnable()
local cameras = self._playerModule:GetCameras()
local cameraController = cameras.activeCameraController
self._boundKeys.Value = self._lastBoundKeyValues
if self._wasMouseLockEnabled then
-- Fix icon again
local mouse = Players.LocalPlayer:GetMouse()
mouse.Icon = self._cursorImage.Value
cameraController:SetIsMouseLocked(self._wasMouseLockEnabled)
end
end
function MouseShiftLockService:_updateDisable()
local cameras = self._playerModule:GetCameras()
local cameraController = cameras.activeCameraController
if #self._boundKeys.Value > 0 then
self._lastBoundKeyValues = self._boundKeys.Value
end
self._wasMouseLockEnabled = cameraController:GetIsMouseLocked()
self._boundKeys.Value = ""
cameraController:SetIsMouseLocked(false)
if self._wasMouseLockEnabled then
-- Reset icon because the camera module doesn't do this properly
local mouse = Players.LocalPlayer:GetMouse()
mouse.Icon = ""
end
end
return MouseShiftLockService | Update mouse shift lock service | Update mouse shift lock service
| Lua | mit | Quenty/NevermoreEngine,Quenty/NevermoreEngine,Quenty/NevermoreEngine | |
e3250a65287da963c9a61602e0b1bf39632a8bc7 | compile.lua | compile.lua | --
-- file: compile.lua
--
-- author: Copyright (C) 2014-2015 Kamil Szczygiel http://www.distortec.com http://www.freddiechopin.info
--
-- This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not
-- distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
--
for index, filename in ipairs(tup.glob("*.S")) do
as(filename)
end
for index, filename in ipairs(tup.glob("*.c")) do
cc(filename)
end
for index, filename in ipairs(tup.glob("*.cpp")) do
cxx(filename)
end
| --
-- file: compile.lua
--
-- author: Copyright (C) 2014-2016 Kamil Szczygiel http://www.distortec.com http://www.freddiechopin.info
--
-- This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not
-- distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
--
for index, filename in ipairs(ASSOURCES or tup.glob("*.S")) do
as(filename)
end
for index, filename in ipairs(CSOURCES or tup.glob("*.c")) do
cc(filename)
end
for index, filename in ipairs(CXXSOURCES or tup.glob("*.cpp")) do
cxx(filename)
end
| Make tup compilation more similar to make in regard to selected files | Make tup compilation more similar to make in regard to selected files
If ASSOURCES, CSOURCES or CXXSOURCES is defined, then use these as the
list of files to compile. Otherwise search for all files with proper
extension.
Note that these variables should be tables, not strings. | Lua | mpl-2.0 | CezaryGapinski/distortos,DISTORTEC/distortos,DISTORTEC/distortos,jasmin-j/distortos,CezaryGapinski/distortos,DISTORTEC/distortos,jasmin-j/distortos,CezaryGapinski/distortos,jasmin-j/distortos,CezaryGapinski/distortos,CezaryGapinski/distortos,DISTORTEC/distortos,jasmin-j/distortos,jasmin-j/distortos |
2bccf1a83257b066aea9f2cb888d5b34b7bb755e | 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
| 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 | |
f16703958284eaf7b1873d1cdad7f5deec99129e | extensions/base64/init.lua | extensions/base64/init.lua | --- === hs.base64 ===
---
--- This module provides base64 encoding and decoding for Hammerspoon.
---
--- Portions sourced from (https://gist.github.com/shpakovski/1902994).
local module = require("hs.base64.internal")
-- private variables and methods -----------------------------------------
-- Public interface ------------------------------------------------------
--- hs.base64.encode(val[,width]) -> str
--- Function
--- Returns the base64 encoding of the string provided, optionally split into lines of `width` characters per line. Common widths seem to be 64 and 76 characters per line (except for the last line, which may be less), but as this is not standard or even required in all cases, we allow an arbitrary number to be chosen to fit your application's requirements.
module.encode = function(data, width)
local _data = module._encode(data)
if width then
local _hold, i, j = _data, 1, width
_data = ""
repeat
_data = _data.._hold:sub(i,j).."\n"
i = i + width
j = j + width
until i > #_hold
end
return _data:sub(1,#_data - 1)
end
--- hs.base64.decode(str) -> val
--- Function
--- Returns a Lua string representing the given base64 string.
module.decode = function(data)
return module._decode(data:gsub("[\r\n]+",""))
end
-- Return Module Object --------------------------------------------------
return module
| --- === hs.base64 ===
---
--- This module provides base64 encoding and decoding for Hammerspoon.
---
--- Portions sourced from (https://gist.github.com/shpakovski/1902994).
local module = require("hs.base64.internal")
-- private variables and methods -----------------------------------------
-- Public interface ------------------------------------------------------
--- hs.base64.encode(val[,width]) -> str
--- Function
--- Encodes a given string to base64
---
--- Parameters:
--- * val - A string to encode as base64
--- * width - Optional line width to split the string into (usually 64 or 76)
---
--- Returns:
--- * A string containing the base64 representation of the input string
module.encode = function(data, width)
local _data = module._encode(data)
if width then
local _hold, i, j = _data, 1, width
_data = ""
repeat
_data = _data.._hold:sub(i,j).."\n"
i = i + width
j = j + width
until i > #_hold
end
return _data:sub(1,#_data - 1)
end
--- hs.base64.decode(str) -> val
--- Function
--- Decodes a given base64 string
---
--- Parameters:
--- * str - A base64 encoded string
---
--- Returns:
--- * A string containing the decoded data
module.decode = function(data)
return module._decode(data:gsub("[\r\n]+",""))
end
-- Return Module Object --------------------------------------------------
return module
| Update hs.base64 to new docstrings format | Update hs.base64 to new docstrings format
| Lua | mit | peterhajas/hammerspoon,peterhajas/hammerspoon,hypebeast/hammerspoon,emoses/hammerspoon,latenitefilms/hammerspoon,wsmith323/hammerspoon,tmandry/hammerspoon,heptal/hammerspoon,hypebeast/hammerspoon,asmagill/hammerspoon,knl/hammerspoon,emoses/hammerspoon,dopcn/hammerspoon,Stimim/hammerspoon,CommandPost/CommandPost-App,bradparks/hammerspoon,hypebeast/hammerspoon,TimVonsee/hammerspoon,chrisjbray/hammerspoon,knl/hammerspoon,junkblocker/hammerspoon,ocurr/hammerspoon,lowne/hammerspoon,Habbie/hammerspoon,Hammerspoon/hammerspoon,emoses/hammerspoon,latenitefilms/hammerspoon,junkblocker/hammerspoon,trishume/hammerspoon,Hammerspoon/hammerspoon,Hammerspoon/hammerspoon,asmagill/hammerspoon,zzamboni/hammerspoon,lowne/hammerspoon,CommandPost/CommandPost-App,wsmith323/hammerspoon,TimVonsee/hammerspoon,knu/hammerspoon,Habbie/hammerspoon,chrisjbray/hammerspoon,ocurr/hammerspoon,trishume/hammerspoon,dopcn/hammerspoon,tmandry/hammerspoon,dopcn/hammerspoon,heptal/hammerspoon,peterhajas/hammerspoon,latenitefilms/hammerspoon,joehanchoi/hammerspoon,CommandPost/CommandPost-App,TimVonsee/hammerspoon,knu/hammerspoon,emoses/hammerspoon,wvierber/hammerspoon,emoses/hammerspoon,zzamboni/hammerspoon,Stimim/hammerspoon,joehanchoi/hammerspoon,knl/hammerspoon,nkgm/hammerspoon,zzamboni/hammerspoon,knu/hammerspoon,Stimim/hammerspoon,knu/hammerspoon,zzamboni/hammerspoon,kkamdooong/hammerspoon,chrisjbray/hammerspoon,kkamdooong/hammerspoon,junkblocker/hammerspoon,ocurr/hammerspoon,TimVonsee/hammerspoon,nkgm/hammerspoon,Stimim/hammerspoon,Habbie/hammerspoon,latenitefilms/hammerspoon,asmagill/hammerspoon,wsmith323/hammerspoon,tmandry/hammerspoon,kkamdooong/hammerspoon,Hammerspoon/hammerspoon,asmagill/hammerspoon,wvierber/hammerspoon,kkamdooong/hammerspoon,junkblocker/hammerspoon,nkgm/hammerspoon,cmsj/hammerspoon,wvierber/hammerspoon,cmsj/hammerspoon,kkamdooong/hammerspoon,joehanchoi/hammerspoon,latenitefilms/hammerspoon,bradparks/hammerspoon,asmagill/hammerspoon,hypebeast/hammerspoon,Habbie/hammerspoon,CommandPost/CommandPost-App,heptal/hammerspoon,wvierber/hammerspoon,cmsj/hammerspoon,cmsj/hammerspoon,lowne/hammerspoon,heptal/hammerspoon,peterhajas/hammerspoon,knl/hammerspoon,chrisjbray/hammerspoon,TimVonsee/hammerspoon,chrisjbray/hammerspoon,knu/hammerspoon,peterhajas/hammerspoon,joehanchoi/hammerspoon,lowne/hammerspoon,ocurr/hammerspoon,zzamboni/hammerspoon,joehanchoi/hammerspoon,dopcn/hammerspoon,CommandPost/CommandPost-App,Stimim/hammerspoon,Habbie/hammerspoon,nkgm/hammerspoon,trishume/hammerspoon,zzamboni/hammerspoon,lowne/hammerspoon,cmsj/hammerspoon,latenitefilms/hammerspoon,junkblocker/hammerspoon,knu/hammerspoon,knl/hammerspoon,Habbie/hammerspoon,Hammerspoon/hammerspoon,bradparks/hammerspoon,Hammerspoon/hammerspoon,hypebeast/hammerspoon,nkgm/hammerspoon,ocurr/hammerspoon,bradparks/hammerspoon,wsmith323/hammerspoon,bradparks/hammerspoon,CommandPost/CommandPost-App,heptal/hammerspoon,dopcn/hammerspoon,cmsj/hammerspoon,chrisjbray/hammerspoon,asmagill/hammerspoon,wsmith323/hammerspoon,wvierber/hammerspoon |
15bc07a7db1358150a48c780e91652dfdf0582a3 | interface/configenv/init.lua | interface/configenv/init.lua | return function(...)
require "configenv.setup" (...)
require "configenv.range" (...)
require "configenv.util" (...)
return ...
end
| local _safe_methods = {}
for v in string.gmatch([[
string table math
getmetatable
ipairs next pairs
rawequal rawget rawlen
tonumber tostring type
]], "%S+") do
safeMethods[v] = _G[v]
end
return function(tbl, ...)
require "configenv.setup" (tbl, ...)
require "configenv.range" (tbl, ...)
require "configenv.util" (tbl, ...)
return setmetatable(tbl, { __index = _safe_methods }), ...
end
| Add safe Lua globals to config. | Add safe Lua globals to config. | Lua | mit | dschoeffm/MoonGen,gallenmu/MoonGen,gallenmu/MoonGen,dschoeffm/MoonGen,scholzd/MoonGen,emmericp/MoonGen,gallenmu/MoonGen,gallenmu/MoonGen,emmericp/MoonGen,scholzd/MoonGen,emmericp/MoonGen,gallenmu/MoonGen,gallenmu/MoonGen,gallenmu/MoonGen,gallenmu/MoonGen,dschoeffm/MoonGen,scholzd/MoonGen |
a0f7183d50ee70cc890445b589ad0ab4d6f96226 | website/nginx/lua/access.lua | website/nginx/lua/access.lua | local jwt = require "luajwt"
local auth = ngx.var.authorization
local users = ngx.shared.users
local projects = ngx.shared.projects
local project = ngx.req.project
if (project == nil and (ngx.req.uri ~= '/settings' and ngx.req.uri ~= '/login')) then
ngx.say("invalid")
ngx.exit(406)
end
local val, err = jwt.decode(auth, key, true)
if not val then
return ngx.say("Error:", err)
end
-- val.user
| Add lua code for nginx. | Add lua code for nginx.
| Lua | mit | materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org,materials-commons/materialscommons.org | |
b329c90798322081fa2ed0239f57500f137d6031 | packages/ifattop/init.lua | packages/ifattop/init.lua | local function registerCommands (class)
class:registerCommand("ifattop", function (_, content)
SILE.typesetter:leaveHmode()
if #(SILE.typesetter.state.outputQueue) == 0 then
SILE.process(content)
end
end)
class:registerCommand("ifnotattop", function (_, content)
SILE.typesetter:leaveHmode()
if #(SILE.typesetter.state.outputQueue) ~= 0 then
SILE.process(content)
end
end)
end
return {
registerCommands = registerCommands,
documentation = [[
\begin{document}
This package provides two commands: \autodoc:command{\ifattop} and \autodoc:command{\ifnotattop}.
The argument of the command is processed only if the typesetter is at the top
of a frame or is not at the top of a frame respectively.
\end{document}
]]}
| local base = require("packages.base")
local package = pl.class(base)
package._name = "ifattop"
function package:registerCommands ()
self.class:registerCommand("ifattop", function (_, content)
SILE.typesetter:leaveHmode()
if #(SILE.typesetter.state.outputQueue) == 0 then
SILE.process(content)
end
end)
self.class:registerCommand("ifnotattop", function (_, content)
SILE.typesetter:leaveHmode()
if #(SILE.typesetter.state.outputQueue) ~= 0 then
SILE.process(content)
end
end)
end
package.documentation = [[
\begin{document}
This package provides two commands: \autodoc:command{\ifattop} and \autodoc:command{\ifnotattop}.
The argument of the command is processed only if the typesetter is at the top of a frame or is not at the top of a frame respectively.
\end{document}
]]
return package
| Update ifattop package with new interface | refactor(packages): Update ifattop package with new interface
| Lua | mit | alerque/sile,alerque/sile,alerque/sile,alerque/sile |
f0c542d8ab41406a28f10b80e0df7c9349081e93 | caja/lpr.lua | caja/lpr.lua | #!/usr/local/bin/lua53
local width = 38
local forth = {7, 7, 4, 10, 10}
local function centrado(s)
local m = s:len()
local n = math.floor((width-m)/2 + 0.5) + m
return string.format('%'..n..'s', s)
end
local function campos(w)
local ret = {}
for j,x in ipairs(w) do ret[#ret+1] = string.format('%'..forth[j]..'s',x) end
return table.concat(ret, '')
end
local head = {'',
centrado('FERRETERIA AGUILAR'),
centrado('FERRETERIA Y REFACCIONES EN GENERAL'),
centrado('Benito Jurez 1-C, Ocotln, Oaxaca'),
centrado('Tel. (951) 57-10076'),
centrado(os.date'%FT%TP'),
'',
campos({'CLAVE', 'CNT', '%', 'PRECIO', 'TOTAL'}),
''}
local function procesar(w)
head[#head+1] = w.desc
head[#head+1] = campos(w.clave, w.qty, w[w.precio], w.rea, w[w.unidad], w.subtotal)
end
local function aux()
local QRY = string.format('SELECT * FROM %s WHERE uid = %q')
fd.reduce( tktDB.query(QRY), fd.map(), fd.into, head)
end
local function get(uid)
-- local n = tktDB.count(W, 'WHERE uid' , uid)
-- if n > 0 then end
head[#head+1] = uid
head[#head+1] = centrado'GRACIAS POR SU COMPRA'
end
local cmd, uid = io.read():match'/(%g+)%?(%g+)'
head[1] = centrado(cmd:upper())
get(uid)
print( table.concat(head, '\n') )
| Support for LRP (and netcat) | Support for LRP (and netcat)
| Lua | bsd-2-clause | CAAP/ferre | |
cc91a7e9a3c3a9bd89d766dafd7f8eb5a5ba5029 | src/conf.lua | src/conf.lua | function love.conf(t)
t.title = "Journey to the Center of Hawkthorne v0.0.60"
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.61"
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.61 | Bump release version to v0.0.61
| Lua | mit | hawkthorne/hawkthorne-client-lua,hawkthorne/hawkthorne-client-lua,hawkthorne/hawkthorne-server-lua,hawkthorne/hawkthorne-server-lua |
18ac0a90f841189a5d74664fc722971e050f34c0 | luapress/default_config.lua | luapress/default_config.lua | -- Luapress
-- File: luapress/default_config.lua
-- Desc: the default config we use to generate local config.lua's
local config = {
-- Url
url = nil,
-- Build to this directory
build_dir = 'build',
-- Environments
envs = {
-- Eg:
-- dev = {
-- -- Both optional:
-- url = 'http://localhost',
-- build_dir = 'build'
-- }
},
-- Blog title
title = 'A Lone Ship',
-- Template name
template = 'default',
-- Posts per page
posts_per_page = 5,
-- Separator to replace --MORE-- instances with
more_separator = '',
-- Link directories not files
-- (ie /posts/<name>/index.html over /posts/<name>.html)
link_dirs = true,
-- Generate pages at /page/<name>
pages_dir = 'page',
-- Generate posts at /post/<name>
posts_dir = 'post',
-- Select a page as the landing page (optional, no path or suffix)
-- this will only come into effect if there are no posts (see force_index below).
index_page = nil,
-- Force the above even when there are posts, this disables blog index creation but
-- the archive will still be generated as an index of posts.
force_index_page = false,
-- Change the title of the archive page
archive_title = 'Archive',
-- Select a page to appear on index.html before any posts (optional, no path or suffix)
sticky_page = nil
}
return config
| -- Luapress
-- File: luapress/default_config.lua
-- Desc: the default config we use to generate local config.lua's
local config = {
-- Url
url = nil,
-- Build to this directory
build_dir = 'build',
-- Environments
envs = {
-- Eg:
-- dev = {
-- -- Both optional:
-- url = 'http://localhost',
-- build_dir = 'build'
-- }
},
-- Blog title
title = 'A Lone Ship',
-- Template name
template = 'default',
-- Posts per page
posts_per_page = 5,
-- Separator to replace --MORE-- instances with
more_separator = '',
-- Link directories not files
-- (ie /posts/<name>/index.html over /posts/<name>.html)
link_dirs = true,
-- Generate pages at /pages/<name>
pages_dir = 'pages',
-- Generate posts at /posts/<name>
posts_dir = 'posts',
-- Select a page as the landing page (optional, no path or suffix)
-- this will only come into effect if there are no posts (see force_index below).
index_page = nil,
-- Force the above even when there are posts, this disables blog index creation but
-- the archive will still be generated as an index of posts.
force_index_page = false,
-- Change the title of the archive page
archive_title = 'Archive',
-- Select a page to appear on index.html before any posts (optional, no path or suffix)
sticky_page = nil
}
return config
| Change defaults back to originals (posts/pages) | Change defaults back to originals (posts/pages)
| Lua | mit | w-oertl/Luapress,Fizzadar/Luapress,w-oertl/Luapress,Fizzadar/Luapress |
2fb391f62a07bc91dac2f08e7d9176c964e8f4a2 | tests/sample/shellcode-attack.lua | tests/sample/shellcode-attack.lua | require("proto-ipv4")
require("proto-tcp")
local bindshell = "\xeb\x1f\x5e\x89\x76\x08\x31\xc0\x88\x46\x07\x89\x46\x0c\xb0\x0b" ..
"\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xcd\x80\x31\xdb\x89\xd8\x40\xcd" ..
"\x80\xe8\xdc\xff\xff\xff/bin/sh"
return function (pkt)
local ip_h = ipv4(pkt)
if ip_h and ip_h.proto == 6 then
tcp_h = tcp(ip_h)
if tcp_h and #tcp_h.payload > 0 then
payload = ""
for i = 1, #tcp_h.payload do
payload = payload .. string.format("%c", tcp_h.payload[i])
end
-- printing payload
print(payload)
if(string.find(payload, bindshell)) then
log("filter", "/bin/sh shellcode detected !!!")
return packet.DROP
end
end
end
return packet.ACCEPT
end
| Add shellcode injection attack sample file | Add shellcode injection attack sample file
| Lua | mpl-2.0 | LubyRuffy/haka,haka-security/haka,LubyRuffy/haka,Wingless-Archangel/haka,nabilbendafi/haka,lcheylus/haka,lcheylus/haka,nabilbendafi/haka,nabilbendafi/haka,haka-security/haka,Wingless-Archangel/haka,haka-security/haka,lcheylus/haka | |
613e07e571cdee70b60669109983ab40d5321c51 | binding/lua/util.lua | binding/lua/util.lua | #!/usr/bin/env lua
util = {}
ffi = require('ffi')
function util.cdata2array(cdata, size)
data = torch.Tensor(size)
for i=1, size do
data[i] = cdata[i - 1]
end
return data
end
function util.array2cdata(data, size, cdata_type)
cdata_type = cdata_type or "float[?]"
cdata = ffi.new(cdata_type, size)
for i=1, size do
cdata[i - 1] = data[i]
end
return cdata
end
return util
| #!/usr/bin/env lua
util = {}
ffi = require('ffi')
function util.cdata2array(cdata, size)
data = torch.Tensor(size)
for i=1, size do
data[i] = cdata[i - 1]
end
return data
end
function util.array2cdata(data, size, cdata_type)
cdata_type = cdata_type or "float[?]"
cdata = ffi.new(cdata_type, size)
for i=1, size do
cdata[i - 1] = data[i]
end
return cdata
end
function util.cdata2matrix(data, num_row, num_col)
data = torch.Tensor(num_row, num_col)
for i=1, num_row do
for j=1, num_col do
data[i][j] = cdata[i - 1][j - 1]
end
end
return data
end
function util.matrix2cdata(data, num_row, num_col, cdata_type)
cdata_type = cdata_type or "float*[?]"
cdata = ffi.new(cdata_type, num_row)
for i=1, num_row do
cdata[i - 1] = ffi.new("float[?]", num_col)
for j=1, num_col do
cdata[i - 1][j - 1] = data[i][j]
end
end
return cdata
end
return util
| Add conversion between matrix and cdata. | Add conversion between matrix and cdata.
| Lua | mit | zhengsx/multiverso,zhengsx/multiverso,you-n-g/multiverso,Microsoft/multiverso,you-n-g/multiverso,Microsoft/multiverso,zhengsx/multiverso,liming-vie/multiverso,liming-vie/multiverso,zhengsx/multiverso,Microsoft/multiverso,you-n-g/multiverso,liming-vie/multiverso,liming-vie/multiverso,Microsoft/multiverso,you-n-g/multiverso |
7813362150965aa9c615b8043b800b206957ad1d | nvim/.config/nvim/lua/user/after.lua | nvim/.config/nvim/lua/user/after.lua | local autosave = require("autosave")
local lspconfig = require("lspconfig")
autosave.setup(
{
enabled = true,
}
)
lspconfig.pylsp.setup {}
| local autosave = require("autosave")
local lspconfig = require("lspconfig")
autosave.setup(
{
enabled = true,
}
)
lspconfig.pylsp.setup {}
vim.schedule(function()
vim.env.FZF_DEFAULT_COMMAND = 'fd --hidden --exclude={.git,.idea,.vscode,.sass-cache,node_modules,build} --type f'
end)
| Include hidden files in nvim fzf file search. | Include hidden files in nvim fzf file search.
| Lua | mit | robdimsdale/dotfiles |
967f1eddc8c1186d700f74b117b6568f625b13c0 | src/actions/xcode/xcode.lua | src/actions/xcode/xcode.lua | ---
-- xcode/xcode.lua
-- Common support code for the Apple Xcode exporters.
-- Copyright (c) 2009-2015 Jason Perkins and the Premake project
---
local p = premake
p.modules.xcode = {}
local m = p.modules.xcode
m._VERSION = p._VERSION
m.elements = {}
include("_preload.lua")
include("xcode_common.lua")
include("xcode4_workspace.lua")
include("xcode_project.lua")
return m
| ---
-- xcode/xcode.lua
-- Common support code for the Apple Xcode exporters.
-- Copyright (c) 2009-2015 Jason Perkins and the Premake project
---
local p = premake
p.modules.xcode = {}
local m = p.modules.xcode
m._VERSION = p._VERSION
m.elements = {}
include("xcode_common.lua")
include("xcode4_workspace.lua")
include("xcode_project.lua")
return m
| Fix "name in use" errors from module preload script | Fix "name in use" errors from module preload script
The module preloaded now uses `loadfile()` rather than `include()` in order to report script errors. As a result, the `_preload.lua` file is no longer marked as included, so subsequent calls to `include("_preload.lua")` will result in duplicated symbols.
| Lua | bsd-3-clause | martin-traverse/premake-core,martin-traverse/premake-core,martin-traverse/premake-core,martin-traverse/premake-core |
26afcec76912f88cc25bbeb70a6cc8850d999516 | core/text-output.lua | core/text-output.lua | if (not SILE.outputters) then SILE.outputters = {} end
local outfile
local cursorX = 0
local cursorY = 0
local hboxCount = 0
local writeline = function (...)
local args = table.pack(...)
if hboxCount >= 1 then outfile:write(" ") end
for i=1, #args do
outfile:write(args[i])
if i < #args then outfile:write(" ") end
hboxCount = hboxCount + 1
end
end
SILE.outputters.text = {
init = function()
outfile = io.open(SILE.outputFilename, "w+")
end,
newPage = function()
outfile:write("")
end,
finish = function()
outfile:close()
end,
setColor = function() end,
pushColor = function () end,
popColor = function () end,
outputHbox = function (value)
writeline(value.text)
end,
setFont = function () end,
drawImage = function () end,
imageSize = function () end,
moveTo = function (x, y)
if y > cursorY or x <= cursorX then
outfile:write("\n")
hboxCount = 0
end
cursorY = y
cursorX = x
end,
rule = function () end,
debugFrame = function (_) end,
debugHbox = function() end
}
SILE.outputter = SILE.outputters.text
if not SILE.outputFilename and SILE.masterFilename then
SILE.outputFilename = SILE.masterFilename..".txt"
end
| if (not SILE.outputters) then SILE.outputters = {} end
local outfile
local cursorX = 0
local cursorY = 0
local started = false
local writeline = function (...)
local args = table.pack(...)
for i=1, #args do
outfile:write(args[i])
end
end
SILE.outputters.text = {
init = function()
outfile = io.open(SILE.outputFilename, "w+")
end,
newPage = function()
outfile:write("")
end,
finish = function()
outfile:close()
end,
setColor = function() end,
pushColor = function () end,
popColor = function () end,
outputHbox = function (value, width)
width = SU.cast("number", width)
if width > 0 then
writeline(value.text)
started = true
cursorX = cursorX + width
end
end,
setFont = function () end,
drawImage = function () end,
imageSize = function () end,
moveTo = function (x, y)
if started then
if y > cursorY or x < cursorX then
outfile:write("\n")
elseif x > cursorX then
outfile:write(" ")
end
end
cursorY = y
cursorX = x
end,
rule = function () end,
debugFrame = function (_) end,
debugHbox = function() end
}
SILE.outputter = SILE.outputters.text
if not SILE.outputFilename and SILE.masterFilename then
SILE.outputFilename = SILE.masterFilename..".txt"
end
| Implement cursor tracking to roughly simulate glues | fix(backends): Implement cursor tracking to roughly simulate glues
| Lua | mit | alerque/sile,alerque/sile,alerque/sile,alerque/sile |
9d018485cbc9ed3e33377b59dce9ec423c05abbb | build/scripts/tools/ndk_server.lua | build/scripts/tools/ndk_server.lua | TOOL.Name = "SDKServer"
TOOL.Directory = "../SDK"
TOOL.Kind = "Library"
TOOL.TargetDirectory = "../SDK/lib"
TOOL.Defines = {
"NDK_BUILD",
"NDK_SERVER"
}
TOOL.Includes = {
"../SDK/include",
"../SDK/src"
}
TOOL.Files = {
"../SDK/include/NDK/**.hpp",
"../SDK/include/NDK/**.inl",
"../SDK/src/NDK/**.hpp",
"../SDK/src/NDK/**.inl",
"../SDK/src/NDK/**.cpp"
}
-- Excludes client-only files
TOOL.FilesExcluded = {
"../SDK/**/CameraComponent.*",
"../SDK/**/Console.*",
"../SDK/**/GraphicsComponent.*",
"../SDK/**/LightComponent.*",
"../SDK/**/ListenerComponent.*",
"../SDK/**/ListenerSystem.*",
"../SDK/**/RenderSystem.*",
"../SDK/**/LuaBinding_Audio.*",
"../SDK/**/LuaBinding_Graphics.*",
"../SDK/**/LuaBinding_Renderer.*"
}
TOOL.Libraries = function()
local libraries = {}
for k,v in pairs(NazaraBuild.Modules) do
if (not v.ClientOnly) then
table.insert(libraries, "Nazara" .. v.Name)
end
end
return libraries
end
| TOOL.Name = "SDKServer"
TOOL.Directory = "../SDK"
TOOL.Kind = "Library"
TOOL.TargetDirectory = "../SDK/lib"
TOOL.Defines = {
"NDK_BUILD",
"NDK_SERVER"
}
TOOL.Includes = {
"../SDK/include",
"../SDK/src"
}
TOOL.Files = {
"../SDK/include/NDK/**.hpp",
"../SDK/include/NDK/**.inl",
"../SDK/src/NDK/**.hpp",
"../SDK/src/NDK/**.inl",
"../SDK/src/NDK/**.cpp"
}
-- Excludes client-only files
TOOL.FilesExcluded = {
"../SDK/**/CameraComponent.*",
"../SDK/**/Console.*",
"../SDK/**/GraphicsComponent.*",
"../SDK/**/LightComponent.*",
"../SDK/**/ListenerComponent.*",
"../SDK/**/ListenerSystem.*",
"../SDK/**/RenderSystem.*",
"../SDK/**/LuaBinding_Audio.*",
"../SDK/**/LuaBinding_Graphics.*",
"../SDK/**/LuaBinding_Renderer.*"
}
TOOL.Libraries = {
"NazaraCore",
"NazaraLua",
"NazaraNetwork",
"NazaraNoise",
"NazaraPhysics",
"NazaraUtility"
}
| Fix dependencies, allowing it to exists in server mode | Build/NDKServer: Fix dependencies, allowing it to exists in server mode
Former-commit-id: 8130fc4bd6898f21d08bfad37e3b54676ee34b96 [formerly 9f64adc84777930b63419690bf0e454582989158]
Former-commit-id: 3838886ff2303fe94b69403e1cab51cc4c99a05c | Lua | mit | DigitalPulseSoftware/NazaraEngine |
958cc82bfab8096c5b47aa17836b29f8dc0e48ba | src/conf.lua | src/conf.lua | function love.conf(t)
t.title = "Journey to the Center of Hawkthorne v0.0.28"
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.29"
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.29 | Bump release version to v0.0.29
| Lua | mit | hawkthorne/hawkthorne-server-lua,hawkthorne/hawkthorne-client-lua,hawkthorne/hawkthorne-client-lua,hawkthorne/hawkthorne-server-lua |
a5c7d7a350b6da3eaded0383dcb61518249d8bf5 | lua/main.lua | lua/main.lua | package.path = './lua/?.lua'
local glfw = require 'engine.glfw'()
-- Initialize the library
if glfw.Init() == 0 then
return
end
-- Create a windowed mode window and its OpenGL context
local window = glfw.CreateWindow(640, 480, "Hello World")
if window == 0 then
glfw.Terminate()
return
end
-- Make the window's context current
glfw.MakeContextCurrent(window)
-- Loop until the user closes the window
while glfw.WindowShouldClose(window) == 0 do
-- Render here
-- Swap front and back buffers
glfw.SwapBuffers(window)
-- Poll for and process events
glfw.PollEvents()
end
glfw.Terminate()
| package.path = './lua/?.lua'
local glfw = require 'engine.glfw'()
-- Load and open the LuaFileSystem
-- TODO test on Linux
local path = "../MacOS/liblfs.dylib"
local f = assert(package.loadlib(path, "luaopen_lfs"))
f() -- actually open the library
print(lfs.currentdir())
-- Initialize the library
if glfw.Init() == 0 then
return
end
-- Create a windowed mode window and its OpenGL context
local window = glfw.CreateWindow(640, 480, "Hello World")
if window == 0 then
glfw.Terminate()
return
end
-- Make the window's context current
glfw.MakeContextCurrent(window)
-- Loop until the user closes the window
while glfw.WindowShouldClose(window) == 0 do
-- Render here
-- Swap front and back buffers
glfw.SwapBuffers(window)
-- Poll for and process events
glfw.PollEvents()
end
glfw.Terminate()
| Test loading C lib from Lua | Test loading C lib from Lua
| Lua | mit | lzubiaur/woot,lzubiaur/woot,lzubiaur/woot,lzubiaur/woot,lzubiaur/woot,lzubiaur/woot,lzubiaur/woot |
7626b3bb6a09d99234c44129ab0b90319fe52f31 | src/lfs/variables_build.lua | src/lfs/variables_build.lua | local module = ...
local function build_list(objects)
local out = {}
for key, value in pairs(objects) do
if type(value) == 'table' then
if type(key) == 'string' then
table.insert(out, key .. "=")
end
table.insert(out, "{")
table.insert(out, build_list(value))
table.insert(out, "},")
elseif value == sjson.NULL then
-- skip it
else
table.insert(out, key)
table.insert(out, "=")
if type(value) == 'string' then
table.insert(out, "\"")
table.insert(out, value)
table.insert(out, "\"")
elseif type(value) == 'boolean' then
table.insert(out, tostring(value))
else
table.insert(out, value)
end
table.insert(out, ",")
end
end
return table.concat(out)
end
local function build(objects)
if not objects then return nil end
local out = {}
table.insert(out, "{")
table.insert(out, build_list(objects))
table.insert(out, "}")
return table.concat(out)
end
return function(objects)
package.loaded[module] = nil
module = nil
return build(objects)
end | local module = ...
local function build_list(objects)
local out = {}
for key, value in pairs(objects) do
if type(value) == 'table' then
if type(key) == 'string' then
table.insert(out, key .. "=")
end
table.insert(out, "{")
table.insert(out, build_list(value))
table.insert(out, "},")
elseif value == sjson.NULL or type(value) == "lightfunction" then
-- skip it
else
table.insert(out, key)
table.insert(out, "=")
if type(value) == 'string' then
table.insert(out, "\"")
table.insert(out, value)
table.insert(out, "\"")
elseif type(value) == 'boolean' then
table.insert(out, tostring(value))
else
table.insert(out, value)
end
table.insert(out, ",")
end
end
return table.concat(out)
end
local function build(objects)
if not objects then return nil end
local out = {}
table.insert(out, "{")
table.insert(out, build_list(objects))
table.insert(out, "}")
return table.concat(out)
end
return function(objects)
package.loaded[module] = nil
module = nil
return build(objects)
end | Fix panic when settings value is null. | Fix panic when settings value is null.
This fixes a panic that is triggered when a null value provided in a the settings sent.
In 3.0 if the value in the table is null (without quotes) it returns a "lightfunction" instead of "nil".
This adds a check for this to prevent corrupting the settings table.
| Lua | apache-2.0 | konnected-io/konnected-security,konnected-io/konnected-security |
0a35dec68511d48c97a2a9b422a2f063cfdc8700 | plugin/src/StudioBridge/Main.lua | plugin/src/StudioBridge/Main.lua | local PLUGIN_NAME = "Studio Bridge"
-- Suppresses the "unknown global" warnings.
local plugin = plugin
local toolbar = plugin:CreateToolbar(PLUGIN_NAME)
local function createSyncButton()
local tooltip = "Establishes a connection to the server and starts syncing "..
"changes made on the filesystem."
local icon = "rbxassetid://619356746"
return toolbar:CreateButton("Sync", tooltip, icon)
end
local function createOptionsButton()
local tooltip = ("Configure options for %s."):format(PLUGIN_NAME)
local icon = "rbxassetid://619383224"
return toolbar:CreateButton("Settings", tooltip, icon)
end
createSyncButton()
createOptionsButton()
| local PLUGIN_NAME = "Studio Bridge"
--------------------------------------------------------------------------------
-- Plugin Setup
--------------------------------------------------------------------------------
-- Suppresses the "unknown global" warnings.
local plugin = plugin
local toolbar = plugin:CreateToolbar(PLUGIN_NAME)
--------------------------------------------------------------------------------
-- Settings
--------------------------------------------------------------------------------
local function initializeSettings()
local runBefore = plugin:GetSetting("RunBefore") or false
if not runBefore then
plugin:SetSettings("RunBefore", true)
plugin:SetSettings("AutoSync", false)
plugin:SetSettings("RefreshRate", .25)
end
end
initializeSettings()
--------------------------------------------------------------------------------
-- Button Setup
--------------------------------------------------------------------------------
local function createSyncButton()
local tooltip = "Establishes a connection to the server and starts syncing "..
"changes made on the filesystem."
local icon = "rbxassetid://619356746"
return toolbar:CreateButton("Sync", tooltip, icon)
end
local function createOptionsButton()
local tooltip = ("Configure options for %s."):format(PLUGIN_NAME)
local icon = "rbxassetid://619383224"
return toolbar:CreateButton("Settings", tooltip, icon)
end
createSyncButton()
createOptionsButton()
| Initialize settings when the plugin first runs | Initialize settings when the plugin first runs
| Lua | mit | vocksel/studio-bridge-cli |
47d9b51bcba5d19bf21c009e4b93ea5333066346 | Client/Data/scenarios/siege.lua | Client/Data/scenarios/siege.lua | Create("blackhole").position = {350, 400}
local player = CreateShip(require("ships/mdfrigate"), "player")
player.position = {500, 500}
player.fuel = 11
local npc = CreateShip(require("ships/broadside"))
npc.position = {600, 500}
--Create("asteroid", {startpoint = {0, 0}, endpoint = {1000, 1000}, range = 100, count = 100}) | Create("blackhole").position = {350, 400}
local player = CreateShip(require("ships/mdfrigate"), "player")
player.position = {500, 500}
player.fuel = 11
player.faction = 1
local npc = CreateShip(require("ships/broadside"))
npc.position = {600, 500}
npc.faction = 2
Create("asteroid", {startpoint = {0, 0}, endpoint = {1000, 1000}, range = 100, count = 50})
| Set ship factions to allow damage | Set ship factions to allow damage
| Lua | bsd-3-clause | iridinite/shiftdrive |
8fb510cb89a0f76889ec645f48e28bbf63817f8d | examples/hello-world/tundra.lua | examples/hello-world/tundra.lua | Build {
Units = "units.lua",
Configs = {
{
Name = "macosx-gcc",
DefaultOnHost = "macosx",
Tools = { "gcc" },
},
{
Name = "linux-gcc",
DefaultOnHost = "linux",
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)",
},
},
},
}
| Build {
Units = "units.lua",
Configs = {
{
Name = "macosx-gcc",
DefaultOnHost = "macosx",
Tools = { "gcc" },
},
{
Name = "linux-gcc",
DefaultOnHost = "linux",
Tools = { "gcc" },
},
{
Name = "win32-msvc",
DefaultOnHost = "windows",
Tools = { "msvc-vs2012" },
Env = {
CXXFLAGS = { "/EHsc" },
},
},
{
Name = "win32-mingw",
Tools = { "mingw" },
-- Link with the C++ compiler to get the C++ standard library.
ReplaceEnv = {
LD = "$(CXX)",
},
},
},
}
| Add /EHsc to silence warning. | Add /EHsc to silence warning.
Closes GH-219
| Lua | mit | deplinenoise/tundra,bmharper/tundra,deplinenoise/tundra,bmharper/tundra,deplinenoise/tundra,bmharper/tundra,bmharper/tundra |
458a615ca5d00af5970627a4a0447dd50557c2a7 | Client/Data/scenarios/siege.lua | Client/Data/scenarios/siege.lua | Create("blackhole").position = {350, 400}
local player = CreateShip(require("ships/mdfrigate"), "player")
player.position = {500, 500}
player.fuel = 11
player.faction = 1
local npc = CreateShip(require("ships/broadside"))
npc.position = {600, 500}
npc.faction = 2
Create("asteroid", {startpoint = {0, 0}, endpoint = {1000, 1000}, range = 100, count = 50})
| Create("blackhole").position = {350, 400}
local player = CreateShip(require("ships/mdfrigate"), "player")
player.position = {500, 500}
player.fuel = 11
player.faction = 1
local npc = CreateShip(require("ships/broadside"))
npc.position = {600, 500}
npc.faction = 2
local asdfasdf = Create("station")
asdfasdf.position = {700, 600}
asdfasdf.sprite = "ship/station"
Create("asteroid", {startpoint = {0, 0}, endpoint = {1000, 1000}, range = 100, count = 50})
| Add a space station to the test map | Add a space station to the test map
| Lua | bsd-3-clause | iridinite/shiftdrive |
0d4b12732107482fa998560fcafb3e79c947deba | scripts/tundra/syntax/lemon.lua | scripts/tundra/syntax/lemon.lua | -- lemon.lua - Support for the Lemon parser generator
module(..., package.seeall)
local path = require "tundra.path"
DefRule {
Name = "Lemon",
Command = "lemon $(<)",
ConfigInvariant = true,
Blueprint = {
Source = { Required = true, Type = "string" },
},
Setup = function (env, data)
local src = data.Source
local base_name = path.drop_suffix(src)
local gen_c = base_name .. '.c'
local gen_h = base_name .. '.h'
local gen_out = base_name .. '.out'
return {
InputFiles = { src },
OutputFiles = { gen_c, gen_h, gen_out },
}
end,
}
| Add basic Lemon parser generator support. | Add basic Lemon parser generator support.
| Lua | mit | deplinenoise/tundra,bmharper/tundra,deplinenoise/tundra,bmharper/tundra,bmharper/tundra,deplinenoise/tundra,bmharper/tundra | |
049a98b15d3e47d21a8fb63253bd990457201ff5 | hammerspoon/hammerspoon.symlink/modules/hyperkey.lua | hammerspoon/hammerspoon.symlink/modules/hyperkey.lua | -- Based on https://gist.github.com/prenagha/1c28f71cb4d52b3133a4bff1b3849c3e
-- A global variable for the sub-key Hyper Mode
k = hs.hotkey.modal.new({}, 'F19')
-- Hyper+key for all the below are setup somewhere
-- The handler already exists, usually in Keyboard Maestro
-- we just have to get the right keystroke sent
hyperBindings = {'c','r','f'}
for i,key in ipairs(hyperBindings) do
k:bind({}, key, nil, function() hs.eventtap.keyStroke({'cmd','alt','shift','ctrl'}, key)
k.triggered = true
end)
end
-- Enter Hyper Mode when F19 (left control) is pressed
pressedF19 = function()
k.triggered = false
k:enter()
end
-- Leave Hyper Mode when F19 (left control) is pressed,
-- send ESCAPE if no other keys are pressed.
releasedF19 = function()
k:exit()
if not k.triggered then
hs.eventtap.keyStroke({}, 'ESCAPE')
end
end
-- Bind the Hyper key
f19 = hs.hotkey.bind({}, 'F19', pressedF19, releasedF19)
| Add new Karabiner module for completing the hyper-key hack | feat(Hammerspoon): Add new Karabiner module for completing the hyper-key hack
| Lua | mit | sethvoltz/dotfiles,sethvoltz/dotfiles,sethvoltz/dotfiles,sethvoltz/dotfiles | |
b1b7a25fd170075cbea920d70597f9b8e376eacf | 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 | Lusito/premake,Lusito/premake,warrenseine/premake,warrenseine/premake,annulen/premake,Lusito/premake,annulen/premake,annulen/premake,warrenseine/premake,annulen/premake,Lusito/premake | |
5fe29662c935d11295980433d5e87358b5e7084a | lua/wordcount.lua | lua/wordcount.lua | wordTable = {}
for line in io.lines() do
line:gsub('%S+', function(w)
wordTable[w] = (wordTable[w] or 0) + 1
end)
end
displayTable = {} -- Because lua doesn't have any concept of ordered tables by keys, we need to order it ourselves
for word, count in pairs(wordTable) do
table.insert(displayTable, string.format('%s %d', word, count))
end
table.sort(displayTable)
for i,n in ipairs(displayTable) do print(n) end
| wordTable = {}
for line in io.lines() do
line:gsub('%S+', function(w)
wordTable[w] = (wordTable[w] or 0) + 1
end)
end
displayTable = {}
for word, count in pairs(wordTable) do
table.insert(displayTable, string.format('%s %d', word, count))
end
table.sort(displayTable)
for i,n in ipairs(displayTable) do print(n) end
| Remove comments and fixed indentation | Remove comments and fixed indentation
| Lua | mit | rtoal/polyglot,rtoal/ple,rtoal/ple,rtoal/polyglot,rtoal/polyglot,rtoal/polyglot,rtoal/ple,rtoal/polyglot,rtoal/ple,rtoal/polyglot,rtoal/polyglot,rtoal/ple,rtoal/ple,rtoal/polyglot,rtoal/ple,rtoal/ple,rtoal/ple,rtoal/ple,rtoal/ple,rtoal/polyglot,rtoal/ple,rtoal/ple,rtoal/polyglot,rtoal/ple,rtoal/ple,rtoal/polyglot,rtoal/polyglot,rtoal/ple,rtoal/polyglot,rtoal/polyglot,rtoal/polyglot |
6140fae69c2c5de3e26244822688271cce0beaae | src/conf.lua | src/conf.lua | function love.conf(t)
t.title = "Journey to the Center of Hawkthorne v0.0.8"
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.9"
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.9 | Bump release version to v0.0.9
| Lua | mit | hawkthorne/hawkthorne-server-lua,hawkthorne/hawkthorne-client-lua,hawkthorne/hawkthorne-server-lua,hawkthorne/hawkthorne-client-lua |
904182e1760da899dccc88fc34c39b654243f90c | examples/perf/loops.lua | examples/perf/loops.lua |
local sum = 0
local j = 1000
while (j > 0) do
local i = 10000
while (i > 0) do
i = i - 1
sum = sum + 1
end
j = j - 1
end
print (sum)
| Add an example useful for testing basing execution. | Add an example useful for testing basing execution.
| Lua | mit | GaloisInc/galua,GaloisInc/galua,GaloisInc/galua,GaloisInc/galua,GaloisInc/galua,GaloisInc/galua | |
33523c435fddcae1099372a7503e964f574b6f3a | src/program/wall/common.lua | src/program/wall/common.lua | module(..., package.seeall)
-- This module provides some common definitions for snabbwall programs
inputs = {}
function inputs.pcap (kind, path)
return "output", { require("apps.pcap.pcap").PcapReader, path }
end
function inputs.raw (kind, device)
return "tx", { require("apps.socket.raw").RawSocket, device }
end
function inputs.tap (kind, device)
return "output", { require("apps.tap.tap").Tap, device }
end
function inputs.intel10g (kind, device)
local conf = { pciaddr = device }
return "rx", { require("apps.intel.intel_app").Intel82599, conf }
end
function inputs.intel1g (kind, device)
local conf = { pciaddr = device }
return "rx", { require("apps.intel.intel1g").Intel1g, conf }
end
| module(..., package.seeall)
-- This module provides some common definitions for snabbwall programs
inputs = {}
function inputs.pcap (kind, path)
return "output", { require("apps.pcap.pcap").PcapReader, path }
end
function inputs.raw (kind, device)
return "tx", { require("apps.socket.raw").RawSocket, device }
end
function inputs.tap (kind, device)
return "output", { require("apps.tap.tap").Tap, device }
end
function inputs.intel10g (kind, device)
local conf = { pciaddr = device }
return "tx", { require("apps.intel.intel_app").Intel82599, conf }
end
function inputs.intel1g (kind, device)
local conf = { pciaddr = device }
return "tx", { require("apps.intel.intel1g").Intel1g, conf }
end
| Fix "tx"/"rx" link names that were reversed | Fix "tx"/"rx" link names that were reversed
| Lua | apache-2.0 | dpino/snabb,dpino/snabb,alexandergall/snabbswitch,Igalia/snabb,dpino/snabbswitch,snabbco/snabb,heryii/snabb,dpino/snabb,alexandergall/snabbswitch,eugeneia/snabb,Igalia/snabbswitch,eugeneia/snabb,eugeneia/snabbswitch,Igalia/snabbswitch,Igalia/snabb,Igalia/snabbswitch,heryii/snabb,eugeneia/snabbswitch,snabbco/snabb,snabbco/snabb,heryii/snabb,eugeneia/snabb,snabbco/snabb,snabbco/snabb,SnabbCo/snabbswitch,eugeneia/snabb,heryii/snabb,dpino/snabbswitch,alexandergall/snabbswitch,dpino/snabb,SnabbCo/snabbswitch,dpino/snabbswitch,alexandergall/snabbswitch,Igalia/snabb,alexandergall/snabbswitch,Igalia/snabb,Igalia/snabb,SnabbCo/snabbswitch,eugeneia/snabb,eugeneia/snabb,dpino/snabb,dpino/snabb,dpino/snabbswitch,eugeneia/snabbswitch,Igalia/snabbswitch,alexandergall/snabbswitch,Igalia/snabb,heryii/snabb,alexandergall/snabbswitch,SnabbCo/snabbswitch,heryii/snabb,Igalia/snabb,eugeneia/snabb,alexandergall/snabbswitch,snabbco/snabb,Igalia/snabbswitch,eugeneia/snabbswitch,snabbco/snabb,snabbco/snabb,dpino/snabb,eugeneia/snabb,Igalia/snabb |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.