Skip to content

Instantly share code, notes, and snippets.

View shanezhiu's full-sized avatar
🎯
Focusing

shane shanezhiu

🎯
Focusing
View GitHub Profile
  • What do Etcd, Consul, and Zookeeper do?
    • Service Registration:
      • Host, port number, and sometimes authentication credentials, protocols, versions numbers, and/or environment details.
    • Service Discovery:
      • Ability for client application to query the central registry to learn of service location.
    • Consistent and durable general-purpose K/V store across distributed system.
      • Some solutions support this better than others.
      • Based on Paxos or some derivative (i.e. Raft) algorithm to quickly converge to a consistent state.
  • Centralized locking can be based on this K/V store.
@shanezhiu
shanezhiu / kind-code-review.md
Created August 23, 2022 09:06 — forked from ross-spencer/kind-code-review.md
Code Review (CR) Guidelines and Principles
Status: Work in progress
Use: Unofficial
Language: Python

Kind code review

Summary

@shanezhiu
shanezhiu / git-commit-template.md
Created December 13, 2020 02:16 — forked from lisawolderiksen/git-commit-template.md
Use a Git commit message template to write better commit messages

Using Git Commit Message Templates to Write Better Commit Messages

One of my colleagues shared an article on writing (good) Git commit messages today: How to Write a Git Commit Message. This excellent article explains why good Git commit messages are important, and explains what constitutes a good commit message. I wholeheartedly agree with what @cbeams writes in his article. (Have you read it yet? If not, go read it now. I'll wait.) It's sensible stuff. So I decided to start following the

@shanezhiu
shanezhiu / semantic-pedantic.md
Created December 5, 2020 03:23 — forked from jashkenas/semantic-pedantic.md
Why Semantic Versioning Isn't

Spurred by recent events (https://news.ycombinator.com/item?id=8244700), this is a quick set of jotted-down thoughts about the state of "Semantic" Versioning, and why we should be fighting the good fight against it.

For a long time in the history of software, version numbers indicated the relative progress and change in a given piece of software. A major release (1.x.x) was major, a minor release (x.1.x) was minor, and a patch release was just a small patch. You could evaluate a given piece of software by name + version, and get a feeling for how far away version 2.0.1 was from version 2.8.0.

But Semantic Versioning (henceforth, SemVer), as specified at http://semver.org/, changes this to prioritize a mechanistic understanding of a codebase over a human one. Any "breaking" change to the software must be accompanied with a new major version number. It's alright for robots, but bad for us.

SemVer tries to compress a huge amount of information — the nature of the change, the percentage of users that wil

@shanezhiu
shanezhiu / tmux-cheatsheet.markdown
Created November 16, 2020 10:09 — forked from ryerh/tmux-cheatsheet.markdown
Tmux 快捷键 & 速查表 & 简明教程

注意:本文内容适用于 Tmux 2.3 及以上的版本,但是绝大部分的特性低版本也都适用,鼠标支持、VI 模式、插件管理在低版本可能会与本文不兼容。

Tmux 快捷键 & 速查表 & 简明教程

启动新会话:

tmux [new -s 会话名 -n 窗口名]

恢复会话:

@shanezhiu
shanezhiu / exceptions-tree.php
Created September 29, 2020 02:12 — forked from mlocati/exceptions-tree.php
Throwable and Exceptions tree
<?php
if (!function_exists('interface_exists')) {
die('PHP version too old');
}
$throwables = listThrowableClasses();
$throwablesPerParent = splitInParents($throwables);
printTree($throwablesPerParent);
if (count($throwablesPerParent) !== 0) {
die('ERROR!!!');
@shanezhiu
shanezhiu / quote.txt
Created April 21, 2020 06:58 — forked from OnesimusUnbound/quote.txt
Programming Quotes
[T]he difference between a bad programmer and a
good one is whether he considers his code or his
data structures more important. Bad programmers
worry about the code. Good programmers worry about
data structures and their relationships.
-- Linus Torvalds
~~~
Clarity and brevity sometimes are at odds.
When they are, I choose clarity.
-- Jacob Kaplan-Moss
@shanezhiu
shanezhiu / slope_vs_starting.md
Created February 15, 2020 03:10 — forked from gtallen1187/slope_vs_starting.md
A little bit of slope makes up for a lot of y-intercept

"A little bit of slope makes up for a lot of y-intercept"

01/13/2012. From a lecture by Professor John Ousterhout at Stanford, class CS140

Here's today's thought for the weekend. A little bit of slope makes up for a lot of Y-intercept.

[Laughter]

后台开发中总是在”并行,并发,异步,同步,阻塞,非阻塞”之间转,自己经常就被转得晕头转向。由于对基于经验的答复不满意,因此决定将我这几个月对这些概念千丝万缕的思绪整理出来。

【并发与并行】

  • 并发:    仅仅包含宏观上的意义,即多个任务同时被处理;而微观上可能仅仅是一个cpu分时间片去完成了多个任务,这个时候多个任务是被顺序处理的。

  • 并行:    则更加严格,在宏观和微观上都应该具有多个任务同时被处理的含义,这个意义上多个任务被并行处理的,单cpu永远不可能并行。

  • 并行和并发是站在两个不同角度上理解产生的概念。

  • 并行一定是并发,并发却不一定是并行。

@shanezhiu
shanezhiu / HTTP Cookie header parser
Created December 5, 2017 02:53 — forked from pokeb/HTTP Cookie header parser
Quick and dirty HTTP cookie header parser in PHP