Zocoi Vietnamese /ʒoʊ kɔɪ/: (informal) Let's watch/read together

[pic] It is never too late to...

Amend a git commit message from you in the past

Today my feature branch could not be merged to master because one my commit message did not meet the merging requirements. This is how I dived into a haystack, found the commit, rebased and upated it.

First, let's find all the commits made by me 2 days ago

git log --since=2.days --author=hung

commit 5e18ea5bd6b92d2382a545b07e3495c693fa6293
Author: Hung Dao
Date: Fri Nov 16 12:15:55 2012 -0800

sample commit message 1

commit d3727aafbadbd7befde0dd497afec3427f0bf151

Author: Hung Dao
Date: Mon Dec 3 12:57:12 2012 -0800

sample commit message 2


Git doesn’t have a tool to modify history, so in order to modify a commit that is farther back in my history, there is the rebase tool to rebase a series of commits onto the HEAD. I must also define how far I want to go back and rewrite history. For this case, I want to go 1 step further than the culprit commit

git rebase -i d3727aaf~1

edit d3727aa change the commit message
pick ....

# Rebase dcfa286..5e18ea5 onto dcfa286
# Commands:
# p, pick = use commit
# e, edit = use commit, but stop for amending
# s, squash = use commit, but meld into previous commit
# If you remove a line here THAT COMMIT WILL BE LOST.
# However, if you remove everything, the rebase will be aborted.

Successfully rebased and updated ...

Since the commits are listed in oposite order compared to chronological order I see in `git log`, the commit I want to change should be the first one. After rebasing, let's run `git log` one more time to confirm the change was there.

git log --since=2.days --author=hung

And voilà!

Warning: Since it was only me who's working on the branch so I can do `git push --force origin `. It is strongly recommended not to rewrite history of a collaborative branch or repo since it may throw away other people's commits.

Quote of the day

Eat less and more healthily.

Exercise more.

Spend more time with my family.

Live closer together.

Spend less time commuting.

Less business travel.

Have higher quality, better designed products.

Breathe cleaner air.

Drink cleaner water.

"A low energy lifestyle enables us to accomplish the things we want most in life."

From Jyri Engestrom, also check out his slides about climate change

Ngôi sao cô đơn

Có một vì sao lạc
Cô đơn giữa lưng trời
Thả rơi dòng ký ức
Lạc lõng vòng tay vơi

Có một vì sao lạc
Cô đơn giữa chữ tình
Buông lơi kỷ niệm cũ
Thoáng nghe lòng vô minh

Có một vì sao lạc
Cô đơn giữa vô thường
Nửa khuya buồn trăn trở
Ngậm ngùi một chữ THƯƠNG

Có một vì sao lạc
Cô đơn lạc cõi hồn
Tên tuổi không ai gọi
Lặng buồn nỗi vô ngôn

Có một vì sao lạc
Cô đơn không bến bờ
Mãi tìm điều - không - thể
Suốt đời nhận chơ vơ

Có một vì sao lạc
Cô đơn vạn nỗi buồn
Kiếm tìm trong ý nghĩ
Muôn điều ngọt ngào hơn

Có một vì sao lạc
Một vì sao cô đơn

Tử Nhi

Tools for monitoring mongodb replica set


First of all, make sure that the replica set is set up properly.

// In one of the replica servers
PRIMARY> rs.status()

In the result, you can verify the members of the set, also check the health, uptime and ping of each member.

Now let's see the statistics for all members. When read or write is performed, we can see which member is servicing the request

mongostat --discover

In my test scenario, I have 3 nodes (2 nodes and one arbiter) and in case I lose one, I still have enough nodes to elect a new primary and have replication to a backup node.

Now simulate a case when the secondary is down

SECONDARY> use admin
switched to db admin
SECONDARY> db.shutdownServer()

Hitting the app to check and writing data from the app still works. Yay! Failover should be automatic since mongo client knows the right set members. More here

It turns out that I have "alcohol flush reaction"

Bad news!

I have been wondering why my face start turning red after the first sip of alcohol and the condition runs in my family. It turns out that I have ADH1B gene coding which causes alcohol flush reaction. Here is the article from Wikipedia.

The gene results in an inhibited acetaldehydedehydrogenase enzyme, responsibile for the breakdown of acetaldehyde, the main substance produced by oxidation of ethylene glycol, a.k.a alcohol.

It is worse that people with that gene may be at a higher risk for alcohol-related diseases, such as liver and esophageal cancers and digestive tract cancer.

From now on, I just have to reduce the consumption of alcohol, or better, do not consume alcohol at all.

Sorry friends! I know it's awkward to have sober guy at the table but it has to be done.

Applying for green card under EB2 category

Reference Link 1
Reference Link 2

  1. - Master Degree or Bachelor with 5 experiences
  2. - Exceptional Ability (meet 3 of those above)
    • - Official academic record showing that you have a degree, diploma, certificate, or similar award from a college, university, school, or other institution of learning relating to your area of exceptional ability
    • - Letters documenting at least 10 years of full-time experience in your occupation
    • - A license to practice your profession or certification for your profession or occupation
    • - Evidence that you have commanded a salary or other remuneration for services that demonstrates your exceptional ability
    • - Membership in a professional association(s)
    • - Recognition for your achievements and significant contributions to your industry or field by your peers, government entities, professional or business organizations
    • - Other comparable evidence of eligibility is also acceptable.

[Pic of the day] Ăn gì để giúp não khỏe mạnh

Images courtesy of BufferApp blog

H1B Visa: Step-by-Step Guide

It turned out that I got an approval for H1B petition in June and I'm about to visit Vietnam for winter holiday.

I need to prepare all the required documents for the visa interview as the timing gives me less than a month to be ready.

Step 1: Get all documents ready

  1. Passport photograph
  2. H1B visa application form DS-160
  3. Receipt of application fee
  4. Documents for H petition
    1. I-797 A,B or C
    2. I-129, Petition for Nonimmigrant worker
    3. H Classification Supplement to Form I-129
    4. H-1B Data Collection and Filing Fee Exemption Supplement
    5. Labor Condition Application for H-1B & H-1B1 Non immigrants
    6. H1B Visa Petition letter provided by your employer
  5. Employment Verification letter
  6. Pay stubs atleast last 3 months
  7. Monthly bank statements (last 3 months), Bank of America provides Immigration Letter.
  8. Visa Interview Fees slips

Step 2: Book an interview at the US consulate in HCM city. Do not hesitate to book early since last time I didn't get the desired time and was spending half a day waiting in line.

Step 3: Bring all required documents and prepare for the interview.

The Royal Nokia Screw-Up That Shouldn't Have Been