代码改变世界

go 语言并行

2020-03-04 10:04 by ZealouSnesS, 269 阅读, 0 推荐, 收藏, 编辑
摘要:使用 go func_name() 算是并发,而不是并行。 还需要 import ( "runtime" ) runtime.GOMAXPROCS(x) 这两部来设置并行的协程数x,go 1.5版本后这个协程数默认是计算机核数,但是最好还是手动设置一下。然后就能并行了。 阅读全文

发送带json body的get请求

2020-01-08 14:46 by ZealouSnesS, 4539 阅读, 0 推荐, 收藏, 编辑
摘要:用curl: curl -X GET "127.0.0.1:8001" -d "{'a':1,'b':2}" 用python requests: import requests requests.get(url="127.0.0.1:8001", data={'a':1,'b':2}) 参考:htt 阅读全文

将python程序做成image

2020-01-08 14:40 by ZealouSnesS, 395 阅读, 0 推荐, 收藏, 编辑
摘要:做一个正常的image(958M): FROM python:3.7 COPY . /app WORKDIR /app RUN pip install -r requirements.txt CMD ["gunicorn", "-w 4", "main:app"] 做一个小一点的image (139 阅读全文

python 读写yaml

2020-01-08 14:25 by ZealouSnesS, 252 阅读, 0 推荐, 收藏, 编辑
摘要:import ruamel.yaml with open(yamlfilepath, 'r', encoding='utf-8') as f: yamlobj = ruamel.yaml.safe_load(f) # use yamlobj like python dict 阅读全文

dict 使用多个key组成的path赋值

2020-01-08 14:23 by ZealouSnesS, 446 阅读, 0 推荐, 收藏, 编辑
摘要:def nested_set(dic, keys, value): for key in keys[:-1]: dic = dic.setdefault(key, {}) dic[keys[-1]] = value 阅读全文

prometheus同时执行多个查询

2020-01-08 14:17 by ZealouSnesS, 2244 阅读, 0 推荐, 收藏, 编辑
摘要:{__name__=~"metricA|metricB|metricC",container_name=~"frontend|backend|db"} 阅读全文

压力测试 Apache ab

2019-12-23 11:48 by ZealouSnesS, 359 阅读, 0 推荐, 收藏, 编辑
摘要:https://www.jianshu.com/p/166a4ea8aade https://httpd.apache.org/docs/2.4/programs/ab.html 安装: 按照提示安装就行 执行: ab -k -n 100 -c 10 -H 'Accept: */*' -H 'Coo 阅读全文

kubernetes reference

2019-12-19 16:48 by ZealouSnesS, 353 阅读, 0 推荐, 收藏, 编辑
摘要:hyperkube在kubernetes pod里面执行kubernetes命令(例如kubectl) https://feisky.gitbooks.io/kubernetes/components/hyperkube.html kubernetes yaml文件kind类型定义文档 https: 阅读全文

python 深拷贝

2019-12-18 17:15 by ZealouSnesS, 264 阅读, 0 推荐, 收藏, 编辑
摘要:深拷贝是将对象全拷贝,包括嵌套对象 def deepcopy(cls): if isinstance(cls, dict): dct = {} for k, v in cls.items(): dct[k] = deepcopy(v) return dct elif isinstance(cls, 阅读全文

[ argo workflow ]

2019-12-12 17:53 by ZealouSnesS, 518 阅读, 0 推荐, 收藏, 编辑
摘要:https://argoproj.github.io/docs/argo/examples/README.html 阅读全文
上一页 1 2 3 4 5 6 7 8 ··· 36 下一页