golang笔记


虽然推荐使用

go get -u golang.org/x/sync

但很不幸,国内无法连接golang.org,所以只能曲线救国,借助github.com来安装相关的package

git clone https://github.com/golang/sync ./
# 或者
git clone https://github.com/golang/sync
mv sync $GOPATH/src/golang/x/

读取配置文件

注: Configuration 里元素(Path …

lua笔记


Table of Contents

lua分割字符串

local ngx_find    = ngx.re.find

local function split(str, sep , count)
    local t = {}
    count = count or -1

    local nfield, nstart = 1, 1
    local nfirst,nlast = string.find(str, sep)
    -- local nfirst,nlast = ngx_find(str, sep, "jo")
    while nfirst and count ~= 0 do
        t[nfield] = string.sub(str, nstart, nfirst - 1)
        nfield = nfield+1
        nstart = nlast+1
        nfirst,nlast = string …

python笔记


TIME

GMT时间格式

GMT_FORMAT = '%a, %d %b %Y %H:%M:%S GMT'

获取某个时间的时间戳

import datetime
import time

string = "2018-03-31"
date_time = datetime.datetime.strptime(string, '%Y-%m-%d')
time_time = time.mktime …