Skip to content

Instantly share code, notes, and snippets.

View millken's full-sized avatar

millken

  • Changde,China
View GitHub Profile
var p1={
x:0,
y:0
};
var p2={
x:0,
y:1
};
@davidcaste
davidcaste / inflate_body.lua
Last active November 26, 2024 14:32
Nginx config: receive a request with a gzipped body, inflate it, and pass it to a proxied server
-- Debian packages nginx-extras, lua-zlib required
ngx.ctx.max_chunk_size = tonumber(ngx.var.max_chunk_size)
ngx.ctx.max_body_size = tonumber(ngx.var.max_body_size)
function create_error_response (code, description)
local message = string.format('{"status":400,"statusReason":"Bad Request","code":%d,"exception":"","description":"%s","message":"HTTP 400 Bad Request"}', code, description)
ngx.status = ngx.HTTP_BAD_REQUEST
ngx.header.content_type = "application/json"
ngx.say(message)
@LPGhatguy
LPGhatguy / luajit-curl.lua
Last active July 26, 2025 17:38
A cURL binding for LuaJIT. Missing some constants presumably, but functional
--[[
LuaJIT-cURL
Lucien Greathouse
LuaJIT FFI cURL binding aimed at cURL version 7.38.0.
Copyright (c) 2014 lucien Greathouse
This software is provided 'as-is', without any express
or implied warranty. In no event will the authors be held
liable for any damages arising from the use of this software.
@karmi
karmi / .gitignore
Last active March 26, 2025 08:35
Example Nginx configurations for Elasticsearch (https://www.elastic.co/blog/playing-http-tricks-nginx)
nginx/
!nginx/.gitkeep
!nginx/logs/.gitkeep
src/
tmp/
@yosssi
yosssi / go-nginx.md
Last active August 7, 2024 20:10
Go networking performance vs Nginx

1. Nginx

$ wrk -t12 -c400 -d2s http://127.0.0.1:8080
Running 2s test @ http://127.0.0.1:8080
  12 threads and 400 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     7.71ms    3.16ms  23.05ms   69.17%
    Req/Sec     3.44k     1.98k    7.80k    58.22%
  63697 requests in 2.00s, 17.86MB read
@markselby
markselby / nginx.conf
Created October 28, 2013 02:58
Nginx config for using LUA / Redis cache.
location / {
try_files $uri @redis_cache;
add_header Source Files; # Handy for development
}
location @redis_cache {
# Make sure this path is correct
# Run "nginx -V" from the command prompt and look for --prefix=/path/to/somewhere
# and place redis.lua there, or use an absolute path as shown below
content_by_lua_file /path/to/your/config/redis.lua;
@hintjens
hintjens / gist:6634071
Created September 20, 2013 06:41
Multistage blackbox test
#include <czmq.h>
static void *
s_source (void *args)
{
zctx_t *ctx = zctx_new ();
void *pub = zsocket_new (ctx, ZMQ_PUB);
zsocket_bind (pub, "tcp://127.0.0.1:9000");
while (true) {
@Gaubee
Gaubee / index.html
Last active December 20, 2015 14:59
nodejs远程命令行系统
<html>
<head>
<title>hehe</title>
<meta content="The Shell command runner Based on Nodejs">
<style>
/**
* basic styles for the javascript sandbox console - joss crowcroft
*
* http://josscrowcroft.github.com/javascript-sandbox-console/
*/
@9466
9466 / fcgiclient.go
Last active March 20, 2016 14:53 — forked from wofeiwo/fcgiclient.go
// Copyright 2012 Junqing Tan <[email protected]> and The Go Authors
// Use of this source code is governed by a BSD-style
// Part of source code is from Go fcgi package
// Fix bug: Can't recive more than 1 record untill FCGI_END_REQUEST 2012-09-15
// By: wofeiwo
package fcgiclient
import (
@inouetakuya
inouetakuya / td-agent.conf
Last active December 13, 2015 19:58
sample of td-agent config file
# ステップバイステップで学ぶ Fluentd + GrowthForecast でグラフ作成まとめ - 彼女からは、おいちゃんと呼ばれています
# http://d.hatena.ne.jp/inouetakuya/20130216/1361015295
<source>
type forward
</source>
<match apache.access>
type copy