Look at LSB init scripts for more information.
Copy to /etc/init.d
:
# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
" 首先安装 vim 配置框架 https://github.com/amix/vimrc.git | |
" 再安装 vim-go 插件 https://github.com/fatih/vim-go ,就是 clone 到 ~/.vim_runtime/my_plugins 下面 | |
" 再安装 go 语言颜色主题 https://github.com/fatih/molokai 方法同上 | |
set nu | |
map <tab> :tabnext<cr> | |
map <leader><tab> :tabprevious<cr> | |
map <leader>1 :tabfirst<cr> |
#!/bin/bash | |
BASEDIR=/Users/chenyunfei/works | |
LEN=$(expr ${#BASEDIR} + 2) | |
cd $BASEDIR | |
function sync() { | |
while read -d "" event; do | |
echo $event | awk -v len="$LEN" '{print substr($0, len)}' | xargs -t -n1 -I{} rsync -avz {} chenyunfei@serverip::works/{} |
func parseCommandLine(command string) ([]string, error) { | |
var args []string | |
state := "start" | |
current := "" | |
quote := "\"" | |
escapeNext := true | |
for i := 0; i < len(command); i++ { | |
c := command[i] | |
if state == "quotes" { |
func SimpleMatch(pattern, s string) bool { | |
i, j, star, match := 0, 0, -1, 0 | |
for i < len(s) { | |
if j < len(pattern) && (s[i] == pattern[j] || pattern[j] == '?') { | |
i++ | |
j++ | |
} else if j < len(pattern) && pattern[j] == '*' { | |
match, star = i, j | |
j++ | |
} else if star != -1 { |
package main | |
import ( | |
"os" | |
"bufio" | |
"io" | |
"bytes" | |
"fmt" | |
"errors" | |
"strconv" |
Look at LSB init scripts for more information.
Copy to /etc/init.d
:
# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
package proxy | |
import ( | |
"github.com/mijia/sweb/log" | |
"io" | |
"net" | |
"net/http" | |
"strings" | |
"sync" | |
) |
package elector | |
import ( | |
etcdLibkv "github.com/docker/libkv" | |
"github.com/docker/libkv/store" | |
etcdStore "github.com/docker/libkv/store/etcd" | |
"github.com/mijia/sweb/log" | |
"strings" | |
"time" | |
) |