exec <FILE
while read line
do
cmd
done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # centos7 ansible 2.8.2+ | |
| "ansible_distribution": "CentOS", | |
| "ansible_distribution_file_parsed": true, | |
| "ansible_distribution_file_path": "/etc/redhat-release", | |
| "ansible_distribution_file_variety": "RedHat", | |
| "ansible_distribution_major_version": "7", | |
| "ansible_distribution_release": "Core", | |
| "ansible_distribution_version": "7.5 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [vars:hosts] | |
| {% for id, host in (groups.hosts | infos(hostvars)).iteritems() %} | |
| phenix_zone{{ id }}={{ host | join(',') }} | |
| {% endfor %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import SimpleHTTPServer | |
| import SocketServer | |
| PORT = 8000 | |
| Handler = SimpleHTTPServer.SimpleHTTPRequestHandler | |
| httpd = SocketServer.TCPServer(("", PORT), Handler) | |
| print "serving at port", PORT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #定义变量 | |
| GOPROXY=https://goproxy.io | |
| GO111MODULE=on | |
| #GOTHIRDPKG=${HOME}/gopkg/third | |
| VERSION=$(shell git describe --abbrev=0 --tags) | |
| COMMIT=$(shell git rev-parse --short HEAD) | |
| #project:game prize pusher socket | |
| #type:api srv web |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| touch abc.c | |
| open abc.c | |
| cc -c abc.c | |
| cc abc.o | |
| ./a.out |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # coding:utf-8 | |
| import redis | |
| from redis.sentinel import Sentinel | |
| # 连接哨兵服务器(主机名也可以用域名) | |
| sentinel = Sentinel([ | |
| ('172.31.0.2', 5001), | |
| ('172.31.0.3', 5001), | |
| ('172.31.0.4', 5001), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| print 从 python2 到 python3 | |
| python2 不打印换行,在 print 的行尾加",",在 python2 体验python3 print,可以使用: | |
| from __future__ import print_function | |
| python3 print | |
| print("a", "b", sep=" ", end="\n") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| import os | |
| for root,dirs,files in os.walk('/tmp'): | |
| for name in files: | |
| print(os.path.join(root,name)) |