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
#!/usr/bin/python2 | |
# -*- coding=gbk -*- | |
# | |
# The original version can be found at https://www.programmersought.com/article/60554969634/. | |
# The differences from original version are as follows: | |
# * added shbang line so that we can know this is the python 2 script. | |
# * added SUITE_NAMES column. | |
# | |
import glob | |
import sys |
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
cd "$(brew --repo)" | |
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git | |
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core" | |
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git | |
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile | |
source ~/.bash_profile |
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
brew update && brew upgrade | |
brew uninstall --ignore-dependencies openssl; | |
brew install https://github.com/tebelorg/Tump/releases/download/v1.0.0/openssl.rb |
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
$ yum list installed | grep docker | |
docker.x86_64 2:1.13.1-91.git07f3374.el7.centos | |
docker-client.x86_64 2:1.13.1-91.git07f3374.el7.centos | |
docker-common.x86_64 2:1.13.1-91.git07f3374.el7.centos | |
docker-compose.noarch 1.18.0-2.el7 @MJQ-CTyun-Yum-epel | |
python34-docker.noarch 2.6.1-1.el7 @MJQ-CTyun-Yum-epel | |
python34-docker-pycreds.noarch 0.2.1-1.el7 @MJQ-CTyun-Yum-epel | |
python34-dockerpty.noarch 0.4.1-9.el7 @MJQ-CTyun-Yum-epel |
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 ( | |
"golang.org/x/tour/pic" | |
"image" | |
"image/color" | |
) | |
type Image struct{ | |
width, height int |
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 ( | |
"io" | |
"os" | |
"strings" | |
) | |
type rot13Reader struct { | |
r io.Reader |
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 "golang.org/x/tour/reader" | |
type MyReader struct{} | |
// TODO: Add a Read([]byte) (int, error) method to MyReader. | |
func (r *MyReader) Read (b []byte) (n int, err error){ | |
b = b[:cap(b)] |
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" | |
) | |
type ErrNegativeSqrt float64 | |
func (e ErrNegativeSqrt) Error() string{ | |
return fmt.Sprintf("cannot Sqrt negative number: %v\n", float64(e)) |
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" | |
type IPAddr [4]byte | |
// TODO: Add a "String() string" method to IPAddr. | |
func (ip IPAddr) String() string{ | |
return fmt.Sprintf("%v.%v.%v.%v", ip[0], ip[1], ip[2], ip[3],) | |
} |
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 ( | |
"golang.org/x/tour/wc" | |
"strings" | |
) | |
func WordCount(s string) map[string]int { | |
counter := make(map[string]int) | |
for _, v := range strings.Fields(s) { |
NewerOlder