Skip to content

Instantly share code, notes, and snippets.

🌴
On vacation

shuhui.qiu vqiu

🌴
On vacation
Block or report user

Report or block vqiu

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View redis.lua
local redis_c = require "resty.redis"
local ok, new_tab = pcall(require, "table.new")
if not ok or type(new_tab) ~= "function" then
new_tab = function (narr, nrec) return {} end
end
local _M = new_tab(0, 155)
@vqiu
vqiu / named.conf
Created Jan 11, 2019 — forked from cpswan/named.conf
Unbound/BIND config for DNS over TLS to 1.1.1.1
View named.conf
options {
directory "/tmp";
listen-on-v6 { none; };
forwarders {
127.0.0.1 port 2053;
};
auth-nxdomain no; # conform to RFC1035
@vqiu
vqiu / proxy.pac
Last active Nov 10, 2018 — forked from alphatr/proxy.pac
PAC
View proxy.pac
function FindProxyForURL(url, host) {
var proxy = "SOCKS5 127.0.0.1:1080; SOCKS 127.0.0.1:1080; DIRECT";
var black = "PROXY 127.0.0.1:65535";
var direct = "DIRECT";
var PROXY_LIST = [
"instagram.com",
"google.com",
"facebook.com",
@vqiu
vqiu / Knocky.lua
Created Oct 28, 2018 — forked from agix/Knocky.lua
Nginx + redis + lua + authy script to allow access by IP with one touch
View Knocky.lua
-- apt-get install nginx-extras # to get nginx with lua support
-- apt-get install luarocks
-- apt-get install lua-nginx-redis
-- luarocks install lua-requests
-- In your nginx config file add two lua dict outside server definition
--
-- lua_shared_dict ip_whitelist 1m;
-- lua_shared_dict ip_asklist 1m;
-- server {
--
@vqiu
vqiu / bwlimit
Created Jul 30, 2018 — forked from neocogent/bwlimit
Traffic shaping for Bitcoin full nodes
View bwlimit
#!/bin/bash
# Copyright (c) 2013 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#network interface on which to limit traffic
IF="wlan0"
#limit of the network interface in question
LINKCEIL="5mbit"
#limit outbound Bitcoin protocol traffic to this rate
@vqiu
vqiu / tc_qos
Last active Jul 30, 2018 — forked from swshan/tc
openwrt tc
View tc_qos
#!/usr/bin/env bash
# IDEV 内网接口,ODEV外网接口)
IDEV="eth0"
ODEV="eth1"
# 定义总的上下带宽
UP="8mbit"
DOWN="100mbit"
@vqiu
vqiu / default.ctmpl
Created Jun 29, 2018 — forked from mdmsua/default.ctmpl
/etc/nginx/conf.d
View default.ctmpl
server {
listen 80;
{{range services}}
{{if and (ne .Name "consul") (ne .Name "nginx")}}
{{range service .Name}}
location /{{.Name}}/v{{.ID}} {
rewrite /{{.Name}}/v(\d+)\.\d+\.\d+(.*) /{{.Name}}/v$1$2 break;
proxy_pass http://{{.Address}}:{{.Port}};
}
{{end}}
View nginx.tmpl
{{ $cfg := .Cfg }}
{{ $IsIPV6Enabled := .IsIPV6Enabled }}
{{ $healthzURI := .HealthzURI }}
{{ $backends := .Backends }}
{{ $proxyHeaders := .ProxySetHeaders }}
daemon off;
worker_processes {{ $cfg.WorkerProcesses }};
pid /run/nginx.pid;
{{ if ne .MaxOpenFiles 0 }}
View waf.lua
-- https://github.com/openresty/lua-nginx-module#nginx-api-for-lua
-- https://www.nginx.com/resources/wiki/modules/lua/
-- http://www.staticshin.com/programming/definitely-an-open-resty-guide/
-- access_by_lua_file /path/to/waf.lua;
-- examine request
ngx.req.read_body()
local request_method = ngx.req.get_method()
local get_args = ngx.req.get_uri_args()
local post_args, err = ngx.req.get_post_args()
@vqiu
vqiu / db.sql
Created Jun 24, 2018 — forked from kindy/db.sql
ngx_openresty file upload
View db.sql
" mysql中增加一数据库,名为nginx,编码为utf8
" 增加一表,名为 uploadfile 结构为
CREATE TABLE `uploadfile` (
`id` int(20) NOT NULL AUTO_INCREMENT,
`filehash` varchar(50) DEFAULT NULL,
`filename` varchar(100) DEFAULT NULL,
`filelen` varchar(50) DEFAULT NULL,
`contenthash` varchar(80) DEFAULT NULL,
PRIMARY KEY (`id`)
You can’t perform that action at this time.