Boss与Leader

Boss Leader
驱动员工 指导员工
制造恐惧 制造热情
面对错误,喜欢使用人事惩罚手段 面对错误,喜欢寻找解决问题的技术或管理方法
只知道怎么做 展示怎么做
用人 发展人
从团队收割成绩 给予团队成绩
喜欢命令和控制 喜欢沟通和写作
喜欢说,“给我上” 喜欢说,“跟我上”

转自http://coolshell.cn/。

Ubuntu18使用root登录

为了系统安全,ubuntu默认是禁用root登录的,更是禁用root登录gui。所以,以下的操作,仅用于开发、测试里很特殊的情况,用完后,建议关闭。

#1、为root创建密码,创建密码后就可以su,也可以在cui登录root账号
sudo passwd root

#2、设置gdm运行root登录
sudo vi /etc/gdm3/custom.conf
#开启AllowRoot一行
[security]
AllowRoot=true

#3、设置gdm允许root登录
sudo vi /etc/pam.d/gdm-password
# 将下面一行注释掉
# auth required pam_succeed_if.so user != root quiet_success

#4、编辑.profile文件
sudo vi /root/.profile
# executed by Bourne-compatible login shells.
if [ "$BASH" ]; then
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
fi

# 最后一行替换成这个
if `tty -s`; then
mesg n
fi

#5、重启
sudo reboot

Ubuntu18设置静态IP

1、编辑配置文件

#打开配置文件
vi /etc/netplan/xxx.ymal

#其中enp0s3为固定ip
#其中enp0s8为dhcp
network:
    ethernets:
        enp0s3:
            addresses: [172.16.172.100/24]
            dhcp4: false
            gateway4: 172.16.172.2
            dhcp6: false
            optional: true
        enp0s8:
            addresses: []
            dhcp4: true
            optional: true
    version: 2

2、启用配置

netplan apply 

MacOS编译ipfs

1、安装go等必须的软件

brew install go

2、设置gopaht环境变量

export gopath=PAHT_TO_GOPATH

#然后在gopath下创建下面的目录
PAHT_TO_GOPATH/src/github.com/ipfs/

#设置必要的代理信息
export http_proxy=xxxx:xx
export https_proxy=xxxx:xx
export no_proxy="localhost, 127.0.0.1, 192.168.99.100, 根据你自己的实际情况进行处理"

3、下载源码

cd PAHT_TO_GOPATH/src/github.com/ipfs/
git clone https://github.com/ipfs/go-ipfs.git

4、编译go-ipfs

cd go-ipfs
make

会发现,gx无法获取所需的文件,原来是gx不会默认读取代理配置

5、下载gx代码

#然后在gopath下创建下面的目录
PAHT_TO_GOPATH/src/github.com/whyrusleeping/
cd PAHT_TO_GOPATH/src/github.com/whyrusleeping/
git clone https://github.com/whyrusleeping/gx.git
git clone https://github.com/whyrusleeping/gx-go.git

cd PAHT_TO_GOPATH/src/github.com/ipfs/
git clone https://github.com/ipfs/go-ipfs-api.git

6、修改go-ipfs-api代码,在文件shell.go中,增加一行代码

func NewShell(url string) *Shell {
        c := &gohttp.Client{
                Transport: &gohttp.Transport{
                        Proxy: gohttp.ProxyFromEnvironment, //请增加这一行
                        DisableKeepAlives: true,
                },
        }

        return NewShellWithClient(url, c)
}

7、编译gx及gx-go

cd PAHT_TO_GOPATH/src/github.com/whyrusleeping/gx
make
cd PAHT_TO_GOPATH/src/github.com/whyrusleeping/gx-go
make

8、用编译好的go及go-gx替换PAHT_TO_GOPATH/src/github.com/ipfs/go-ipfs/bin目录下对应的文件

9、编译ipfs

cd PAHT_TO_GOPATH/src/github.com/ipfs/go-ipfs
make

MacOS编译ethereum

1、安装go等必须的软件

brew install go

2、设置gopaht环境变量

export gopath=PAHT_TO_GOPATH

#然后在gopath下创建下面的目录
PAHT_TO_GOPATH/src/github.com/ethereum/

#设置必要的代理信息
export http_proxy=xxxx:xx
export https_proxy=xxxx:xx
export no_proxy="localhost, 127.0.0.1, 192.168.99.100, 根据你自己的实际情况进行处理"

3、下载源码

cd PAHT_TO_GOPATH/src/github.com/ethereum/
git clone https://github.com/ethereum/go-ethereum.git

4、编译

