Skip to content

Instantly share code, notes, and snippets.

View monkeym4ster's full-sized avatar
🎯
Focusing

M4ster monkeym4ster

🎯
Focusing
View GitHub Profile
@monkeym4ster
monkeym4ster / docker.sh
Created July 6, 2017 06:04
Docker: save/load container using tgz file (tar.gz)
#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
@monkeym4ster
monkeym4ster / .MOVED.md
Created October 23, 2016 11:56 — forked from hwdsl2/.MOVED.md
IPsec VPN Server Auto Setup Script for Ubuntu and Debian
#!/usr/bin/env python
#coding=utf-8
import os
import sys
import socket
import pty
shell = "/bin/sh"
@monkeym4ster
monkeym4ster / openvpn-install.sh
Created May 26, 2016 16:29 — forked from cyriac/openvpn-install.sh
openVPN setup script
#!/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.
# 规则配置仅供参考,适用于 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
@monkeym4ster
monkeym4ster / nginx.conf
Last active May 27, 2016 07:52 — forked from rubendob/nginx.onf
Nginx
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;
@monkeym4ster
monkeym4ster / visibility-change.coffee
Last active April 29, 2016 02:52
browser visibility change
oldTitle = document.title
document.addEventListener "visibilitychange", ->
document.title = if document.hidden then "~~~#{oldTitle}~~~" else oldTitle
@monkeym4ster
monkeym4ster / gist:091a26d6d75d3c5feecbc58b27b48621
Last active April 22, 2016 07:08
jQuery ajax add delete/put function
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,
@monkeym4ster
monkeym4ster / beautify.coffee
Created April 13, 2016 16:02 — forked from pyrobot/beautify.coffee
CoffeeScript beautify function
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)}"
@monkeym4ster
monkeym4ster / use-haproxy-proxy-shadowsocks.md
Last active July 20, 2020 09:19
Use haproxy to proxy shadowsocks

Install haproxy

apt-get install haproxy 

Config haproxy

Edit /etc/haproxy/haproxy.cfg like this(You need to replace IP and port):

global
 ulimit-n 51200