enjoy coding, enjoy life.

Code

Avoid stuck after ‘SSH2_MSG_SERVICE_ACCEPT received’

It is becoming pretty slow in SSH to a CentOS server.

Trying to print a verbose log:

Bash
$ ssh -vvvv my-host
....
debug3: send packet: type 21
debug2: set_newkeys: mode 1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug3: receive packet: type 21
debug1: SSH2_MSG_NEWKEYS received
debug2: set_newkeys: mode 0
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: /Users/user/.ssh/id_rsa RSA SHA256:XXXXX/gNY explicit
debug2: pubkey_prepare: done
debug3: send packet: type 5
debug3: receive packet: type 7
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug3: receive packet: type 6
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug3: send packet: type 50
..... <<<-- long long long silence here
debug3: receive packet: type 51 <<<-- and then continue to access the server
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug3: start over, passed a different list publickey,gssapi-keyex,gssapi-with-mic,password
debug3: preferred publickey,keyboard-interactive,password

Life

染头发记

因为各种原因,白发增多明显,并且成簇。同时本体毛发偏棕黄色。同时由于公司搬家几公里,去某家理发店不再方便。因此决定对头发做一下染色处理,同时正好耗尽余额以后换店。

Code

Go Proxy Configurations

To speed up our dependencies updating for golang, or prepare some patterns for our special libraries, we probably consider to use a proxy to speed it up.

Life

为什么这个博客有很多台湾访客?

这几年这个博客都在使用 Google Analytics 服务。虽然每天被访问页面次数也就几百个,但我有时候也有点臭美的想知道是不是真的有用户在访问。最近偶然看了下 GA 的分析,发现来自台湾的用户特别高。

Code

The short-circuiting in bash

Bash script writing is a import approach to configure the linux system. Suppose we wish to add a user if not exists, the command may seems as follow:

Bash
TARGET_USER=alice
if (! id -u $TARGET_USER > /dev/null 2>&1 ); then
    echo "creating user $TARGET_USER"
    # adduser $TARGET_USER
fi

However, it is kind of too long. In this case short-circuiting is a alternative solution.

Code

A simple workflow to create a clean python library based on Anaconda

The open-source Anaconda Distribution is an easy way to perform Python/R data science and machine learning on Linux, Windows, and Mac OS X. We could easily prepare an isolated and constant environment on anywhere based on a configure file.

Considering the various kind of strange errors due to the different versions of python and python libraries, this management tool makes our life much more comfortable in deploying and cooperating.

Code

Deploy a HDFS environment

This post will introduce some basic progress & configuration of deploying a HDFS cluster, and some error diagnosis.

Please see this post for a topic collection of distributed computing.

Code

Gracefully shutdown a http server in golang

To gracefully shutdown a http server requires a few steps.

The http library's serving function will block over there when getting started, until we call http.Server.Close(). As for us, we can invoke the starting function in a goroutine, and call close in another one.