This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"io" | |
"net/http" | |
_ "github.com/mattes/migrate/driver/postgres" | |
"github.com/mattes/migrate/migrate" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Drop table users; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo nvram boot-args="kext-dev-mode=1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var sliceOfInt []int | |
var sliceOfString []int | |
var sliceOfUser []User | |
var sliceOfMap []map[string]int | |
letters := []string{"a", "b", "c", "d"} | |
numbers := []string{1, 2, 3, 4, 5} | |
numbers := []User{ User{ Name: "Thuc"}, User{Name: "Mr Vu"} } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var largeOfList []int | |
var result []int | |
for _, item := range largeOfList { | |
if item.Status == true { | |
result = append(result, item) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fatal error: runtime: out of memory | |
runtime stack: | |
runtime.throw(0xd4b870, 0x16) | |
/home/sss/go/src/runtime/panic.go:530 +0x90 | |
runtime.sysMap(0xc88b750000, 0x2f120000, 0xc8204ec000, 0x1113238) | |
/home/sss/go/src/runtime/mem_linux.go:206 +0x9b | |
runtime.(*mheap).sysAlloc(0x10f8c60, 0x2f120000, 0x2000000000002) | |
/home/sss/go/src/runtime/malloc.go:429 +0x191 | |
runtime.(*mheap).grow(0x10f8c60, 0x17890, 0x0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// func make([]T, len, cap) []T | |
var list []int | |
list = make([]int, 5, 50) | |
list == []int{1, 2, 3, 4, 5} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"crypto/md5" | |
"fmt" | |
"html/template" | |
"io" | |
"io/ioutil" | |
"log" | |
"net/http" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible | |
filetype off | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
" let Vundle manage Vundle, required | |
Plugin 'VundleVim/Vundle.vim' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo yum install java-1.8.0-openjdk | |
mkdir /tmp/install_kafka | |
cd /tmp/install_kafka | |
curl http://www-eu.apache.org/dist/kafka/1.1.0/kafka_2.11-1.1.0.tgz --output kafka_2.11-1.1.0.tgz | |
mkdir -p /opt/ | |
cp /tmp/install_kafka/kafka_2.11-1.1.0.tgz /opt/kafka_2.11-1.1.0.tgz | |
cd /opt/ | |
tar -xzf kafka_2.11-1.1.0.tgz | |
ln -s /opt/kafka_2.11-1.1.0 /opt/kafka | |
cd /opt/kafka/ |