Skip to content

Instantly share code, notes, and snippets.

View chenzhihao's full-sized avatar

Zhihao Chen chenzhihao

View GitHub Profile
@chenzhihao
chenzhihao / golang-nuts.go
Created October 9, 2018 04:29 — forked from ryanfitz/golang-nuts.go
two ways to call a function every 2 seconds
package main
import (
"fmt"
"time"
)
// Suggestions from golang-nuts
// http://play.golang.org/p/Ctg3_AQisl
@chenzhihao
chenzhihao / docker-compose.yml
Created November 7, 2018 06:36
kafka docker compose file
version: '3'
services:
zookeeper:
image: wurstmeister/zookeeper
ports:
- "2181:2181"
kafka:
image: wurstmeister/kafka:1.0.1
ports:
- 9092:9092
@chenzhihao
chenzhihao / go_interface.go
Created October 14, 2019 04:36
The concrete value stored in an interface is not addressable
package main
import (
"fmt"
)
type Orange struct {
}
/* this will not work, as the NewOrange return concrete as interface, which is not addressable