conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Fix android standalone toolchain dependency\n" }, { "from": "human", "value": "return {\n build = {\n type = 'android-standalone-toolchain',\n toolchain = 'android-ndk-r16b',\n arch = 'arm',\n system = 'arm-linux-androidea...
lua
chosen
[ { "from": "system", "value": "Fix JS being served again if translate() is called multiple times\n" }, { "from": "human", "value": "local lp = require\"src.web_utils.lp\"\nlocal lat = require\"src.lib.latclient\"\n\nlocal M = {\n\tlat = lat\n}\n\nfunction M.translate (s)\n\tlat.js_url = \"pub/lat...
lua
chosen
[ { "from": "system", "value": "Build testbed only on Windows.\n\nDo not build testbed under any other OS than Windows.\n\nAlso the testbed project has mixed C++ and C files, which does not build\nunder the current Linux build framework (premake and clang).\n" }, { "from": "human", "value": "inclu...
lua
chosen
[ { "from": "system", "value": "Bring Halfletter layout into line with class methods\n" }, { "from": "human", "value": "local book = SILE.require(\"classes/book\");\nbook:loadPackage(\"masters\")\nbook:defineMaster({ id = \"right\", firstContentFrame = \"content\", frames = {\n content = { left =...
lua
chosen
[ { "from": "system", "value": "Make default footnote topskip relative to font size." }, { "from": "human", "value": "-- Footnotes class\nSILE.require(\"packages/counters\")\nSILE.require(\"packages/raiselower\")\nlocal insertions = SILE.require(\"packages/insertions\")\nSILE.scratch.counters.foot...
lua
chosen
[ { "from": "human", "value": "Add test script for LSockAddr lookup_full method.\n" }, { "from": "gpt", "value": "\nlocal llnet = require\"llnet\"\nlocal P = llnet.Protocols\n\nlocal host, port, family, socktype, protocol = arg[1], arg[2], arg[3], arg[4], arg[5]\n\nif #arg < 1 then\n\tprint(arg[0]...
lua
chosen
[ { "from": "system", "value": "Update test to work with fixed gsub behavior\n" }, { "from": "human", "value": "local function fixhash(msg)\n return string.gsub(msg, \"@(%x+)\", function(s) return \"@\"..(string.rep(\"x\", 6)) end)\nend\n\nobj = luajava.newInstance(\"java.lang.Object\")\nprint( f...
lua
chosen
[ { "from": "human", "value": "Add an example of slow interpolation.\n" }, { "from": "gpt", "value": "-- Visualize IQ data as a texture from the HackRF\n-- You want seizures? 'Cause this is how you get seizures.\n\nVERTEX_SHADER = [[\n#version 400\nlayout (location = 0) in vec3 vp;\nlayout (locati...
lua
chosen
[ { "from": "system", "value": "Use Webclient js.* in headbar.\n" }, { "from": "human", "value": "return function (loader)\n\n local Webclient = loader.load \"cosy.webclient\"\n local I18n = loader.load \"cosy.i18n\"\n local i18n = I18n.load {\n \"cosy.webclient.headbar\",\n }\n\n...
lua
chosen
[ { "from": "system", "value": "title: Remove unnecessary table -> string in gist.\n" }, { "from": "human", "value": "local simplehttp = require'simplehttp'\nlocal json = require'json'\n\ncustomHosts['gist%.github%.com'] = function(queue, info)\n\tlocal query = info.query\n\tlocal path = info.path...
lua
chosen
[ { "from": "system", "value": "Add body data in logging\n" }, { "from": "human", "value": "local _M = {}\n\nfunction _M.serialize(ngx)\n return {\n request = {\n uri = ngx.var.request_uri,\n request_uri = ngx.var.scheme..\"://\"..ngx.var.host..\":\"..ngx.var.server_port..ngx.var.req...
lua
chosen
[ { "from": "system", "value": "Add a place to switch off compiling\n" }, { "from": "human", "value": "-- Entrypoint for my Neovim configuration!\n-- We simply bootstrap packer and Aniseed here.\n-- It's then up to Aniseed to compile and load fnl/init.fnl\n\nlocal execute = vim.api.nvim_command\nl...
lua
chosen
[ { "from": "system", "value": "Update syntax to new standard\n" }, { "from": "human", "value": "--- Generic IsA interface for Lua classes.\n-- @module IsAMixin\n\nlocal IsAMixin = {}\n\n--- Adds the IsA function to a class and all descendants\nfunction IsAMixin:Add(class)\n\tassert(not class.IsA,...
lua
chosen
[ { "from": "system", "value": "Enable vRP world VoIP by default.\n" }, { "from": "human", "value": "\nlocal cfg = {}\n\n-- VoIP\n\n-- VoIP websocket server\ncfg.voip_server = \"ws://localhost:40120\"\n\n-- VoIP Opus params\ncfg.voip_bitrate = 24000 -- bits/s\n\n-- frame_size (ms)\n-- 20,40,60; hi...
lua
chosen
[ { "from": "system", "value": "Fix upload example to not dump the actual data\n\nChange-Id: Icd849536e31061772e7fef953ddcea1a2f5c8a6d\n" }, { "from": "human", "value": "local HTTP = require(\"http\")\nlocal Utils = require(\"utils\")\nlocal Table = require(\"table\")\n\nHTTP.create_server(\"0.0.0...
lua
chosen
[ { "from": "system", "value": "Implement writing to RAM in emulator interface\n" }, { "from": "human", "value": "prev = \"\";\nmsg = \"\";\n\nfunction write_file (filename, text)\n output = io.open(filename, \"w\");\n io.output(output);\n io.write(text);\n io.close(output);\nend;\n\nf...
lua
chosen
[ { "from": "system", "value": "Add missing part of license header\n" }, { "from": "human", "value": "--[[\r\nThis program is free software: you can redistribute it and/or modify it under\r\nthe terms of the GNU Affero General Public License as published by the Free\r\nSoftware Foundation, either ...
lua
chosen
[ { "from": "system", "value": "Update weblit to fix crashing bug\n" }, { "from": "human", "value": "return {\n name = \"luvit/blog.luvit.io\",\n version = \"0.0.3\",\n private = true,\n dependencies = {\n -- hoedown ffi bindings for fast markdown compiling\n \"creationix/hoedown@1.1.2\"...
lua
chosen
[ { "from": "system", "value": "feat: Add ability to play sounds in parent\n" }, { "from": "human", "value": "--- Helps play sounds on the client\n-- @module SoundUtils\n-- @author Quenty\n\nlocal SoundService = game:GetService(\"SoundService\")\n\nlocal SoundUtils = {}\n\nfunction SoundUtils.play...
lua
chosen
[ { "from": "system", "value": "Enable XCB in Vulkan loader on Linux\n" }, { "from": "human", "value": "group(\"third_party\")\nproject(\"vulkan-loader\")\n uuid(\"07d77359-1618-43e6-8a4a-0ee9ddc5fa6a\")\n kind(\"StaticLib\")\n language(\"C\")\n\n defines({\n \"_LIB\",\n \"API_NAME=\\\"v...
lua
chosen
[ { "from": "human", "value": "Add pretty print (from test.lua) to somewhere more useful.\n" }, { "from": "gpt", "value": "-- Lua utility functions\nlocal M = {}\n\n-- Pretty-print Lua values.\nfunction M.tostring(a)\n if type(a) == \"string\" then\n return '\"' .. a .. '\"'\n elseif ...
lua
chosen
[ { "from": "system", "value": "Use proper log level constants with ngx.log()\n" }, { "from": "human", "value": "local auth_header = ngx.var.http_Authorization\n\nif auth_header == nil then\n ngx.log(ngx.STDERR, \"No Authorization header\")\n ngx.exit(ngx.HTTP_UNAUTHORIZED)\nelse\n ngx.lo...
lua
chosen
[ { "from": "system", "value": "Update GenerateWith mixin to avoid showing warnings\n" }, { "from": "human", "value": "--- Simple mixin to generate code for a class\n-- @module GenerateWithMixin\n\nlocal module = {}\n\n--- Adds the GenerateWith API to the class\n-- @tparam table class\n-- @tparam[...
lua
chosen
[ { "from": "system", "value": "Create reusable function for launching apps\n\nSwitched to bundleID because the name for iTerm is 'iTerm2' but it needs\nto be `open()`ed with 'iTerm' (dunno why)\n" }, { "from": "human", "value": "local module = {}\n\nmodule.init = function()\n\ths.hotkey.bind({\"c...
lua
chosen
[ { "from": "human", "value": "Add friction velocity lua from old directory\n" }, { "from": "gpt", "value": "-- Friction velocity code\n-- Tack 6/2015\n \nlogger:Info(\"Calculating friction velocity\")\n \nlocal par1 = param(\"UFLMOM-NM2\") -- Eastward turbulent surface stress\nlocal par2 = param(...
lua
chosen
[ { "from": "system", "value": "Make some Lua calls local to increase performance.\n" }, { "from": "human", "value": "-- This script needs all active proxies available specified as args.\nlocal serverToData = {}\n\nfor _, proxy in ipairs(ARGV) do\n local players = redis.call(\"SMEMBERS\", \"pro...
lua
chosen
[ { "from": "system", "value": "Revert \"change to use vector instead of positions\"\n\nThis reverts commit 58aa68ddf2f9fa8b641a36b5a812392efc3768d4.\n" }, { "from": "human", "value": "local Class = require 'lib.hump.class'\nlocal Event = getClass 'pud.event.Event'\n\n-- EntityPositionEvent\n--\nl...
lua
chosen
[ { "from": "system", "value": "Change text positioning on the emulator\n" }, { "from": "human", "value": "prev = \"\";\nmsg = \"\";\n\nfunction write_file (filename, text)\n output = io.open(filename, \"w\");\n io.output(output);\n io.write(text);\n io.close(output);\nend;\n\nfunction...
lua
chosen
[ { "from": "human", "value": "Add basic tests for `path` module\n\nTests #47.\n" }, { "from": "gpt", "value": "require(\"helper\")\n\nlocal Path = require('path')\n\n-- test `Path.dirname`\nassert(Path.dirname('/usr/bin/vim') == '/usr/bin')\nassert(Path.dirname('/usr/bin/') == '/usr')\nassert(Pat...
lua
chosen
[ { "from": "human", "value": "Add banner size for church app resources\n" }, { "from": "gpt", "value": "SILE.documentState.paperSize = SILE.paperSizeParser(1920 / 300 .. \"in x \" .. 692 / 300 .. \"in\")\nSILE.documentState.orgPaperSize = SILE.documentState.paperSize\n" } ]
lua
chosen
[ { "from": "system", "value": "fix(metadata): Handle YAML keys that start with digits as strings\n" }, { "from": "human", "value": "local yaml = require(\"yaml\")\nyaml.configure({ load_nulls_as_nil = true })\n\nreturn {\n\tload = function (filename)\n\t\treturn yaml.loadpath(filename)\n\tend\n}\...
lua
chosen
[ { "from": "system", "value": "Add system include path to buildoptions\n" }, { "from": "human", "value": "#!lua\n\nif os.execute(\"gcc-6 -v\") == 0 then\n premake.gcc.cc = 'gcc-6'\n premake.gcc.cxx = 'g++-6'\nend\n\nsolution \"Opossum\"\n configurations { \"Debug\", \"Release\" }\n pla...
lua
chosen
[ { "from": "system", "value": "Add sysroot and runtime to linaro dependencies\n" }, { "from": "human", "value": "return {\n source = {\n type = 'dist',\n location = 'https://releases.linaro.org/15.06/components/toolchain/binaries/4.8/arm-linux-gnueabi/gcc-linaro-4.8-2015.06-x86_6...
lua
chosen
[ { "from": "system", "value": "Build: Include subdirectories in SharpLLVM binding, so that TypeRef and ValueRef have proper ToString methods (easier debugging).\n" }, { "from": "human", "value": "project \"SharpLLVM\"\n\n kind \"SharedLib\"\n language \"C#\"\n flags { \"Unsafe\"}\n\n SetupMan...
lua
chosen
[ { "from": "system", "value": "Use more backward compatible formulation of SET EX\n" }, { "from": "human", "value": "-- Set key to token with expiry of timeout, if:\n-- - It doesn't exist\n-- - It exists and already has value of token (further set extends timeout)\n-- Used to implement a re-ent...
lua
chosen
[ { "from": "system", "value": "Include stack trace in uncaught exceptions during main\n" }, { "from": "human", "value": "--[[\n\nCopyright 2014 The Luvit Authors. All Rights Reserved.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in complia...
lua
chosen
[ { "from": "human", "value": "Add script to create precipitation type & form from potential versions\n\nThis is done by masking those gridpoints where precipitation sum is zero\n" }, { "from": "gpt", "value": "-- Create PrecipitationType and PrecipitationForm from Potential parameter version\n-- ...
lua
chosen
[ { "from": "system", "value": "Add lua extension for setting highlights\n" }, { "from": "human", "value": "local M = {}\n\nlocal option_scopes = {\n o = vim.o,\n wo = vim.wo,\n bo = vim.bo\n}\n\nfunction M.option(scope)\n return setmetatable({}, {\n __index = function(_, k)\n return o...
lua
chosen
[ { "from": "system", "value": "Make all tests for Eressea pass again, using the config module.\n" }, { "from": "human", "value": "require \"example.rules\"\n\nlocal srcpath = config.source_dir\ntests = {\n srcpath .. '/shared/scripts/tests/common.lua', \n srcpath .. '/shared/scripts/tests/bson....
lua
chosen
[ { "from": "system", "value": "Remove dead code from option unit tests\n\n--HG--\nextra : rebase_source : bda34e49fc7ef28dd2aa8e3e548f9748f96fd94f\n" }, { "from": "human", "value": "--\n-- tests/base/test_option.lua\n-- Verify the handling of command line options and the _OPTIONS table.\n-- Copyr...
lua
chosen
[ { "from": "system", "value": "Fix incorrect argument to ifre.compile().\n" }, { "from": "human", "value": "-- A simple wrapper for PCRE that uses a cache for compiled expressions.\n\n_regex_cache = {}\n\n_regex_cache.mt = {}\nsetmetatable(_regex_cache, _regex_cache.mt)\n\n\n_regex_cache.mt.__ind...
lua
chosen
[ { "from": "system", "value": "fix(Hammerspoon): Disable audio switcher, it causes unexpected audio splitting\n" }, { "from": "human", "value": "-- Define audio device names for headphone/speaker switching\nlocal usbAudioSearch = \"VIA Technologies\" -- USB sound card\n\n-- Toggle between speaker...
lua
chosen
[ { "from": "system", "value": "Revert \"Launch Kitty instead of iTerm\"\n\nThis reverts commit 379d04d7f7aa3ba133f6be81ed2551e88376f445.\n" }, { "from": "human", "value": "local module = {}\n\nfunction appLauncher(bundleID)\n\treturn function()\n\t\tlocal focusedApp = hs.application.frontmostAppl...
lua
chosen
[ { "from": "system", "value": "Hide sidebar when turning off all media players\n" }, { "from": "human", "value": "hook.Add( \"PopulateMenuBar\", \"MediaPlayerOptions_MenuBar\", function( menubar )\n\n\tlocal m = menubar:AddOrGetMenu( \"Media Player\" )\n\n\tm:AddCVar( \"Fullscreen\", \"mediaplaye...
lua
chosen
[ { "from": "system", "value": "Raise the timeout in this test case\n" }, { "from": "human", "value": "module(..., lunit.testcase, package.seeall)\r\n\r\nfunction test()\r\n\r\nlocal http = require \"luanode.http\"\r\n\r\nlocal google = http.createClient(80, 'www.google.com')\r\nlocal request = go...
lua
chosen
[ { "from": "system", "value": "Fix unused variable causing lint error.\n" }, { "from": "human", "value": "local path = require \"pl.path\"\nlocal setup = require \"api-umbrella.cli.setup\"\nlocal status = require \"api-umbrella.cli.status\"\nlocal unistd = require \"posix.unistd\"\n\nlocal functi...
lua
chosen
[ { "from": "system", "value": "Fix ugly bug in bytes\n\nWas harmless until we actually started to use the state when\ndecoupling randomkit's stream from torch's.\n" }, { "from": "human", "value": "--[[ This file is for functions that are not direct wraps of the randomkit C routines ]]\n\nfunction...
lua
chosen
[ { "from": "system", "value": "Add shortcut for git blame\n" }, { "from": "human", "value": "keymap = require(\"nutils\").map\n\nrequire(\"gitsigns\").setup(\n {\n watch_index = {\n interval = 100\n }\n }\n)\n\nkeymap(\"n\", \"<leader>gs\", \":vertical Git<CR>\", {silent = true})\nke...
lua
chosen
[ { "from": "system", "value": "Change live_grep to grep_string as more useful\n" }, { "from": "human", "value": "local telescope = require('telescope')\n\ntelescope.setup({\n defaults = {\n mappings = {\n i = {\n ['<c-u>'] = false,\n ['<c-d>'] = ...
lua
chosen
[ { "from": "human", "value": "Add lua code for nginx.\n" }, { "from": "gpt", "value": "local jwt = require \"luajwt\"\nlocal auth = ngx.var.authorization\nlocal users = ngx.shared.users\nlocal projects = ngx.shared.projects\nlocal project = ngx.req.project\n\nif (project == nil and (ngx.req.uri ~...
lua
chosen
[ { "from": "system", "value": "Use the non-specific tag as default for quoted scalar\n" }, { "from": "human", "value": "\nlocal re = require 're'\n\nreturn re.compile([[\n\n\t{|\n\t\t{:data: %SINGLE_QUOTED :}\n\t\t{:primitive: '' -> 'scalar' :}\n\t\t{:tag: '' -> 'tag:yaml.org,2002:str' :}\n\t|}\n...
lua
chosen
[ { "from": "system", "value": "Remove use of deprecated TS* highlight groups" }, { "from": "human", "value": "vim.o.termguicolors = true\n\nlocal base16 = require(\"user.utils.base16\")\n\nlocal background = base16.background()\nif background ~= nil then\n\tvim.opt.background = background\nend\n\...
lua
chosen
[ { "from": "system", "value": "Fix for when one of id/type set\n" }, { "from": "human", "value": "-- Oxypanel Core\n-- File: app/log.lua\n-- Desc: logging of all actions for Oxypanel\n\nlocal os = os\nlocal database, user = luawa.database, luawa.user\n\nlocal function log()\n local request = l...
lua
chosen
[ { "from": "system", "value": "Training: Handle peoplePerBatch > nClasses edge case when nDonkey != -1.\n" }, { "from": "human", "value": "#!/usr/bin/env th\n\nrequire 'torch'\nrequire 'cutorch'\nrequire 'optim'\n\nrequire 'paths'\n\nrequire 'xlua'\n\nlocal opts = paths.dofile('opts.lua')\n\nopt ...
lua
chosen
[ { "from": "system", "value": "Use option 4 for deep sleep, to keep wifi module disabled after wakeup.\n\nSigned-off-by: Kalman Olah <aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d@kalmanolah.net>\n" }, { "from": "human", "value": "local send_report = function()\n print('Report: Sending')\n -- Report...
lua
chosen
[ { "from": "system", "value": "Fix binder group, add sanity checks\n" }, { "from": "human", "value": "--- Groups binders together\n-- @classmod BinderGroup\n\nlocal BinderGroup = {}\nBinderGroup.ClassName = \"BinderGroup\"\nBinderGroup.__index = BinderGroup\n\nfunction BinderGroup.new(binders, va...
lua
chosen
[ { "from": "system", "value": "Revert \"trigger build lua only once\"\n\nThis reverts commit 58bb9a8cbb6c707d4d0ec908b39755e5f51fcb8f.\n" }, { "from": "human", "value": "project \"ocgcore\"\n kind \"StaticLib\"\n\n files { \"*.cpp\", \"*.h\" }\n links { \"lua\" }\n \n if BUILD_LUA ...
lua
chosen
[ { "from": "system", "value": "Fix linker trying to find the wrong entry point\n\nI deleted and rebuilt the project solution and found that\nin debug builds only, the linker was complaining about not\nfinding the program entry point. Turns out the setting for\n/ENTRY was for non-gui WinMain.\n" }, { ...
lua
chosen
[ { "from": "system", "value": "Add command line flag to enable debug logging\n" }, { "from": "human", "value": "--[[\nCopyright 2012 Rackspace\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a c...
lua
chosen
[ { "from": "system", "value": "Increase timeout limit.\nSome windows computers are quite slow in connecting.\n" }, { "from": "human", "value": "local flower = flower\n-- LuaSocket should come with zerobrane\nlocal socket = require(\"socket\")\n\nNetworkFrameworkEntity = flower.class()\n\nfunction...
lua
chosen
[ { "from": "system", "value": "Verify that the input array is not mutated for accumulate\n" }, { "from": "human", "value": "local accumulate = require('accumulate')\n\ndescribe('accumulate', function()\n\n local function square(x) return x * x end\n\n it('should accumulate over an empty array',...
lua
chosen
[ { "from": "human", "value": "Disable CoreGui elements we don't use\n" }, { "from": "gpt", "value": "-- Simply disabled some of the CoreGui elements that we don't need in the game.\n\nlocal starterGui = game:GetService(\"StarterGui\")\n\nstarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Health, false...
lua
chosen
[ { "from": "system", "value": "test(frames): Update frame spec test to sanely interact with document class\n" }, { "from": "human", "value": "SILE = require(\"core/sile\")\nSILE.backend = \"dummy\"\nSILE.init()\n\nlocal tClass = SILE.classes.base({})\n\ntClass:declareFrame(\"a\", { left = \"1pt\"...
lua
chosen
[ { "from": "system", "value": "Revert \"Use the absolute target directory when copying Clang headers.\"\n\nThis reverts commit 535536d1c1c7d02fff3fb36b34b7825b277674b4.\n" }, { "from": "human", "value": "clang_msvc_flags =\n{\n \"/wd4146\", \"/wd4244\", \"/wd4800\", \"/wd4345\",\n \"/wd4355\", ...
lua
chosen
[ { "from": "system", "value": "Update lua-filter format for Pandoc 2.6\n" }, { "from": "human", "value": "#!/usr/bin/env lua\n\n-- Remove footnotes from headers to pass epub validation for Play Books\nHeader = function (element)\n return pandoc.walk_block(element, {\n Note = function (eleme...
lua
chosen
[ { "from": "system", "value": "Add aliases for moreores' copper and bronze items\n" }, { "from": "human", "value": "-- Minetest 0.4 mod: external_legacy\n-- See README.txt for licensing and other information.\n\n-- Aliases to support moreores' ores\nminetest.register_alias(\"moreores:mineral_gold...
lua
chosen
[ { "from": "human", "value": "Add fs_stat benchmark. TODO: fix SIGSEGV during gc.\n" }, { "from": "gpt", "value": "local uv = require 'couv'\n\nlocal NUM_SYNC_REQS = 1e6\nlocal NUM_ASYNC_REQS = 1e5\nlocal MAX_CONCURRENT_REQS = 32\n\nlocal function warmup(path)\n -- warm up the thread pool\n cor...
lua
chosen
[ { "from": "system", "value": "Remove the < and > symbols when storing the tag in the file table\n" }, { "from": "human", "value": "local STORY_TAGS = { '<title>', '<x>', '<y>', '<z>' };\nlocal MOD_ID = 'RMMuldraughTales';\nlocal STORY_FOLDER = '/stories/'\n\nlocal function loadStory(id, filename...
lua
chosen
[ { "from": "system", "value": "Create a function for the top-down offset to avoid repetition\n" }, { "from": "human", "value": "-- ClassName: LocalScript\n\nlocal run = game:GetService(\"RunService\")\n\nlocal OFFSET = Vector3.new(-45, 45, 45)\nlocal FIELD_OF_VIEW = 25\n\nlocal player = game.Play...
lua
chosen
[ { "from": "system", "value": "test: Add more modern loader for cmdr tests\n" }, { "from": "human", "value": "--[[\n\t@class ServerMain\n]]\n\nlocal ReplicatedStorage = game:GetService(\"ReplicatedStorage\")\nlocal ServerScriptService = game:GetService(\"ServerScriptService\")\n\nlocal LoaderUtil...
lua
chosen
[ { "from": "system", "value": "Change file format -> mac2unix\n\nSigned-off-by: Robbie Cao <643a933cab46d49aae0d64e790867eaec8b68831@gmail.com>\n" }, { "from": "human", "value": "local uv = require(\"luv\")\r\rif #arg < 1 then\r print(string.format(\"Usage: %s <file1> [file2 ...]\", arg[0]));\...
lua
chosen
[ { "from": "human", "value": "Solve Average 1 in lua\n" }, { "from": "gpt", "value": "a = tonumber(io.read(\"*n\"))\nb = tonumber(io.read(\"*n\"))\n\nprint(string.format('MEDIA = %.5f', (a * 3.5 + b * 7.5) / 11.0))\n" } ]
lua
chosen
[ { "from": "human", "value": "Add unit test for params\n" }, { "from": "gpt", "value": "describe('params specs', function ()\n it('can be created', function ()\n pending('Test not implemented') \n end)\n it('can be added', function ()\n pending('Test not implemented')\n end)\n it('can ...
lua
chosen
[ { "from": "system", "value": "Convert HTML entities to readable characters.\n" }, { "from": "human", "value": "return {\n\t[\"^:(%S+) PRIVMSG (%S+) :!gcalc (.+)$\"] = function(self, src, dest, msg)\n\t\tmsg = utils.escape(msg):gsub('%s', '+')\n\t\tlocal content, status = utils.http(\"http://www....
lua
chosen
[ { "from": "system", "value": "Update to build with vs2012\n" }, { "from": "human", "value": "Build {\n\tUnits = \"units.lua\",\n\tConfigs = {\n\t\t{\n\t\t\tName = \"macosx-gcc\",\n\t\t\tDefaultOnHost = \"macosx\",\n\t\t\tTools = { \"gcc\", \"mono\" },\n\t\t},\n\t\t{\n\t\t\tName = \"win32-msvc\",...
lua
chosen
[ { "from": "system", "value": "Add a multi-group test, which fails.\n" }, { "from": "human", "value": "local assertEq = test.assertEq\nlocal function log(x) test.log(tostring(x) .. \"\\n\") end\nlocal vi_regex = require('regex.regex')\nlocal compile = vi_regex.compile\n\nlocal pat\n\npat = compil...
lua
chosen
[ { "from": "system", "value": "Revert \"Simplify, no need for a buffer_length variable.\"\n\nThis reverts commit 63fefab61fd677a8e236721776b6e55277409180.\n" }, { "from": "human", "value": "require \"string\"\n\n-- Useful for buffering syslog messages.\n\nbuffer = \"\"\n\nfunction process_message...
lua
chosen
[ { "from": "human", "value": "Add a utility library (Clamp(), PID class).\n" }, { "from": "gpt", "value": "-- Returns x clamped to [min, max], and whether the clamp was binding.\nfunction Clamp(x, min, max)\n if x <= min then\n return min, true\n elseif x >= max then\n return max, true\n ...
lua
chosen
[ { "from": "system", "value": "Handle calling with absent environment variables\n" }, { "from": "human", "value": "local test = {}\nlocal counter\n\ntest.accept = function ()\n\n counter = counter + 1\n\n header = \"Status: 200 Ok\\r\\n\" ..\n \"Content-Type: text/html\\r\\n\\r\\n\"\...
lua
chosen
[ { "from": "system", "value": "Add workaround for file_new_for_path() vs. File.new_for_path() issue\n" }, { "from": "human", "value": "------------------------------------------------------------------------------\n--\n-- LGI Gio2 override module.\n--\n-- Copyright (c) 2010, 2011 Pavel Holejsov...
lua
chosen
[ { "from": "system", "value": "Use port 81 for failure report endpoint.\n\nverizoff.at.ninjawedding.org is running on a system with other HTTP\ndaemons on it. Easiest solution for me: bind them all to different\nports.\n" }, { "from": "human", "value": "-- From https://github.com/lua-shellscript...
lua
chosen
[ { "from": "system", "value": "Clear E2's strfunc cache when defining a function\n\nPreviously the following code:\n function string f() { print(\"A\") }\n \"f\"()\n function string f() { print(\"B\") }\n \"f\"()\n\n...would print \"A\" twice, because the previous entry for \"f()\" was still\npre...
lua
chosen
[ { "from": "system", "value": "[hammerspoon] Add mash shortcuts for throwing windows to the left and right\n" }, { "from": "human", "value": "hs.hotkey.bind({\"cmd\", \"shift\"}, \"{\", function()\n current_app():selectMenuItem({\"Window\", \"Select Previous Tab\"})\nend)\n\nhs.hotkey.bind({\"...
lua
chosen
[ { "from": "system", "value": "Make hammerspoon window notifications more persistent.\n\nUnfortunately, this means you'll have to clean them out of your notification center from time to time. But that place is a shithole anyways.\n" }, { "from": "human", "value": "require 'expandmode'\nrequire 'm...
lua
chosen
[ { "from": "system", "value": "Add note on nested lua tables\n" }, { "from": "human", "value": "require(\"compose\")\nrequire(\"mutations\")\n\nlocal function dumptable(bt, tablename)\n local tabledef = {}\n local output = {}\n local prefix = \"\"\n\n if tablename then\n prefix...
lua
chosen
[ { "from": "system", "value": "Disable Concourse menu by default\n\nOnly for work laptop + needs arguments to run\n" }, { "from": "human", "value": "require('windows').init()\nrequire('config-reloader').init()\nrequire('display-sleep').init()\nrequire('launch-apps').init()\nrequire('keyboard-watc...
lua
chosen
[ { "from": "system", "value": "Remove : on diffget //3\n" }, { "from": "human", "value": "keymap = require(\"gb.utils\").map\n\nrequire(\"gitsigns\").setup(\n{\n watch_gitdir = {\n interval = 100\n },\n signs = {\n add = { hl = \"GitGutterAdd\" },\n change = { hl = \"GitGu...
lua
chosen
[ { "from": "system", "value": "Update luadoc for playNote function.\n" }, { "from": "human", "value": "--- Provides sound and music functions.\r\n-- @module rpgplus.sound\r\n\r\n--- Play a sound to a specific player.\r\n-- @param player player to play the sound to\r\n-- @param sound sound to play...
lua
chosen
[ { "from": "system", "value": "Use bigger margins and single side template for A4 drafts\n" }, { "from": "human", "value": "local book = SILE.require(\"classes/book\");\nbook:loadPackage(\"masters\")\nbook:defineMaster({ id = \"right\", firstContentFrame = \"content\", frames = {\n content = {le...
lua
chosen
[ { "from": "human", "value": "Update for modern sizing conventions\n" }, { "from": "gpt", "value": "local lib = {}\n\n-- Code originally by WhoBloxedWho\n\nlocal MINIMUM_SIZES = {\n\t[\"TrussPart\"] = Vector3.new(2, 2, 2);\n\t[\"UnionOperation\"] = Vector3.new(0, 0, 0);\n}\n\n--- Scales a group ...
lua
chosen
[ { "from": "system", "value": "refactor(core): Define function before use, not after\n" }, { "from": "human", "value": "local date = function (options)\n options.format = options.format or \"%c\"\n options.time = options.time or os.time()\n options.locale = options.locale or localeify(SILE.set...
lua
chosen
[ { "from": "system", "value": "test(packages): Refactor unit tests for package loading\n" }, { "from": "human", "value": "SILE = require(\"core.sile\")\nlocal lfs = require(\"lfs\")\n\ndescribe(\"#packages like\", function ()\n\n local _, dir_obj = lfs.dir(\"packages\")\n local file = dir_obj:n...
lua
chosen
[ { "from": "system", "value": "Use string as specified by openresty docs" }, { "from": "human", "value": "local router = require \"resty.router\"\nlocal r = router:new(\"resty.router.redis_dns\")\n\nlocal method = ngx.req.get_method()\nlocal ok = nil\nlocal err = nil\nif method == ngx.HTTP_GET th...
lua
chosen
[ { "from": "system", "value": "tests(model): Update fixture for model unit tests\n" }, { "from": "human", "value": "--user fixtures\n\nreturn {\n\t{\n\t\tusername = 'serena',\n\t\tpassword = '123456'\n\t},\n\t\n\t{\n\t\tusername = 'lua',\n\t\tpassword = '1234'\n\t},\n\n\t{\n\t\tusername = 'arnold...
lua
chosen
[ { "from": "system", "value": "Use FriendLib in ChatSanitizer module\n" }, { "from": "human", "value": "\nlocal chatfilter = function(message, name, type)\n\treturn (FilterLib:Filter(message) == \"\")\nend\n\nlocal mod = {\n\t[\"Name\"] = \"ChatSanitizer\",\n\t[\"Description\"] = \"Blocks spam me...
lua
chosen
[ { "from": "system", "value": "Add version checker since so many people are confused about which version to use.\n" }, { "from": "human", "value": "local path = minetest.get_modpath(minetest.get_current_modname())\r\n\r\nlocal loadmodule = function(path)\r\n\tlocal file = io.open(path)\r\n\tif no...
lua
chosen
[ { "from": "system", "value": "Add one character width to line number margin." }, { "from": "human", "value": "-- 4 spaces FTW!\nbuffer.tab_width = 4\nbuffer.use_tabs = false\n\n-- Turn on line wrapping:\nbuffer.wrap_mode = buffer.WRAP_WORD\n\n-- Increase font size for GUI:\nbuffer:set_theme(\n ...
lua
chosen
[ { "from": "human", "value": "feat(packages): Add package to dump frame info\n" }, { "from": "gpt", "value": "local base = require(\"packages.base\")\n\nlocal package = pl.class(base)\npackage._name = \"dumpframes\"\n\nlocal seenframes = {}\nlocal outfile\n\nfunction package.writeTof ()\n local ...
lua
chosen
[ { "from": "human", "value": "Add a test floating_lua program that constructs a list of unique integers.\n" }, { "from": "gpt", "value": "local begin_tran = floating_temple.begin_tran\nlocal end_tran = floating_temple.end_tran\nlocal shared = floating_temple.shared\n\nbegin_tran()\nif shared[\"nu...
lua
chosen
[ { "from": "system", "value": "Load util before model for optimizeNet\n\n\\cc @melgor\n" }, { "from": "human", "value": "#!/usr/bin/env th\n\nrequire 'torch'\nrequire 'optim'\n\nrequire 'paths'\n\nrequire 'xlua'\n\nlocal opts = paths.dofile('opts.lua')\n\nopt = opts.parse(arg)\nprint(opt)\n\nif o...
lua
chosen