Skip to content

Instantly share code, notes, and snippets.

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
@gengwg
gengwg / if-vs-etf.md
Created April 18, 2025 03:25
differences between index funds and ETFs

Here’s a clear breakdown of the differences between index funds and ETFs (even when tracking the same stocks), along with guidance on choosing the best option for your goals:


Key Differences

Feature Index Fund (Mutual Fund) ETF (Exchange-Traded Fund)
Trading Priced once daily (after market close). Traded like stocks (intraday pricing).
Minimum Investment Often requires $1k–$3k initial buy-in. Buy any number of shares (no minimum).
Expense Ratios Slightly higher (e.g., 0.04–0.15%). Often lower (e.g., 0.03–0.10%).
@gengwg
gengwg / portfolio-45.md
Created April 17, 2025 18:26
Balanced Portfolio Allocation for Investors Aged 40–50: Optimizing Growth and Stability with SCHO, BND, VTI, and FZILX

For a 40–50-year-old investor with a moderate risk tolerance and a focus on balanced growth and capital preservation, here’s a recommended portfolio allocation using your selected funds:


Suggested Allocation

Asset Class Fund(s) Percentage Rationale
Domestic Stocks VTI 40% Core U.S. equity exposure for growth and diversification.
International Stocks FZILX 20% Diversifies globally, capturing growth in developed/emerging markets.
Broad Bonds BND 30% Stabilizes the portfolio with investment-grade U.S. bonds (mix of durations).

To add another person as an editor to your YouTube channel, follow these steps:

Via YouTube Studio (Standard Channel):

  1. Sign in to YouTube Studio:

  2. Navigate to Settings:

    • Click the Settings icon (⚙) in the left sidebar.
  3. Open Permissions:

Our Culture

Always Day 1

• Always maintain an entrepreneurial mindset. Keep pioneering and innovating instead of relying on resources or past achievements.

• Stay agile and pursue efficiency and simplicity. Reduce unnecessary procedures.

• Reject complacency. Stay open and humble.

@gengwg
gengwg / linux-antivirus.md
Created March 18, 2025 16:52
Open-source Linux antivirus and security tools

1. ClamAV

  • Description: ClamAV is a powerful open-source antivirus engine that scans for malware, including Windows viruses. It’s lightweight and widely used.
  • Installation:
    sudo dnf install clamav clamav-update
  • Update Virus Definitions:
@gengwg
gengwg / asm.md
Created March 14, 2025 17:30
"Writing and Running a Simple 'Hello, World!' Program in x86-64 Assembly on Fedora Linux"

Below is a simple "Hello, World!" program written in x86-64 assembly language for Linux. I'll also provide instructions on how to assemble, link, and run it on Fedora Linux.

Hello World Assembly Code (x86-64)

Save the following code in a file named hello.asm:

section .data
    hello db 'Hello, World!', 0x0A  ; 'Hello, World!' followed by a newline (0x0A)

section .text