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
=begin | |
require 'grape' | |
require 'x_reproxy_url_filter' | |
class Hello < Grape::API | |
get 'static' do | |
status 200 | |
%w{The quick brown fox jumps over the lazy dog} | |
end | |
get 'download' do |
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
-- https://github.com/diegonehab/luasocket | |
local HTTP = require("socket.http") | |
local LTN12 = require("ltn12") | |
-- source for ngx.req.socket() | |
function source_tcpsock(handle, bytes) | |
bytes = tonumber(bytes) | |
if handle then | |
return function() | |
if bytes <= 0 then |
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
2015/12/21 20:31:38 [error] 7922#0: *70 lua entry thread aborted: runtime error: attempt to yield across C-call boundary | |
stack traceback: | |
coroutine 0: | |
[C]: in function 'request' | |
/opt/nginx/scripts/upload4.lua:45: in function </opt/nginx/scripts/upload4.lua:1>, client: 127.0.0.1, server: localhost, request: "POST /upload4 HTTP/1.0", host: "localhost" | |
see: | |
http://stackoverflow.com/questions/30111808/luasocket-nginx-error-lua-entry-thread-aborted-runtime-error-attempt-to-yi |
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
=begin | |
require 'grape' | |
require 'uuid' | |
require 'ltsv' | |
class Hello < Grape::API | |
post 'teapot' do | |
status 201 | |
id = UUID.generate | |
header XCloudwatchLogFilter::X_CLOUDWATCH_LOG, LTSV.dump({user_id:id, resource:'/teapot'}) |
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 function header_join_with_crlf(header) | |
local str = "", k, v | |
for k,v in pairs(header) do | |
str = str .. v .. "\r\n" | |
end | |
return str | |
end | |
-- @return client, err | |
local function connect(ngxctx, host, port, path) |
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 function signature(ngxctx, method, bucket, objectkey) | |
local access_key = os.getenv('AWS_ACCESS_KEY_ID') | |
local secret_key = os.getenv('AWS_SECRET_ACCESS_KEY') | |
local date = ngxctx.http_time(ngxctx.time()) | |
local headers = ngxctx.req.get_headers() | |
local s2s = method .. "\n" | |
s2s = s2s .. (headers['content-md5'] or "") .. "\n" | |
s2s = s2s .. (headers['content-type'] or "") .. "\n" | |
s2s = s2s .. date .. "\n" | |
s2s = s2s .. "/" .. bucket .. "/" .. objectkey |
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
#!/usr/bin/env ruby | |
=begin | |
sudo yum -y install gcc openssl-devel zlib-devel pcre-devel lua lua-devel | |
sudo yum -y install ruby-devel curl-devel gcc-c++ | |
wget https://openresty.org/download/ngx_openresty-1.9.3.2.tar.gz | |
tar xf ngx_openresty-1.9.3.2.tar.gz | |
gem install passenger | |
ruby build.rb | |
=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
require 'grape' | |
require 'uuid' | |
require 'aws-sdk' | |
class Hello < Grape::API | |
HTTP_PROXY = ENV['HTTP_PROXY'] || ENV['HTTPS_PROXY'] | |
AWS_REGION = ENV['AWS_REGION'] || 'ap-northeast-1' | |
module Logic |
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
#!/usr/bin/env ruby | |
=begin | |
* install | |
$ yum -y install fuse fuse-devel | |
$ gem install rfusefs | |
* mount | |
$ mkdir group_name | |
$ ruby cloudwatchlogfs.rb group_name | |
#=> log-group name is 'group_name' |
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
FROM ubuntu | |
WORKDIR /root | |
ENV TZ=JST-9 | |
RUN apt-get update -y | |
RUN apt-get upgrade -y | |
RUN apt-get -y install trac | |
RUN mkdir ./Main | |
RUN echo "main\n\n" |trac-admin ./Main initenv |