cd go-ethereum
make geth

MacOS编译fabric

1、安装docker、go等必须的软件

brew install docker dokcer-machine go
brew install gnu-tar --with-default-names
brew install libtool

2、开启dokcer deamon环境

docker-machine create forfabric
eval $(docker-machine env forfabric)

3、设置gopaht环境变量

export gopath=PAHT_TO_GOPATH

#然后在gopath下创建下面的目录
PAHT_TO_GOPATH/src/github.com/hyperledger/

#设置必要的代理信息
export http_proxy=xxxx:xx
export https_proxy=xxxx:xx
export no_proxy="localhost, 127.0.0.1, 192.168.99.100, 根据你自己的实际情况进行处理"

4、下载源码

cd PAHT_TO_GOPATH/src/github.com/hyperledger/
git clone https://github.com/hyperledger/fabric.git

5、编译gotolls

cd fabric
make gotools

6、编译native

make native

SonarQube集成单元测试结果

对于Java来说,最简单的就是用maven进行构建

#surefire-report:report -Daggregate=true要求多个模块的报告合成一个
#可以用site作为替代,比这个更简单
mvn clean install javadoc:aggregate -Dadditionalparam=-Xdoclint:none surefire-report:report -Daggregate=true

#-Dsonar.host.url指定SonarQube地址
#-Dsonar.scm.disabled要求SonarQube不要自己去更新SVN或GIT
#-Dsonar.junit.reportPaths是单元测试报告的路径
mvn sonar:sonar -Dsonar.host.url=http://IP:9000 -Dsonar.scm.disabled=True -Dsonar.junit.reportPaths=Path_To_Surefire_Report

对于CSharp项目来说,用VS自带的CodeCoverage最方便了

#准备
#我一般只指定项目key就好了,多数情况下就是Solution名称
#d:sonar.cs.vscoveragexml.reportsPath一定要指定到正确位置
MSBuild.SonarQube.Runner.exe begin /k:"项目Key" /n:"项目名称" /v:"项目版本" /d:sonar.cs.vscoveragexml.reportsPaths="%CD%\MyProject.coverage.xml"

#构建Solution
msbuild 项目名称

#生成coverage报告
"%VSINSTALLDIR%\Team Tools\Dynamic Code Coverage Tools\CodeCoverage.exe" collect /output:"%CD%\MyProject.coverage" "PATH_TO_TEST_DLL1" "PATH_TO_TEST_DLL2" "PATH_TO_TEST_DLL3"

#coverage报告转为XML版本
"%VSINSTALLDIR%\Team Tools\Dynamic Code Coverage Tools\CodeCoverage.exe" analyze /output:"%CD%\MyProject.coverage.xml" "%CD%\MyProject.coverage"

#完成
MSBuild.SonarQube.Runner.exe end

Linux常用命令14后台进程

1、后台运行命令

somecmd &
nohup somecmd &

2、查看当前后台运行的命令

jobs -l
# 展示当前终端的后台任务,+号表示当前任务,-号表示后一个任务。

ps -aux | grep somecmd
# a:显示所有程序,u:以用户为主的格式来显示,x:显示所有程序,不以终端机来区分

3、关闭当前后台运行的命令

# 通过jobs命令查看jobnum,然后执行
kill %jobnum

# 通过ps命令查看进程号PID,然后执行
kill %PID

4、前后台进程的切换与控制

#后台切换至前台
#fg命令:将后台中的命令调至前台继续运行
fg %jobnum

#前台切换至后台
#快捷键,将一个正在前台执行的命令放到后台,并且处于暂停状态
#[ctrl]+ z

#bg命令:将一个在后台暂停的命令,变成在后台继续执行
bg %jobnum

5、后台服务状态

service --status-all

编译guetzli

#1.下载并安装配置vcpkg
git clone https://github.com/microsoft/vcpkg.git
cd vcpkg
bootstrap-vcpkg.bat
vcpkg integrate install
vcpkg install libpng

# 如果用CMake,记录下面的输出路径
CMake projects should use:
"-DCMAKE_TOOLCHAIN_FILE=D:/Build/vcpkg/scripts/buildsystems/vcpkg.cmake"

#2.下载guetzli
git clone https://github.com/google/guetzli.git

#3.用VS2017进行编译

#4.测试效果
整体上压缩比率还是很不错的,但这个压缩速度,还是放弃吧。

Update:
如果是图像压缩的话,现在webp格式还是很不错的,可以直接下载工具:
https://developers.google.com/speed/webp/download
https://chromium.googlesource.com/webm/libwebp/