Author Archives: Huang Shiyang

Helm install

This guide shows how to install the Helm CLI. Helm can be installed either from source, or from pre-built binary releases. From The Helm Project The Helm project provides two ways to fetch and install Helm. These are the official methods to get Helm... Read More | Share it now!


Kubernetes secrets by example You don’t want sensitive information such as a database password or an API key kept around in clear text. Secrets provide you with a mechanism to use such information in a safe and reliable way with the following... Read More | Share it now!

Cross-Compiling Golang …

Compiling your go code into a binary is pretty simple: This will build the binary for your current OS and architecture. But compiling binaries for other operating systems and even architectures is also possible. You just need to modify a few... Read More | Share it now!

golang解析json格式 — 全

项目中客户端和服务端的交互数据部分为json,因此在服务端就得解析,复杂的json解析起来其实还是挺费劲的。 交互的数据类似如下格式: 需要将json格式中的w字段取出来,并且拼成结果串进行展示 从json数组中获取ws ws是数组,数组元素为object cw是数组,数组元素为object w是string 从cw遍历获取w字段 初步实现如下: 这样实现,一层一层去转换类型,再去获取元素有点麻烦。既然是已知的json数据结构,那么可以定义好结构体,再去进行解析。 注意定义的时候变量名第一个字母要大写,也可以使用工具来自动生成定义;用工具生成的挺漂亮: 上面的元素有json:"sn"强制说明,因此如果只需获取对应的元素,其他元素不定义也是可以的。另外还有一种数据就是数组当中的元素还是数组,并且最后数组包含的是number或者string类型,需要再重写一个函数才行,数据如下,获取当中的元素 搜索到一段代码如下,重新实现了UnmarshalJSON ... Read More | Share it now!

Nginx限制访问速率和最大并发连接数模块–limit (防止DDOS攻击)

Tengine版本采用http_limit_req_module进行限制 具体连接请参考 和官方nginx类似,不过支持多个变量,并且支持多个limit_req_zone的设置。比如: limit_req_zone... Read More | Share it now!

Start/Stop Compute Engine Instance from Cloud function I design a web service that will running on Google Compute Engine to do some long-time data processing task. The data will be stored at Cloud Storage... Read More | Share it now!

关于大内存页面 transparent_hugepage

Transparent Huge Pages (THP) are enabled by default in RHEL 6 for all applications. The kernel attempts to allocate hugepages whenever possible and any Linux process will receive 2MB pages if the mmap region is 2MB naturally aligned. The main kernel... Read More | Share it now!


python使用MySQLdb模块连接MySQL 1.安装驱动 目前有两个MySQL的驱动,我们可以选择其中一个进行安装: MySQL-python:是封装了MySQL... Read More | Share it now!