Skip to content

Instantly share code, notes, and snippets.

View Harold2017's full-sized avatar
😃

Harold Harold2017

😃
View GitHub Profile
@Harold2017
Harold2017 / Tencent-Cloud-setup-Shadowsocks-and-Google-BBR.md
Last active March 1, 2019 09:25
Tencent-Cloud-setup-Shadowsocks-and-Google-BBR

Update linux kernel

Find avaliable kernel

sudo apt-get update
apt-cache search --names-only linux-image

I found linux-image-4.15.0-36-generic is avaliable both in the kernel list and bbr list

Update both image and corresponding headers

@Harold2017
Harold2017 / Pipenv-on-Mac.md
Last active March 1, 2019 09:19
Install and setup pipenv on Mac

Install pipenv

with brew

brew install pipenv

with pip3

pip3 install pipenv

check port occupied by which process

sudo lsof -i
sudo lsof -i | grep TCP
sudo lsof -i :80 | grep LISTEN
sudo netstat -lptu
sudo netstat -tulpn
sudo ls -l /proc/$pid/exe
docker rmi $(docker images -q -f dangling=true)
# docker rmi --force $(docker images -q -f dangling=true)
@Harold2017
Harold2017 / client.py
Created March 15, 2019 09:29
python gRPC client side reflection
from grpc_reflection.v1alpha import reflection
def list_services(address):
channel = grpc.secure_channel(address, get_client_credentials())
stub = reflection._reflection_pb2_grpc.ServerReflectionStub(channel)
def gen():
yield reflection._reflection_pb2.ServerReflectionRequest(host=address, list_services='')
@Harold2017
Harold2017 / ImageMagick_with_rsvg.md
Created March 21, 2019 09:14
Solve svg rendering problem when composite image with transparent svg

check ImageMagick format:

covert -list format

check ImageMagick config:

convert -list configure | grep svg

install rsvg

apt-get install librsvg2-bin

build ImageMagick with rsvg

wget https://imagemagick.org/download/ImageMagick-6.9.10-34.tar.gz
@Harold2017
Harold2017 / terminal_ss.md
Created April 21, 2019 16:57
terminal with ss

add alias function to ~/.zshrc

# proxy list
proxy() {
  export all_proxy=socks5://127.0.0.1:1086
  export http_proxy=http://127.0.0.1:1087
 export https_proxy=http://127.0.0.1:1087
@Harold2017
Harold2017 / go_cpu.md
Created June 25, 2019 04:48
golang cpu usage in docker

Golang CPU usage in docker

// test.go
package main

import (
	"fmt"