Skip to content

Instantly share code, notes, and snippets.

View se77en's full-sized avatar

Damon Zhao se77en

View GitHub Profile
package main
import (
"io"
"log"
"mime/multipart"
"net/http"
"os"
"path/filepath"
"runtime"
@se77en
se77en / IsPrivateIP.go
Last active August 29, 2015 14:15 — forked from mapix/IsPrivateIP.go
package main
import "net"
import "fmt"
func main() {
fmt.Println(IsPrivateIP("111.11.191.17"))
fmt.Println(IsPrivateIP("192.168.0.100"))
fmt.Println(IsPrivateIP("10.0.8.100"))
}
@se77en
se77en / css
Last active August 29, 2015 14:25 — forked from CodeMyUI/css
Sign In/Up Transition By Fabrizio Bianchi : http://codepen.io/fbrz/pen/pvZRNK
@import url(http://fonts.googleapis.com/css?family=Raleway:700,800);
html, body { margin: 0; }
:focus { outline: none; }
::-webkit-input-placeholder { color: #DEDFDF; }
::-moz-placeholder { color: #DEDFDF; }
:-moz-placeholder { color: #DEDFDF; }
::-ms-input-placeholder { color: #DEDFDF; }
@se77en
se77en / index.gohtml
Last active August 29, 2015 14:25 — forked from ericlagergren/index.gohtml
Hot-reloading / hot-swapping live template files in Go
My name is {{.Name}} and I'm {{.Age}} years old!!
@se77en
se77en / 0_reuse_code.js
Last active August 29, 2015 14:26
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@se77en
se77en / gist:420e7bd9a88fd65e9369
Created October 14, 2015 05:49 — forked from momer/grpc_with_reconnect.go
A pattern I created to maintain connections to an RPC server in Go. Since net/rpc does not provide any methods for automatically reconnecting to an RPC server, I needed a work-around. Additionally, rpc.Client does not export any state variables (rpc.Client.shutdown and rpc.Client.closing) nor does it export the Client's Mutex. So, we wrap the rp…
package main
import (
"myapp/webserver/app/common"
"github.com/golang/glog"
"github.com/gorilla/mux"
"encoding/json"
"strconv"
"flag"
"fmt"
@se77en
se77en / tmux-cheatsheet.markdown
Created November 19, 2015 07:34 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@se77en
se77en / instructions.md
Created December 3, 2015 06:51 — forked from darach/instructions.md
Pony on the Raspberry Pi v2

Instructions

The following instructions assume a debian jessie based distribution

0. Prerequisites

Install dependent tools and libraries

$ sudo apt-get update

测试平台: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     #编译所需要的软件
[General]
# warning, notify, info, verbose
skip-proxy = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12, 100.64.0.0/10, localhost, *.local
bypass-tun = 0.0.0.0/8, 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12
loglevel = notify
# 默认 IP 和端口,不修改的话系统网络 HTTP 和 HTTPS 代理设置中就是 127.0.0.1:6152
interface = 0.0.0.0
port = 6152