This file contains hidden or 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
#!/bin/bash | |
# | |
# Install fpm | |
# | |
apt-get install ruby-dev gcc | |
gem install fpm | |
# Packing something that uses Make |
This file contains hidden or 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
--- | |
-- Fake synchronous functions | |
local function Sync(fn) | |
local function make_resumer(co) | |
return function(...) | |
return assert(coroutine.resume(co, ...)) | |
end | |
end |
This file contains hidden or 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
function await(continuation) | |
local coro = coroutine.running() | |
local result | |
local async | |
continuation(function(err, value) | |
if async == nil then | |
async = false | |
result = value | |
if err then error(err) end | |
return |
This file contains hidden or 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
require "luarocks.require" | |
require "json" | |
local luatrace = require "luatrace" | |
luatrace.tron() | |
local t = json.decode[[ | |
{ | |
"friends": [], | |
"blah": {}, |
This file contains hidden or 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
<html> | |
<head> | |
<title>Test Socket.IO</title> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script> | |
<script src="/socket.io/socket.io.js"></script> | |
<script type='text/javascript'> | |
var socket = new io.Socket('192.168.21.81', { | |
rememberTransport: false, port: 8080, | |
connectTimeout: 5000, |
This file contains hidden or 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 fail_safe = { | |
__index = function(t, command) | |
error( ("No command defined for %q"):format(tostring(command)) ) | |
end | |
} | |
setmetatable(fail_safe, fail_safe) | |
-- You add commands here (internally) | |
local commands = { | |
get = function(t, key) |
This file contains hidden or 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
require "luanode.http" | |
local router = require "route66".new() | |
router:get("/prompt", function(req, res) | |
res:writeHead(200, { ["Content-Type"] = "text/plain"}) | |
res:finish(">:") | |
end) | |
router:get("/hello/(.+)", function(req, res, user) | |
res:writeHead(200, { ["Content-Type"] = "text/plain"}) |