Skip to content

Instantly share code, notes, and snippets.

View RavenZZ's full-sized avatar
🎯
Focusing

Raven RavenZZ

🎯
Focusing
View GitHub Profile
@RavenZZ
RavenZZ / GoMgoSample-1.go
Created April 3, 2018 05:35
Sample Go and MGO example
type (
// BuoyCondition contains information for an individual station.
BuoyCondition struct {
WindSpeed float64 `bson:"wind_speed_milehour"`
WindDirection int `bson:"wind_direction_degnorth"`
WindGust float64 `bson:"gust_wind_speed_milehour"`
}
// BuoyLocation contains the buoy's location.
BuoyLocation struct {
@RavenZZ
RavenZZ / gist:6194db8a94bdab2f94f5d3eb75421944
Created April 3, 2018 05:35
Install Maven with Yum on Amazon Linux
sudo wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo
sudo sed -i s/\$releasever/6/g /etc/yum.repos.d/epel-apache-maven.repo
sudo yum install -y apache-maven
mvn --version
@RavenZZ
RavenZZ / clean log file.sh
Last active April 3, 2018 05:38
n天内未修改 size超过n
# n天内未修改
find /home/deploy/micro-services -name "*.log" -mtime +3 |while read line; do cat /dev/null > "$line"; done;
# 大小超过800M
find /home/deploy/micro-services -name "*.log" -size +800M |while read line; do cat /dev/null > "$line"; done;
docker cp CONTAINER:FILEPATH LOCALFILEPATH
vi LOCALFILEPATH
docker cp LOCALFILEPATH CONTAINER:FILEPATH
@RavenZZ
RavenZZ / .md
Created February 26, 2018 02:12
HowTo: Find Out My Linux Distribution Name and Version

Method #1: /etc/*-release file

cat /etc/*-release

Method #2: lsb_release Command To Find Out Linux Distribution Name/Version

@RavenZZ
RavenZZ / Dockerfile
Created February 17, 2018 06:44 — forked from crosbymichael/Dockerfile
Docker with supervisor
FROM ubuntu
RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list
RUN apt-get update
RUN apt-get upgrade
RUN apt-get install -y openssh-server supervisor
ADD sshd.conf /etc/supervisor/conf.d/sshd.conf
RUN mkdir -p /var/run/sshd
func merge(a, b <-chan int) <-chan int {
c := make(chan int)
go func() {
defer close(c)
for a != nil || b != nil {
select {
case v, ok := <-a:
if !ok {
fmt.Println("a is done")
a = nil
@RavenZZ
RavenZZ / 1_kubernetes_on_macOS.md
Created December 12, 2017 15:40 — forked from kevin-smets/1_kubernetes_on_macOS.md
Local Kubernetes setup on macOS with minikube on VirtualBox and local Docker registry

Requirements

Minikube requires that VT-x/AMD-v virtualization is enabled in BIOS. To check that this is enabled on OSX / macOS run:

sysctl -a | grep machdep.cpu.features | grep VMX

If there's output, you're good!

Prerequisites

@RavenZZ
RavenZZ / gist:1b1a6cae10434aa3695b0ee7aa5f7815
Created November 7, 2017 12:24 — forked from dmitshur/gist:6927554
How to `go get` private repos using SSH key auth instead of password auth.
$ ssh -A vm
$ git config --global url."[email protected]:".insteadOf "https://github.com/"
$ cat ~/.gitconfig
[url "[email protected]:"]
	insteadOf = https://github.com/
$ go get github.com/private/repo && echo Success!
Success!
@RavenZZ
RavenZZ / concurrency-in-go.md
Created October 30, 2017 13:20 — forked from kachayev/concurrency-in-go.md
Channels Are Not Enough or Why Pipelining Is Not That Easy