Skip to content

Instantly share code, notes, and snippets.

View lewangdev's full-sized avatar
🐢
Running

lewang lewangdev

🐢
Running
View GitHub Profile
#!/bin/bash
#####
# Builds a custom nginx
#
# RELEASE_TAGS="+your+tags+here"
# RELEASE_MAINTAINER="Your Name Here"
# RELEASE_MAINTAINER_EMAIL="hi@example.com"
# RELEASE_MESSAGE="Some message"
#
- certain endpoints are always blocked
if nginx_uri == "/_access_token" or nginx_uri == "/_me" then
ngx.exit(403)
end
-- import requirements
local cjson = require "cjson"
-- setup some app-level vars
local app_id = "APP_ID"
@lewangdev
lewangdev / bulket.py
Created August 7, 2018 09:41
Bulket insert data to MySQL by python
#coding=utf8
import MySQLdb
class Connectdb():
def __init__(self):
self._conn = MySQLdb.connect("localhost", "root", "letmein",
"db_test", charset="utf8")
@lewangdev
lewangdev / router-shadowsocks-setup.sh
Created April 26, 2019 04:55
create a transparency proxy on linux based router
## IPSET
# OR ipset create gfwlist hash:ip
ipset -N gfwlist iphash
## DNS
# gwflist 中的域名转发 dns 请求到 1.1.1.1:53 查询,并且通过 dnsmasq 存到 gfwlist ipset 中
# 启动一个本地 socks 代理给转发 DNS 使用
/opt/shadowsocks/bin/ss-local -c /opt/shadowsocks/etc/dns2socks.conf -f /var/run/ss-local.pid
# https://github.com/qiuzi/dns2socks
@lewangdev
lewangdev / nginx.conf
Created September 24, 2019 06:13 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
{
"inbounds": [
{
"port": 1082,
"protocol": "socks",
"settings": {
"auth": "noauth"
}
},
{
@lewangdev
lewangdev / gost.json
Last active February 26, 2020 07:41
launch-gost
# Load
launchctl load -w ~/Library/LaunchAgents/gost.plist
# Unload
launchctl unload -w ~/Library/LaunchAgents/gost.plist
{
"Retries": 1,
"ServeNodes": [
"dns://127.0.0.1:15353?dns=https-chain://1.1.1.1/dns-query",
"red://:1081"
],
"ChainNodes": [
"https://user:pass@ip:port?peer=/etc/qiangguo/gost/peer.txt"
]
@lewangdev
lewangdev / create-base-image-centos7.sh
Created September 8, 2020 10:35
Create KVM virtual machine
qemu-img create -f qcow2 /var/lib/libvirt/images/base-image-centos7.qcow2 40G
virt-install \
--virt-type kvm \
--name base-image-centos7 \
--vcpus 2 \
--ram 4096 \
--cdrom=/root/Downloads/CentOS-7-x86_64-Minimal-2003.iso \
--disk /var/lib/libvirt/images/base-image-centos7.qcow2,format=qcow2 \
--network bridge=br0 \
FROM centos/s2i-base-centos7
MAINTAINER Le Wang <lewang.dev@gmail.com>
ARG PYTHON_VERSION=3.5.10
RUN yum install -y \
ncurses-libs \
zlib-devel \
mysql-devel \