kudu - usage
安装
新版本安装参考这里。
centos
build
1 | !/bin/bash |
对于 centos 7 默认 gcc 是 4.8,用
yum install gcc72-c++
升级到 gcc-g++ 7.2
package
1 | 下载 repo 配置 |
linux - crontab
命令格式
1 | MIN HOUR DOM MON DOW CMD |
查看
1 | crontab -l |
编辑
1 | crontab -e |
启动时运行
1 | @reboot /home/ubuntu/app/consul/start.sh |
时间格式
1 | MIN HOUR DOM MON DOW CMD |
设置 PATH
1 | crontab -e # 开头添加如下内容 |
python - generate wheel
安装
1 | pip3 install wheel setuptools |
创建 setup.py
1 | from setuptools import setup |
setup.py
示例
1 | import os.path |
打包工程
1 | python setup.py bdist_wheel --universal |
python - request
引入
1 | import urllib.request |
发送请求
1 | q = urllib.request.Request(url=url, method='GET') |
c++ compiler
指定编译器
1 | export PATH=/opt/scylladb/bin:$PATH |
编译选项
1 | warning |
附录
-Wall
1 | -Waddress -Warray-bounds (only with -O2) -Wc++0x-compat -Wchar-subscripts |
-Wextra
1 | -Wclobbered -Wempty-body -Wignored-qualifiers -Wmissing-field-initializers |
warn 示例配置
1 | -Wall -Wextra -Waggregate-return -Wcast-align -Wcast-qual -Wdisabled-optimization -Wdiv-by-zero -Wendif-labels -Wformat-extra-args -Wformat-nonliteral -Wformat-security -Wformat-y2k -Wimplicit -Wimport -Winit-self -Winline -Winvalid-pch -Wjump-misses-init -Wlogical-op -Werror=missing-braces -Wmissing-declarations -Wno-missing-format-attribute -Wmissing-include-dirs -Wmultichar -Wpacked -Wpointer-arith -Wreturn-type -Wsequence-point -Wsign-compare -Wstrict-aliasing -Wstrict-aliasing=2 -Wswitch -Wswitch-default -Werror=undef -Wno-unused -Wvariadic-macros -Wwrite-strings -Wc++-compat -Werror=declaration-after-statement -Werror=implicit-function-declaration -Wmissing-prototypes -Werror=nested-externs -Werror=old-style-definition -Werror=strict-prototypes |
内存泄漏排查
简述
1 | pid=$(pgrep ranker_service) |
dump
1 | gdb bin/ranker_service core.9085 |
统计 vtable
1 | hexdump result.bin | awk '{printf "%s%s%s%s\n%s%s%s%s\n", $5,$4,$3,$2,$9,$8,$7,$6}' | sort | uniq -c | sort -nr > hex.t |
参考
nginx creat self-signed SSL certificate
创建证书
1 | 自认证证书 |
或者
1 | openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/nginx-selfsigned.key -out /etc/ssl/certs/nginx-selfsigned.crt |
设置 nginx 使用 ssl
把生成的整数文件放到 /certs
目录下。
1 | sudo mkdir /certs |
生成 dhparam.pem
文件。
1 | openssl dhparam -out /certs/dhparam.pem 4096 |
创建 /etc/nginx/snippets/self-signed.conf
,输入如下内容。
1 | ssl_certificate /certs/nginx-selfsigned.crt; |
设置 nginx site 配置。
1 | server { |
配置 http 跳转 https
按需配置。
1 | server { |
参考
gperftools
安装
1 | yum install gperftools gperftools-devel -y |
Heap Profile
1 | dump |