CoolMind


If you cannot measure it, you cannot improve it.

How to fill a container?

Most of the time we initialize an empty instance of STL containers and keep adding elements to or removing elements from it. For example, we create...

How to Design a Scalable Rate Limiting Algorithm

任何一个服务在有限资源前提下都会存在处理能力的上限。本文主要描述限流的一些主要算法。 流控算法 Leaky Bucket (漏桶) Fixed Window (固定窗口) Sliding log (滑动日志) Sliding wi...

Revisit compare in map and set

map and set are two common associative containers. By default, common data types can be directly used as the key and their comparing method is std:...

Python closure

Python closure usually makes code simpified and are used in functional programming style. It starts with a keyword lambda and the last statement is...

Leetcode summary of 20200301-20200308

Summary Highlight Code Section Summary It is a little busy this week. So the summary is a little late. Solved problems list 1185. ...

Python contextlib

There are some resources we need to release when we finish our job. It is easy for us to forget those operations. Python has a keyword with which c...

Lower bound and upper bound of set/map

STL’s map/set/multimap/multiset is an ordered container which compares to unordered_map and unordered_set. So there are special methods which imple...

Move subdirectory of a git repository and keep commit message

How to extract a subdirectory of a git repository and keep its commit message? If we directly move everything and add them again, we will lose all ...