This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Browser compat | |
window.AudioContext = window.AudioContext || window.webkitAudioContext; | |
window.RTCPeerConnection = window.RTCPeerConnection || window.webkitRTCPeerConnection || window.mozRTCPeerConnection; | |
navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia; | |
var key = window.location.hash.substring(1); | |
var audio_context = new AudioContext(); | |
var local_output = audio_context.createMediaStreamDestination(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <mach/port.h> /* mach_port_t */ | |
#include <mach/mach.h> /* mach_port_allocate(), mach_task_self(), mach_port_insert_member(), MACH_PORT_RIGHT_PORT_SET */ | |
#include <sys/event.h> /* kqueue(), kevent64(), struct kevent64_s, EVFILT_MACHPORT, EV_SET64, EV_ADD */ | |
#include <sys/time.h> /* struct timespec */ | |
//#include <dispatch/private.h> | |
extern mach_port_t _dispatch_get_main_queue_port_4CF(void); | |
extern void _dispatch_main_queue_callback_4CF(void); | |
#include <stdio.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- This code monkey patches cqueues primitives to allow for transparent use of cqueues inside of tarantool | |
local cqueues = require "cqueues" | |
local fiber = require "fiber" | |
local socket = require "socket" -- https://tarantool.org/en/doc/1.7/reference/reference_lua/socket.html (not luasocket) | |
local old_step; old_step = cqueues.interpose("step", function(self, timeout) | |
if cqueues.running() then | |
fiber.yield() | |
return old_step(self, timeout) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env lua | |
local rockspec_name = assert(arg[1]) | |
local function log(level, fmt, ...) | |
io.stderr:write(level .. "\t" .. string.format(fmt, ...) .. "\n") | |
end | |
local function append(tbl, ...) | |
for _, v in ipairs {...} do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--[[ | |
A short module to read binary floating point numbers for lua. | |
]] | |
local has_ffi , ffi = pcall ( require , "ffi" ) | |
local has_bit , bit = pcall ( require , "bit" ) | |
local read_float , read_double | |
if has_ffi and has_bit then | |
local cast = ffi.cast |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local DIRSEP = package.config:sub(1, 1) | |
local function is_readable(filename) | |
local fd = io.open(filename, "r") | |
if fd then | |
fd:close() | |
return true | |
else | |
return false | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local port = arg[1] or "8000" | |
local nice_server = require "nice_server" | |
local timeout = 2 | |
local function reply(resp) | |
local req_body = assert(resp.stream:get_body_as_string(timeout)) | |
local req_body_type = resp.request_headers:get "content-type" | |
resp.headers:upsert(":status", "200") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
do | |
local function helper ( allowed , want ) | |
return ( not want.type or allowed.type == "*" or ( allowed.type == want.type and | |
( not want.subtype or allowed.subtype == "*" or allowed.subtype == want.subtype ) ) | |
) and allowed.q ~= 0 | |
end | |
function choose_type ( allowed_list , wanted_list ) | |
-- Remove items from allowed list that have no match (retains client ordering) | |
local res = { } | |
local allowed_wanted_map = { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hkp-cacert ~/.gnupg/sks-keyservers.netCA.pem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Load Vue library | |
package.loadlib("https://cdn.jsdelivr.net/npm/vue@2.5.13/dist/vue.js", "*") | |
-- Get Object helper | |
local Object = dofile("https://gist.githubusercontent.com/daurnimator/5a7fa933e96e14333962093322e0ff95/raw/8c6968be0111c7becc485a692162ad100e87d9c7/Object.lua").Object | |
local myapp = js.new(js.global.Vue, Object{ | |
el = "#foo"; | |
template = [[ | |
<div id="foo">{{message}}</div> | |
]]; |
NewerOlder