Skip to content

Instantly share code, notes, and snippets.

@gengwg
gengwg / china-visa-free-travel.md
Created May 16, 2025 02:25
中国公民可以免签旅游的国家

截至2025年5月15日,中国公民可以免签旅游的国家如下:

  • 亚洲:格鲁吉亚、哈萨克斯坦、卡塔尔、马尔代夫、泰国、新加坡、亚美尼亚、乌兹别克斯坦、伊朗、马来西亚、阿曼、巴基斯坦
  • 欧洲:阿尔巴尼亚、白俄罗斯、波斯尼亚和黑塞哥维那、塞尔维亚、圣马力诺
  • 北美:安提瓜和巴布达、巴巴多斯、巴哈马、多米尼克、格林纳达
  • 南美:苏里南
  • 非洲:毛里求斯、塞舌尔、加蓬、摩洛哥、莫桑比克、突尼斯、赞比亚、安哥拉、贝宁
  • 大洋洲:斐济、汤加、所罗门群岛、密克罗尼西亚、纽埃、萨摩亚、基里巴斯
  • 加勒比:海地、圣基茨和尼维斯、圣卢西亚、牙买加
  • 其他:阿鲁巴(荷兰的一部分,但旅行时单独对待)

In Kubernetes, Deployment and StatefulSet are both controllers used to manage Pods, but they serve different purposes based on the application's requirements. Here’s a breakdown of their key differences:

1. Use Case

  • Deployment:

    • Best for stateless applications (e.g., web servers, REST APIs).
    • Pods are interchangeable (no unique identity or persistent storage).
    • Scaling up/down or rolling updates don’t require stable identities or ordered operations.
  • StatefulSet:

  • Designed for stateful applications (e.g., databases like MySQL, Kafka, Elasticsearch).

@gengwg
gengwg / gke-terraform-simple.md
Created May 12, 2025 18:45
Provision GKE Cluster on Google Cloud with Terraform.
@gengwg
gengwg / itemgetter.md
Created May 10, 2025 00:55
python itemgetter with examples.

The itemgetter function from Python's operator module creates a callable that retrieves items from objects using indices (for sequences like lists/tuples) or keys (for mappings like dictionaries). It is efficient and commonly used with functions like sorted(), max(), and min() for clean, readable code.

Importing itemgetter

from operator import itemgetter

Examples

  1. Basic Usage with a List
@gengwg
gengwg / scale2025.md
Created May 7, 2025 03:09
notes for the **System & Reliability @scale Conference**, structured for clarity and impact:

Core Principles for Scaling Systems

  1. Embrace Failure as Inevitable

    • Design for graceful degradation, automatic recovery, and chaos testing.
    • Example: "Like brushing your teeth" – build resilience into daily workflows.
  2. Simplify to Scale

    • Zoom out: Prioritize high-impact components.
    • Declutter services: Eliminate redundant systems to reduce failure points.
  3. Co-Design Physics and Software

JP MORGAN
- trader hdedge
- quant research
software developer
1. large book index words/pages
- indexs wors page # increasing order
O(N)
Sorting (ONlgN)
list scan pages no need to sort-
@gengwg
gengwg / pip-timeline.md
Created April 25, 2025 07:23
Sharing as a data point for people who are going through the same experience/curious what it's like.

Sharing as a data point for people who are going through the same experience/curious what it's like.

Timeline:

google

  • Aug 9 - Got a calendar event titled "ER Connect". This was where they mentioned that I had to choose between PIP or Severance.
  • Aug 11 - Deadline for signing Acceptance. Signed and accepted the package a few minutes before the deadline.
  • Aug 19 - Official last day of work. Lose access to workplace, email, office buildings.

Here's how to undo your last commit (that accidentally included __pycache__) and prevent it from being tracked in the future:


1. Undo the Last Commit (But Keep Changes)

git reset --soft HEAD~1
  • This will:
    • Remove the commit (fd8b15c)
@gengwg
gengwg / change-vscode-run-python-shortcut.md
Created April 23, 2025 17:43
Change the Shortcut for "Run Python File in Terminal" in VSCode
  1. Open VS Code Keyboard Shortcuts

    • Press Ctrl + K then Ctrl + S (Windows/Linux)
    • OR Cmd + K then Cmd + S (Mac)
      (This opens the keyboard shortcuts editor.)
  2. Search for the Python Run Command

    • Type in the search bar:
      Python: Run Python File in Terminal