$ sudo mkdir -p /etc/systemd/system/docker.service.d
$ edit /etc/systemd/system/docker.service.d/http-proxy.conf
[Service]
Environment="HTTP_PROXY=http://proxy.example.com:80/"
Environment="HTTPS_PROXY=http://proxy.example.com:80/"
Environment="NO_PROXY=localhost,127.0.0.1,docker-registry.example.com,.corp"
$ sudo systemctl daemon-reload
$ $ sudo systemctl restart docker
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 binarySearch(sortedList []int, val int) int { | |
a, b := 0, len(sortedList) | |
for a < b { | |
m := a + (b-a)/2 | |
if val < sortedList[m] { | |
b = m | |
} else if val > sortedList[m] { | |
a = m + 1 | |
} else { | |
return m |
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" | |
func main() { | |
list := []int{1, 2, 3, 4} | |
{ | |
head := createLinkedListBySlice(list) | |
for { |
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 ( | |
"math/rand" | |
"sort" | |
"time" | |
) | |
func main() { | |
slice := rand.Perm(1000) |
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" | |
func main() { | |
length := 1000 | |
slice := make([]int, length) | |
for i := 0; i < length; i++ { | |
slice[i] = i | |
} |
add flowing to profile
array field and save
{
"acrylicOpacity": 0.75,
"closeOnExit": true,
"colorScheme": "Campbell",
"commandline": "C:/Program Files/Git/usr/bin/bash.exe --login",
"cursorColor": "#FFFFFF",
"cursorShape": "bar",
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 main() { | |
// ethereum address generator | |
{ | |
var uncompressed = make([]byte, 65) | |
hash := sha3.NewLegacyKeccak256() | |
hash.Write(uncompressed[1:]) | |
address := fmt.Sprintf("%#x", hash.Sum(nil)[12:]) | |
} | |
// EOS address generator |
下载:
go get -tags 'mysql' -u -v github.com/golang-migrate/migrate/cmd/migrate
创建名称为 test 的数据库:
create database test;