1 - Git

  1. 𝗴𝗶𝘁 𝗱𝗶𝗳𝗳 : Show file differences not yet staged.
  2. 𝗴𝗶𝘁 𝗰𝗼𝗺𝗺𝗶𝘁 -𝗮 -𝗺 "𝗰𝗼𝗺𝗺𝗶𝘁 𝗺𝗲𝘀𝘀𝗮𝗴𝗲": Commit all tracked changes with a message.
  3. 𝗴𝗶𝘁 𝘀𝘁𝗮𝘁𝘂𝘀 : Show the state of your working directory.
  4. 𝗴𝗶𝘁 𝗮𝗱𝗱 𝗳𝗶𝗹𝗲_𝗽𝗮𝘁𝗵:Add file(s) to the staging area.
  5. 𝗴𝗶𝘁 𝗰𝗵𝗲𝗰𝗸𝗼𝘂𝘁 -𝗯 𝗯𝗿𝗮𝗻𝗰𝗵_𝗻𝗮𝗺𝗲: Create and switch to a new branch.
  6. 𝗴𝗶𝘁 𝗰𝗵𝗲𝗰𝗸𝗼𝘂𝘁 𝗯𝗿𝗮𝗻𝗰𝗵_𝗻𝗮𝗺𝗲: Switch to an existing branch.
  7. 𝗴𝗶𝘁 𝗰𝗼𝗺𝗺𝗶𝘁 –𝗮𝗺𝗲𝗻𝗱:Modify the last commit.
  8. 𝗴𝗶𝘁 𝗽𝘂𝘀𝗵 𝗼𝗿𝗶𝗴𝗶𝗻 𝗯𝗿𝗮𝗻𝗰𝗵_𝗻𝗮𝗺𝗲: Push a branch to a remote.
  9. 𝗴𝗶𝘁 𝗽𝘂𝗹𝗹 : Fetch and merge remote changes.
  10. 𝗴𝗶𝘁 𝗿𝗲𝗯𝗮𝘀𝗲 -𝗶: Rebase interactively, rewrite commit history.
  11. 𝗴𝗶𝘁 𝗰𝗹𝗼𝗻𝗲 : Create a local copy of a remote repo.
  12. 𝗴𝗶𝘁 𝗺𝗲𝗿𝗴𝗲 : Merge branches together.
  13. 𝗴𝗶𝘁 𝗹𝗼𝗴 –𝘀𝘁𝗮𝘁: Show commit logs with stats.
  14. 𝗴𝗶𝘁 𝘀𝘁𝗮𝘀𝗵 : Stash changes for later.
  15. 𝗴𝗶𝘁 𝘀𝘁𝗮𝘀𝗵 𝗽𝗼𝗽: Apply and remove stashed changes.
  16. 𝗴𝗶𝘁 𝘀𝗵𝗼𝘄 𝗰𝗼𝗺𝗺𝗶𝘁_𝗶𝗱: Show details about a commit.
  17. 𝗴𝗶𝘁 𝗿𝗲𝘀𝗲𝘁 𝗛𝗘𝗔𝗗~𝟭: Undo the last commit, preserving changes locally.
  18. 𝗴𝗶𝘁 𝗳𝗼𝗿𝗺𝗮𝘁 -𝗽𝗮𝘁𝗰𝗵 -𝟭 𝗰𝗼𝗺𝗺𝗶𝘁_𝗶𝗱: Create a patch file for a specific commit.
  19. 𝗴𝗶𝘁 𝗮𝗽𝗽𝗹𝘆 𝗽𝗮𝘁𝗰𝗵_𝗳𝗶𝗹𝗲_𝗻𝗮𝗺𝗲: Apply changes from a patch file.
  20. 𝗴𝗶𝘁 𝗯𝗿𝗮𝗻𝗰𝗵 -𝗗 𝗯𝗿𝗮𝗻𝗰𝗵_𝗻𝗮𝗺𝗲: Delete a branch forcefully.
  21. 𝗴𝗶𝘁 𝗿𝗲𝘀𝗲𝘁 : Undo commits by moving branch reference.
  22. 𝗴𝗶𝘁 𝗿𝗲𝘃𝗲𝗿𝘁 : Undo commits by creating a new commit.
  23. 𝗴𝗶𝘁 𝗰𝗵𝗲𝗿𝗿𝘆 -𝗽𝗶𝗰𝗸 𝗰𝗼𝗺𝗺𝗶𝘁_𝗶𝗱: Apply changes from a specific commit.
  24. 𝗴𝗶𝘁 𝗯𝗿𝗮𝗻𝗰𝗵 : Lists branches.
  25. 𝗴𝗶𝘁 𝗿𝗲𝘀𝗲𝘁 --𝗵𝗮𝗿𝗱: Resets everything to a previous commit, erasing all uncommitted changes

2 - Latency Numbers Every Programmer Should Know

在线预览地址:Latency Numbers Every Programmer Should Know

From Google SRE book

OperationTime in nsTime in ms (1ms = 1,000,000 ns)
L1 cache reference1
Branch misprediction3
L2 cache reference4
Mutex lock/unlock17
Main memory reference100
Compress 1 kB with Zippy2,0000.002
Read 1 MB sequentially from memory10,0000.010
Send 2 kB over 10 Gbps network1,6000.0016
SSD 4kB Random Read20,0000.020
Read 1 MB sequentially from SSD1,000,0001
Round trip within same datacenter500,0000.5
Read 1 MB sequentially from disk5,000,0005
Read 1 MB sequentially from 1Gbps network10,000,00010
Disk seek10,000,00010
TCP packet round trip between continents150,000,000150

Therefore, it is possible to read:

  • sequentially from HDD at a rate of ~200MB per second
  • sequentially from SSD at a rate of ~1 GB per second
  • sequentially from main memory at a rate of ~100GB per second (burst rate)
  • sequentially from 10Gbps Ethernet at a rate of ~1000MB per second

Back of the Envelope Calculations

Quick tips: Use numbers based on the decimal system to run numbers in your head. Sample calculation:

  • What is the overall latency of retrieving 30 256kB images from one server?

Naïve design: do all the work on one machine - dominated by disk seek time.

Reads required to generate page30 images / 2 disks per machine = 15
Time to read one image from HDD(256KB / 1MB) * 5 ms + 10 ms seek = 11.28 ms
Approximate time to generate results15 reads * 11.28 ms = 169.2 ms

One HDD-based server can generate 1000 ms / 169.2 ms ~= 5 result pages per second.

3 - Kafka

4 - Web authorization

5 - Memory allocation