Skip to content

Instantly share code, notes, and snippets.

zenglian /
Created February 12, 2019 09:35 — forked from wojteklu/
Summary of 'Clean code' by Robert C. Martin

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 /
Last active August 30, 2018 05:45
Optimize Keyboard Layout for Developers

Optimize Keyboard Layout for Developers


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.


zenglian /
Last active February 18, 2021 14:10




  • 对于绝大部分人,"的使用频率大于'
  • 对于开发人员,Esc键的使用频率大于Caps Lock键。
  • 对于Java系/JavaScript系/C系/C#/Go等程序员,{/}的使用频率要明显大于[/]



zenglian /
Last active February 6, 2024 13:28
auto login with cisco anyconnect (password saved, silent mode)

Cisco AnyConnect: auto login in silent mode

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


create a file .login_info as below:

connect your.server.url    
zenglian /
Last active August 19, 2018 09:48
log4j socket server: save log events from different clients to separate files

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


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.


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.