Skip to content

Instantly share code, notes, and snippets.

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
      
@gengwg
gengwg / google-levels.txt
Created April 22, 2025 20:03
Software Engineer Career Ladder at Google
Software Engineer Career Ladder at Google
Here’s an understanding of the software engineer career ladder at Google:
Software Engineer I (Level 2)
SWE-I refers to a fresh out of college software engineer or an intern still pursuing a four-year bachelor’s degree in an engineering program.
Software Engineer II (Level 3)
Google entry-level software engineer is a designated Level 3 coding engineer with an undergraduate degree in a computer-related field. It is also common for an SWE-II to have a Master’s degree. However, since they possess 0 to 1 year of industry experience, they are assigned an entry-level position. On average, they earn a base salary of $130,041 per year.
Software Engineer III (Level 4)
@gengwg
gengwg / google_leetcode.txt
Created April 22, 2025 20:03
google leetcode
388 Longest Absolute File Path 34.7% Medium
340 Longest Substring with At Most K Distinct Characters 38.5% Hard
308 Range Sum Query 2D - Mutable 19.8% Hard
418 Sentence Screen Fitting 27.2% Medium
361 Bomb Enemy 38.0% Medium
281 Zigzag Iterator 48.3% Medium
298 Binary Tree Longest Consecutive Sequence 39.8% Medium
425 Word Squares 41.7% Hard
346 Moving Average from Data Stream 57.4% Easy
163 Missing Ranges 27.7% Medium