Skip to content

Instantly share code, notes, and snippets.

zenglian

Block or report user

Report or block zenglian

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@zenglian
zenglian / clean_code.md
Created Feb 12, 2019 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin
View clean_code.md

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@zenglian
zenglian / layout-en.md
Last active Aug 30, 2018
Optimize Keyboard Layout for Developers
View layout-en.md

Optimize Keyboard Layout for Developers

Design

For most people, " is much more frequently used than '.
For most developers,Esc is much more frequently used than Caps Lock.
For programmers of Java/JavaScript/C/C++/C# etc, {/} is more frequently used than [/].

So it's not bad to swap them.

Configuration

@zenglian
zenglian / layout.md
Last active Aug 30, 2018
程序员的键盘布局优化方案与配置
View layout.md

程序员的键盘布局优化

方案

据粗略统计,对于绝大部分人而言,"的使用频率远大于'
对于开发人员而言,Esc键的使用频率远大于Caps Lock键。
对于Java/JavaScript/C/C++/C#等多种语言的程序员而言,{/}的使用频率要大于[/]
所以,优化方案为交换以上键。

配置

Linux

@zenglian
zenglian / cisco-anyconnect-auto-login.md
Last active Aug 15, 2018
auto login with cisco anyconnect (password saved, silent mode)
View cisco-anyconnect-auto-login.md

Cisco AnyConnect: auto login in silent mode

This gist is for Linux. For windows is the same thing.

Connect

create a file .login_info as below:

connect your.server.url    
usernanme  
@zenglian
zenglian / log4j-socket-server-separate-files.md
Last active Aug 19, 2018
log4j socket server: save log events from different clients to separate files
View log4j-socket-server-separate-files.md

log4j socket server: save log events from each client to a separate file

Issue

An application can run on multiple hosts and if we want to collect the logs from all clients we can use log4j's socket appender.

Log4j has implemented SimpleSocketServer which calls SocketNode which collects all events from all clients to a single log file so it's difficult to identify them.

Goal

Out goal is to collect events from each client to a separate log file with file name xxx-{client}.log where {client} is the client address.

You can’t perform that action at this time.