apt-get install haproxy
Edit /etc/haproxy/haproxy.cfg
like this(You need to replace IP and port):
global
ulimit-n 51200
beautify: (string, indent = 0) -> | |
switch ch = string[0] || '' | |
when '' then "" | |
when '{' or '[' then "#{ch}\n#{Array(++indent+1).join('\t')}#{@beautify(string[1..], indent)}" | |
when '}' or ']' then "\n#{Array(--indent+1).join('\t')}#{ch}#{@beautify(string[1..], indent)}" | |
when ',' then "#{ch}\n#{Array(indent+1).join('\t')}#{@beautify(string[1..], indent)}" | |
when ':' then " : #{@beautify(string[1..], indent)}" | |
else "#{ch}#{@beautify(string[1..], indent)}" |
jQuery.each(['put', 'delete'], function(i, method) { | |
jQuery[method] = function(url, data, callback, type) { | |
if (jQuery.isFunction(data)) { | |
type = type || callback; | |
callback = data; | |
data = void 0; | |
} | |
return jQuery.ajax({ | |
url: url, | |
type: method, |
oldTitle = document.title | |
document.addEventListener "visibilitychange", -> | |
document.title = if document.hidden then "~~~#{oldTitle}~~~" else oldTitle |
user nginx; | |
worker_processes 2; | |
worker_rlimit_nofile 32768; | |
error_log /var/log/nginx/error.log; | |
#error_log /var/log/nginx/error.log notice; | |
#error_log /var/log/nginx/error.log info; | |
pid /var/run/nginx.pid; | |
events { | |
worker_connections 4096; | |
multi_accept on; |
# 规则配置仅供参考,适用于 Surge Mac (1.3.0) 及其后续版本; | |
# 包含 Proxy Group、URL Rewrite 特性; | |
# 包含 Reject 规则,用于拦截广告、行为分析、数据统计; | |
# 屏蔽 Hao123、百度搜索,放行百度地图、百度外卖、百度音乐、百度云盘、百度百科。 | |
# Surge for Mac 简明指南 http://bit.ly/1TATRaG | |
[General] | |
# warning, notify, info, verbose | |
skip-proxy = 127.0.0.1, 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12, 100.64.0.0/10, localhost, *.local | |
bypass-tun = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12 | |
loglevel = notify |
#!/bin/bash | |
# Slightly modified version from https://raw.githubusercontent.com/Nyr/openvpn-install/master/openvpn-install.sh | |
# Run with sudo ./openvpn-install.sh and not sudo sh ./openvpn-install.sh as read command has issues with external triggering of scripts | |
# OpenVPN road warrior installer for Debian, Ubuntu and CentOS | |
# This script will work on Debian, Ubuntu, CentOS and probably other distros | |
# of the same families, although no support is offered for them. It isn't | |
# bulletproof but it will probably work if you simply want to setup a VPN on | |
# your Debian/Ubuntu/CentOS box. It has been designed to be as unobtrusive and | |
# universal as possible. |
#!/usr/bin/env python | |
#coding=utf-8 | |
import os | |
import sys | |
import socket | |
import pty | |
shell = "/bin/sh" |
#for not running docker, use save: | |
docker save <dockernameortag> | gzip > mycontainer.tgz | |
#for running or paused docker, use export: | |
docker export <dockernameortag> | gzip > mycontainer.tgz | |
#load | |
gunzip -c mycontainer.tgz | docker load |