Skip to content

Instantly share code, notes, and snippets.

@wjx0912
wjx0912 / kubernetes_nginx.yml
Created April 3, 2018 13:25
kubernetes yaml example: nginx
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: nginx-deployment
spec:
replicas: 2
template:
metadata:
labels:
app: nginx
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: node-exporter
spec:
template:
metadata:
labels:
app: node-exporter
annotations:
@wjx0912
wjx0912 / kubernetes_test_job.yml
Created April 3, 2018 14:46
kubernetes test job
apiVersion: batch/v1
kind: Job
metadata:
name: myjob
spec:
template:
metadata:
name: myjob
spec:
containers:
@wjx0912
wjx0912 / kubernetes_test_cronjob.yml
Created April 3, 2018 14:55
kubernetes test cronjob
apiVersion: batch/v2alpha1
kind: CronJob
metadata:
name: hello
spec:
schedule: "*/1 * * * *"
jobTemplate:
spec:
template:
spec:
@wjx0912
wjx0912 / depolyment.yml
Created April 4, 2018 01:36
kubernetes service demo
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: httpd
spec:
replicas: 3
template:
metadata:
labels:
app: httpd
@wjx0912
wjx0912 / hello.cpp
Created April 8, 2018 03:16
hello world example: c++ language
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
cout << "hello, world." << endl;
return 0;
}
@wjx0912
wjx0912 / golang_timer_demo.go
Created April 11, 2018 13:35
golang: three way use timer
// (A)
time.AfterFunc(5 * time.Minute, func() {
fmt.Printf("expired")
}
// (B) create a Timer object
timer := time.NewTimer(5 * time.Minute)
<-timer.C
fmt.Printf("expired")
@wjx0912
wjx0912 / boost_split_demo.cpp
Last active May 18, 2018 03:33
boost split demo
std::string src = " aa |b \t ccc[gg] ";
std::vector<std::string> list;
boost::split(list, std::string(src), boost::is_any_of(" \t,;\r\n|[]"), boost::token_compress_on);
if (list.size() <= 0)
return;
@wjx0912
wjx0912 / nodejs_client_test.js
Created April 17, 2018 07:20
node.js client test
var net = require('net');
var port = 9922;
var host = '192.168.7.160';
var client= new net.Socket();
//创建socket客户端
client.setEncoding('binary');
//连接到服务端
client.connect(port,host,function(){
client.write('hello server');