Skip to content

Instantly share code, notes, and snippets.

View zh-f's full-sized avatar
:shipit:
Focusing

Fan Zhang zh-f

:shipit:
Focusing
View GitHub Profile
@zh-f
zh-f / install-tmux
Last active July 21, 2022 17:23 — forked from relaxdiego/install-tmux
Install tmux 2.6 on CentOS 7.1
# install deps
yum install gcc kernel-devel make ncurses-devel
# DOWNLOAD SOURCES FOR LIBEVENT AND MAKE AND INSTALL
wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
tar -xvzf libevent-2.0.21-stable.tar.gz
cd libevent-2.0.21-stable
./configure --prefix=/usr/local
make
sudo make install
@zh-f
zh-f / testlink-xml-to-csv.py
Created July 9, 2022 16:25 — forked from koichirok/testlink-xml-to-csv.py
Small Python 2 script to convert exported TestLink test cases (test suite) to CSV.
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
@zh-f
zh-f / pip-ssl.sh
Created September 2, 2020 05:54
Fix "pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available"
brew update && brew upgrade
brew uninstall --ignore-dependencies openssl;
brew install https://github.com/tebelorg/Tump/releases/download/v1.0.0/openssl.rb
$ 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
@zh-f
zh-f / exercise-images.go
Created June 11, 2020 01:56
Solution of Exercise: Images
package main
import (
"golang.org/x/tour/pic"
"image"
"image/color"
)
type Image struct{
width, height int
@zh-f
zh-f / exercise-rot-reader.go
Created June 11, 2020 01:28
Solution of Exercise: rot13Reader
package main
import (
"io"
"os"
"strings"
)
type rot13Reader struct {
r io.Reader
@zh-f
zh-f / exercise-reader.go
Created June 10, 2020 03:29
Solution of Exercise: Readers
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)]
@zh-f
zh-f / exercise-errors.go
Created June 10, 2020 02:25
Solution of Exercise: Errors
package main
import (
"fmt"
)
type ErrNegativeSqrt float64
func (e ErrNegativeSqrt) Error() string{
return fmt.Sprintf("cannot Sqrt negative number: %v\n", float64(e))
@zh-f
zh-f / exercise-stringer.go
Created June 10, 2020 02:01
Solution of Exercise: Stringers
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],)
}