Skip to content

Instantly share code, notes, and snippets.

@asasuou
asasuou / worker nginx conf
Created October 1, 2015 17:35 — forked from fqrouter/worker nginx conf
Youtube Reverse Proxy
resolver 8.8.8.8;
location /video/ {
if ($request_uri ~ "^/video/(.+?)/.+") {
set $upstream_host $1.googlevideo.com;
add_header Content-Disposition "attachment; filename=video.mp4;";
}
rewrite /video/.+?/(.+)$ /$1 break;
proxy_buffering off;
proxy_pass https://$upstream_host;
proxy_set_header Host $upstream_host;
@asasuou
asasuou / random_proxy.pac
Created October 2, 2015 12:49 — forked from teslatronic/random_proxy.pac
A PAC file that picks a random proxy from a list
/*
By Daan Rijks ([email protected]).
Idea & Inititative: Niels Meijer ([email protected])
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License
(http://creativecommons.org/licenses/by-nc-sa/4.0/)
*/
var hosts = ""; // HTTP proxies go here, in the format host:port separated by a single space.
@asasuou
asasuou / install_ocserv.sh
Created October 6, 2015 08:02 — forked from lj0014/install_ocserv.sh
install ocserv in ubuntu
#install deps
apt-get update
apt-get install -y gnutls-bin iptables libnl-route-3-200 libseccomp2 libwrap0 openssl curl --no-install-recommends
buildDeps=" \
autoconf \
autogen \
ca-certificates \
gcc \
gperf \
libgnutls28-dev \
@asasuou
asasuou / no-route.txt
Created October 6, 2015 08:21 — forked from lj0014/no-route.txt
ocserv no route
no-route = 1.160.0.0/255.224.0.0
no-route = 1.192.0.0/255.224.0.0
no-route = 14.0.0.0/255.224.0.0
no-route = 14.96.0.0/255.224.0.0
no-route = 14.128.0.0/255.224.0.0
no-route = 14.192.0.0/255.224.0.0
no-route = 27.0.0.0/255.192.0.0
no-route = 27.96.0.0/255.224.0.0
no-route = 27.128.0.0/255.128.0.0
no-route = 36.0.0.0/255.192.0.0
@asasuou
asasuou / socket.py
Created November 26, 2015 11:24 — forked from falseen/socket.py
限制ss客户端数量(基于ip判断),理论上可以用于其他使用了socket模块的python程序。
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2015 Falseen
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0

测试平台:DigitalOcean VPS ubuntu14.04 x64, strongswan5.2.2

运行以下命令请使用root权限

一:安装strongswan

由于ubuntu软件仓库中strongswan版本较低,因此从官网源码编译安装

apt-get install build-essential     #编译环境
aptitude install libgmp10 libgmp3-dev libssl-dev pkg-config libpcsclite-dev libpam0g-dev     #编译所需要的软件
git config --global https.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080
git config --global --unset http.proxy
git config --global --unset https.proxy
npm config delete proxy
@asasuou
asasuou / gist:1c688c4e79985eff35ac
Created February 2, 2016 12:52 — forked from mendelgusmao/gist:5823291
BTSync / BitTorrent Sync behind nginx
# take one
# subdirectory (one server, multiple services)
location /btsync/ {
rewrite ^/btsync/gui(.*) /btsync$1 last;
proxy_pass http://127.0.0.1:8888/gui/;
proxy_redirect /gui/ /btsync/;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
@asasuou
asasuou / ocserv
Created February 13, 2016 23:56 — forked from kevinzhow/ocserv
ocserv 启动脚本
#!/bin/sh
### BEGIN INIT INFO
# Provides: ocserv
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
### END INIT INFO
# Copyright Rene Mayrhofer, Gibraltar, 1999
# This script is distibuted under the GPL
frontend=0.0.0.0,443
backend=127.0.0.1,8081
workers=2
private-key-file=/etc/squid3/server.key
certificate-file=/etc/squid3/server.crt
http2-proxy=yes
add-x-forwarded-for=no
no-via=yes
no-ocsp=yes