月度归档:2018年12月

安装纯msys的开发环境

最简单的方法是直接登录:https://www.msys2.org/网址,下载安装包。
————————————————————————————————
通常使用mingw来进行跨平台移植,如果源代码只依赖到linux核心的话,可以只需要安装msys核心组件即可。
例如lrzsz组件,可以只依赖msys的相关工具,即可。
1.安装组件管理工具,【只需要安装mingw-w32-install即其管理工具在如下目录】


2.选择msys的组件

无阻塞channel

ch := make(chan int, 10)
	go func() {
		for{
			<-ch
		}
	}()
	for i := 0; i < 100; i++ {
		select {
		case ch <- i: // thank goodness
			log.Println(fmt.Sprintf("msgchan:%v", i))
			break
		default: // hm, push i to storage?
			log.Println(fmt.Sprintf("default:%v", i))
			break
		}
		time.Sleep(time.Microsecond)
	}

GoLang处理数组

//query='[{"client_ver":"10.0.0.5","plug_name":"Kaiwpp","plug_ver":"1.0.0.5","distsrc":"student"}]'
var params []interface{}
err := json.Unmarshal([]byte(query), ¶ms);

WIKI的docker部署

1.Dockerfiles编写

FROM centos:6.6

ENV CONF_INST  /opt/atlassian/
ENV CONF_HOME  /var/atlassian/application-data/


COPY ./confluence-5.4.4.tar.gz /confluence-5.4.4.tar.gz
COPY ./application-data-init.tar.gz /application-data-init.tar.gz
RUN set -x && yum install -y tar && mkdir -p ${CONF_INST} && tar -xvf /confluence-5.4.4.tar.gz --directory "${CONF_INST}/"

COPY ./startup.sh /startup.sh
RUN chmod +x /startup.sh

EXPOSE 8090
VOLUME ["${CONF_HOME}", "${CONF_INST}"]
CMD ["/startup.sh"]

2.docker-compose.yml的编写

version: '3.1'

services:
  confluence:
    image: wiki:1.0
    restart: always
    ports:
      - 8090:8090
    #entrypoint: bash -c "ping 127.0.0.1"
    #command: bash -c "ping 127.0.0.1"
    #command: /opt/atlassian/confluence/bin/catalina.sh run
    volumes:
      - /data/atlassian/confluence/logs:/opt/atlassian/confluence/logs
      - /data/atlassian/confluence/logs:/opt/atlassian/application-data/confluence/logs
      - /data/atlassian/application-data:/var/atlassian/application-data
      - ./backups:/var/atlassian/application-data/confluence/backups
      - ./restore:/var/atlassian/application-data/confluence/restore:ro
      - /etc/localtime:/etc/localtime:ro
      - /etc/timezone:/etc/timezone:ro
    build:
      context: ./crack
      dockerfile: Dockerfile

ansible的安装与运行

1.采用EPEL-release源安装,简单安全。

yum install epel-release -y
yum install ansible –y

2.验证

 
ansible 127.0.0.1 -m ping
---------------------
返回结果
127.0.0.1 | SUCCESS => {
    "changed": false, 
    "ping": "pong"
}

example:
https://github.com/leucos/ansible-tuto