Friday, July 31, 2020

Stanford university: CS144 – Introduction to Computer Networking

July 31, 2020


It is part of system design preparation. I like to take some time to review introduction to computer networking course from Standford university. I do think that I do not have time to read computer networking textbook, so it is better for me to study lecture notes first. 

Introduction to Computer Networking

Here is the lecture notes. 

Stock purchase: My purchase of TFSA and Key largo portfolio


It is hard for me to catch the lowest point of last 30 days oil price. CVX has worst second quarter and then I had chance to learn some facts about US economy. I did make decisions to get in the market when oil price was low close to lowest in last 30 days. 

Analysis and my monthly plan on August 2020

I like to make one month plan, invest on stocks and also learn how to invest on long term. I made mistake last time when oil stock went down and then I was so worried about SP 500 index went down below 3000, and then oil stock continued to go down. 

My business plan

I like to reduce risk to purchase more than one oil stock one time. I like to invest on long term, if there is short term swing, then I will take advantage of short swing. If my positions has loss, then I should not buy high and sell low, sometimes I do promise to buy back when the price is lower. It is hard for me to discipline myself. 

Actionable items

What I like to do is to bet on the oil stock should continue to swing lower and then rebound; I should take advantage of swing, and then make some profit. 

Because I am still a beginner as an investor, I should play safe and invest on oil stocks. I should work on stock with capital value at least 2 billion dollars, so that it is less risk compared to small capital like 300 million. 

Exxon, Chevron Earnings Gutted by Virus-Driven Demand Slump

Here is the link. 

Exxon Mobil Corp. and Chevron Corp. posted the worst losses in a generation after the pandemic and a global crude glut combined to batter almost every part of their businesses.

Exxon’s $1.1 billion second-quarter loss was the deepest in the company’s modern history. A collapse in crude prices bled the company’s production division while Covid-19 lockdowns lowered demand for everything from jet fuel to plastic wrap, hobbling the company’s refining and chemical units.

Chevron recorded its weakest performance in at least three decades and warned that the global pandemic wreaking havoc upon energy markets may continue to drag on earnings. The explorer plans to curtail the equivalent of 5% of its worldwide output during the current quarter and backtracked on plans to massively ramp up production from its prized Permian Basin holdings.

Oil has become the poorest-performing sector of U.S. equity markets as a confluence of economic, political and structural threats coalesce to imperil the very foundations of the petroleum industry. Sweeping layoffs, budget cuts and project cancellations haven’t been enough to arrest the industry’s decline as fleeing investors made energy the worst investment in the S&P 500 Index this year.

Without the massive trading operations that shielded European oil explorers such as Royal Dutch Shell Plc and Total SE from losses, Chevron was exposed to the full force of this year’s oil price rout. Notably, Exxon’s nascent trading foray “experienced unfavorable mark-to-market derivative impacts,” the company said.

Exxon generated zero cash from operating activities during the quarter, according to a statement on Friday.

Actionable Items

Buy some Exxon stock. 

Big Tech Got Bigger, Big Oil Got Smaller During Virus Lockdown

Here is the article. 

Facebook Inc., Inc. and Apple Inc. smashed analysts’ estimates on Thursday after shoppers turned to grocery delivery and iPhone entertainment while cities around the world shut down. Less than 24 hours later, Exxon Mobil Corp. and Chevron Corp. reported historic quarterly losses that, while expected, showed just how much fuel demand plunged when flights were grounded and commutes halted.

Thursday, July 30, 2020

More distributed courses please!

July 30, 2020


It is so challenge for me to learn that I have to learn so many courses from top universities in the world. Distributed database, networking, distributed system, or other courses. I need to find more courses to read and learn. 

System design preparation

I am a frugal person. Also I like to push myself hard this time, and see if I can solve the problem lack of learning advanced topic: large distributed system. 

I still remembered that I had hard time to read the book "Design data intensive application", and also I have more headache to find time to read those papers. 

AMD stock: 50% return July 2020 - I missed it!

July 30, 2020


It is hard to be a underdog. I did research on AMD stock early in July, but when Intel stock went down over 10%, I purchased 170 share Intel stock. I did not come out the idea to purchase AMD stock. Why?

My AMD stock research

I spent hours to watch all videos on about Lisa Su, and here is the link. I think that I have to learn how to be open, do not be jealous about Dr. Lisa Su with 1 million shares of AMD stock. 

Lisa Su owns over 150,000 units of Advanced Micro Devices stock worth over $149,331,524 and over the last 8 years he sold AMD stock worth over $72,542,184.Jun 11, 2020

CVE stock: Probability analysis

  • There is a chance for second crash in short future. No one can avoid market risk;
  • The lowest price is 5.89. Should I wait for the price? Or I just go for 6.09?
  • How much should I take risk? Should I purchase 10,000 shares or 1000 shares? 
  • Market swing is the chance to make 10% return. 
  • Admit that I am a beginner. Try to survive longer. I save those TFSA funds over 10 years. 
  • Be patient. Do not gamble! Take some risk as well. 

GE post $2 billion loss as jet engine orders sink

Here is the article. 

General Electric Co. posted a roughly $2 billion quarterly loss as revenue tumbled 24%, hurt by a steep decline in a jet-engine business that has been hobbled by the coronavirus pandemic.

The aviation business, once a profit engine for GE, swung to a loss in the June quarter as both revenue and orders plunged. The unit produces engines for Boeing Co. and Airbus SE planes but has had to cut production and jobs as airlines delay orders. On Wednesday, Boeing said it would cut further production of commercial jets.

GE reported it burned through less cash in the June quarter than it had previously warned. The company reported adjusted negative cash flow from industrial operations of $2.1 billion, compared with its projection of negative $3.5 billion to $4.5 billion in May. Analysts were expecting negative cash flow of $3.29 billion, according to FactSet.

"We're working through a still-difficult Covid-19 environment," said CEO Larry Culp, adding that he still expected a prolonged recovery for the commercial-aviation business. "Still, based on what we see today and the actions we've taken, sequential improvement in earnings and cash in the second half of the year is achievable."

GE stock: GE aviation loss 2 billion a quarter Introduction to distributed system

Here is the link of lecture notes. 

Multiple Computers
More than one physical computer, each consisting of CPUs, local memory, and possibly stable storage, and I/O paths to connect it with the environment. 

Mechanisms for communicating with other nodes via a network. 

Shared State
If a subset of nodes cooperate to provide a service, a shared state is maintained by these nodes. The shared state is distributed or replicated among the participants.

Why distribute? 
  • Resource sharing 
  • Device sharing 
  • Flexibility to spread load 
  • Incremental growth 
  • Cost/performance 
  • Reliability/Availability 
  • Inherent distribution 
  • Security?

GMU.EDU: Concurrent and Distributed Systems

Here is the lecture notes. 

University of Waterloo: Distributed Database

Here is the link of course. I plan to spend a few hours to go over important concepts. 

Course notes - I plan to read course notes and I like to spend a few hours on the course. 

Map reduce notes is here

HSE.TO stock: Husky Energy swings to $304-million loss in Q2 as revenues plunge

Here is the article. 

CALGARY — Husky Energy Inc. swung to a $304-million net loss in the second quarter as revenues plunged nearly 55 per cent.

The Calgary-based oil producer says it lost 31 cents per diluted share for the three months ended June 30, compared with net income of 36 cents per share or $370 million a year earlier.

Revenues were $2.38 billion, down from $5.24 billion in the second quarter of 2019.

Husky Energy was expected to lose 39 cents per share on $2.73 billion of revenues, according to financial markets data firm Refinitiv.

Funds from operations were $18 million or two cents per share, down from $802 million or 80 cents per share a year earlier while capital expenditures were $310 million, including $63 million in Superior Refinery rebuild capital.

Total equivalent production fell 7.8 per cent to 247,000 barrels of oil equivalent per day, from $268,000 a year earlier.

Facts to review:

Wednesday, July 29, 2020

10 reasons I will be rich

I think that it is important for me to stay independent first. I will figure out how to invest better after I make so many mistakes as a beginner investor does. 

It takes time to learn technical analysis. But I do have experience using Excel sheet. I do believe that I can pick up analysis. 

I need to work on my greedy and fear as an investor. Also I have to read more about business, coronavirus and how things will work again in this challenge. 

10 reasons I am not rich

July 29, 2020


I did day trading research over a month ago, and today I found out that I missed KODK stock investment opportunity. 

10 reasons I am not rich

The first one is to learn the basics. I should use the website to select stock. The website is called 

Search Results Web results Leonard Kleinrock - Wikipedia

I went through the first chapter of the book like using 10 to 20 minutes, and then I came cross the end of chapter, and I read some words shared by the professor. The book is called networking, top-down approach. 

What makes a good researcher? 

I always like to take a break. So it is time for me to learn a scientist, and what is his story. 

His creation of packet-switching principles in 1961 became the technology behind the Internet.

What people have inspired you professionally? By far, it was Claude Shannon from MIT, a brilliant researcher who had the ability to relate his mathematical ideas to the physical world in highly intuitive ways. He was on my PhD thesis committee.

End of my break! Go to chapter II: Application layer

System design: Computer networking - a top-down approach 7th edition

July 29, 2020


It is my Facebook onsite interview prepration on August 13, 2020. How should I prepare for Facebook system design interview? Do I purchase Leetcode premium version? Do I pay to purchase system design video from tech lead on, a senior level programmer from Amazon to get one hour service? I choose to stay hunger, stay to be frugal, learn by myself. I do believe that best learning will happen if I choose not to be a parrot in my own system design interview. 

A network book

I like to focus on basics. One is to review operating system basics, and then networking basics. Since I have limit time to prepare, I like to work on networking basics. 

I chose to spend at least 10 hours to rush to go over as many topics in the book "Networking - Top down approach". I like to focus on application layer, case study about Netflix, 

Why Kodak Stock Skyrocketed 203% Today

Here is the article. 

Shares of Eastman Kodak (NYSE:KODK) more than tripled on Tuesday, following news that the technology company would receive a $765 million loan from the U.S. government to produce vital coronavirus-related pharmaceutical components.

Eastman Kodak will use the funds to launch Kodak Pharmaceuticals, a new division that will produce pharmaceutical ingredients deemed critical by the U.S. Department of Defense (DOD) and the Food and Drug Administration (FDA). The funds will be issued by the U.S. International Development Finance Corporation (DFC) at the direction of President Donald Trump under the Defense Production Act (DPA).

Kodak Stock Up More Than 1,000% On Deal To Produce Generic Drug Ingredients

Here is the article.

Some analysts are questioning the move, wondering why the deal wouldn't have been given to a company already involved in the pharmaceutical industry. President Trump may have held a preference for a producer outside of the current drug regime. Political tensions have increased this week, as pharma executives and analysts react to Trump's recent executive orders that aimed to lower drug prices.
Whatever the reasoning, it's a fascinating chance for Kodak to make a new start, and investors have reacted bullishly. So far this week, the stock is up around 1,150%. The company came out of bankruptcy in 2013 and has struggled to grow over the last five years. Moving into a field like drug sales could provide a good avenue for the photography pioneer.

Tuesday, July 28, 2020

System design: What is a reverse proxy server?

Here is the article from NGINX.

I like to put together my notes:

A proxy server is a go‑between or intermediary server that forwards requests for content from multiple clients to different servers across the Internet. A reverse proxy server is a type of proxy server that typically sits behind the firewall in a private network and directs client requests to the appropriate backend server. A reverse proxy provides an additional level of abstraction and control to ensure the smooth flow of network traffic between clients and servers.

What is a proxy server? 
A proxy server
a go‑between or intermediary server
forward requests for content 
from multiple clients to different servers across the Internet. 

Where is a proxy server to stay? 

reverse proxy server
a type of proxy server 
typically sit behind the firewall in a private network
direct client requests to the appropriate backend server. 

What is a proxy server? Explain using your own words. 

A reverse proxy
an additional level of abstraction and control
the smooth flow of network traffic between clients and servers.

Additional layer of abstraction and control

Sunday, July 26, 2020

System design: How to prepare myself to be a best learner?

July 26, 2020


It is my short research about how to be a best learner on system design next two weeks. It is not easy, but I like to put together some creative ideas.

Facebook system design 

I like to look up Leetcode system design tagged with Facebook.

Follow up on July 27, 2020
I do believe that a best learner should be a good reader. I should push myself to read articles and then take notes, and over hours reading and short researches on small topics will lead me to be a great learner. 

I try not to watch youtube system design youtube videos this time. I do think that a good learner should pick up so many things to learn through reading instead. It is more active and I need to write down those names who provide quality content over years.

Facebook onsite: Study topics

July 26, 2020


It is important for me to review and learn those topics very well in next two to three weeks.  I need to make a complete check list and ensure that I can understand the basics.

Topics to review

Some topics you should be familiar with:
- Concurrency (threads, deadlock, starvation, consistency, coherence)
- Networking (IPC, TCP/IP)
- Abstraction (understanding how OS, filesystem, and database works)
- Real-world performance (relative performance RAM, disk, your network, SSD)
- Availability and Reliability (durability, understanding how things can fail) -Data storage (RAM vs. durable storage,
compression, byte sizes)
- CAP Theorem
- Byte math

A Technical Overview of Kubernetes (CoreOS Fest 2015)

Here is the link.

INFRASTRUCTURE & OPERATIONS - Painless container management with GKE & Kubernetes

Here is the link. 

Kubernetes is leading the charge into the next generation of cloud computing. With a vibrant community, this open project is defining the APIs that let you use the same techniques that Google uses internally. Workload portability is a reality - Kubernetes can work on any cloud or in your own datacenters, all with the same API and tools. Google Container Engine streamlines it even further, offering you a managed container cluster with just a few clicks. Speakers: Brendan Burns & Tim Hockin, Google

Brendan Burns - Microsoft Distinguished engineer

July 26, 2020


It is my short research about the author of book I am reading second day. It is called "Designing distributed systems - Patterns and paradigms for scalable, reliable services".

Brendan burns

I spent one hour to go over the book and see if I can learn something quickly. System design interview preparation is the art, and I do like to take some risk this time for hunting for good learning material, asking friends, and get connected to people in my social circle.

I asked my friend who works at NVIDA senior machine learning engineer, Dr. Liu recommended me the book.

Facebook onsite: Preparation - ask a friend

July 26, 2020


I got an offer from my friend, used to be my coach back in 2018 for Seattle prime video group onsite interview. He recently joined Google and left Indeed. So I like to learn more about how to prepare Facebook onsite interview. 

My notes

He recommended me to work on Leetcode high frequency Facebook algorithms. Usually Facebook asks the exactly same question from Leetcode. 

Focus on algorithm. It is hard to remove bias from system design interview. Make sure that I can solve all the algorithm problems on onsite interviews. 

System design: Ask a friend

July 26, 2020


I chose to ask my friend met in my nephew's party back in 2015. She is senior machine learning engineer and joined NVIDA back in 2015. She recommended me to read the book. 

A system design book

I spent a few hours to read the book, and I like to read more about it today. 

Designing distributed systems - patterns and paradigms for scalable, reliable services.

Brendan Burns

Linkedin Liu Xin - Here is the link.

Good job! Dr. Liu!

CAP theorem - P is tough to remember - Partition tolerance

July 26, 2020

Here is the link. 

CAP theorem

The CAP theorem (coined by Eric Brewer) talks about the trade-off between consistency and availability you have to make in your distributed system. This video describes what it is, and how it impacts your system design.

An example - a bank, one customer, two ATM, network between two ATMS

One customer - two ATMs

What if something breaks?

consistent view of balance

ATM broken or network problem

partition - suffer partition

Consistent design

Do my best - partition heals - More available

Both consistence - available design

Real world - degree of consistency - degree of available

Partially available design
. Deposit: yes
Withdrawls: small and rate limited
Balance info: tentative

The CAP theorem

Formalize the trade-off between consistency and availability in the presence of partitions.

Saturday, July 25, 2020

Storing hundreds of millions of simple key-value pairs in Redis

Here is the link.

Shard (database architecture)

Here is the article. 

Sharding & IDs at Instagram

Here is the link.

With more than 25 photos and 90 likes every second, we store a lot of data here at Instagram. To make sure all of our important data fits into memory and is available quickly for our users, we’ve begun to shard our data — in other words, place the data in many smaller buckets, each holding a part of the data.

Friday, July 24, 2020

System design: Instagram Architecture: 14 Million Users, Terabytes Of Photos, 100s Of Instances, Dozens Of Technologies

Here is the link. 

INTC stock: Learn to be a smart investor

July 24, 2020


It is so hard for me to find top intelligent investor. How to think and how to understand the market swings? I like to look into those comments from INTC investors. 


I am looking for good thinkers:

Hold your Intel shares strong, one of the most solid and most profitable companies in the tech world. Do not let those inexperience millennials and Panic earning gamblers mislead you. Look at the After Hour Panic Sell when Q1 release on 4/23, where price dipped -7%, and how it recovered the following trading day, and understand the reasons behind the panic sells and the recover, the same pattern will likely to guide you the next day of trading.

Intel (Intc) is likely to open at $57 range and trading between $56 low to $59 low possibly $60.

If you look at the history of Intel after earnings, for example Q1'2020 earning released after hours on 4/23/20 at 2PM Pacific time, the after hours trading price dropped almost -7% after hours from closing price of $58.7 to $54.9 after hours. 

The next morning 4/24/2020, it opened at $56.2, -4% drop from prior day closing price, much Higher than the prior day after hours. Also during the middle of the trade hours on 4/24/2020, the stock price gradually recovered to $58 in mid session then fully recovered $58.9 at the end of the day. 

If you look into the reason of why after Q1'20 earning on 4/23 after hours stock would drop -7%, it was because Intel was delayed in 10 Nanometer scale production and 7 Nanometer was postponed, but the earnings and revenue growth was exceeding expectation, so on 4/24/2020, after panic gamblers had gone during after hours, it opened with a narrower price loss and recovered during the follwing day. Q2'20 after hours 7/23 to 7/24 look like the similar situation to me. 

After Hours Panic sell from those Earning Gamblers who do not know a damn of the company and financials. The Next Morning stock recovered and continued into nearly full recovery during the mid day next day, eventually close same level.

INTC stock: Learn more about business

July 24, 2020


It is tough for me to catch up more about Intel business. So I went to Yaoo->Finance->Conversation underneath stock page.

INTC stock

I like to review intel stock and learn more about the following content:

Here is the page.

Intel expecting to make over $4 per share for 2020, what is the issue here? A delay while no one can afford chips and upgrades currently is not all that bad of a deal. Balance sheet looks like INTC has double the assets to liabilities by about 70 billion.

Intel also has made over $20 earnings over last 10 years than what it is currently trading which should all be in the bank. There are double the assets to liabilities. We are talking about 70 billion vs AMD 3 billion on the balance sheets.

AMD market cap is close to 80B
INTC market cap is close to 200B

Intel has AMD's market cap in asset value.
Is my analysis correct?

Intel expecting again $4.50 about this year as it raised guidance a little, it just wont have the latest chips ready till next year. I think next year is a better time to release the chips.

AMD $3B of assets which will grow some however trading 20x assets minus liabilities.

INTC is trading about 3x Assets to liabilities.

No brainer this is getting given away at todays price. IMO today is a buy around $50 easy. Intel researches, develops and sells other technologies other than CPU's.

The above is just an investor's analysis. 

My favorite comments:

Lost 40 BILLION in valuation while delivering great earnings. Zero patience in this market due to momentum based trading algos.

Actionable Items

July 29, 2020

I did research on Lisa su and also AMD stock early in July, my hidden jealous was not so good and it affected my decision making. Now my position of Intel stock has 7% loss. I should purchase half of AMD to support Lisa Su and AMD instead. system design show case:

July 24, 2020


It took me near one hour to watch one of showcase on I like to write down some notes about the showcase interview.

Showcase of system design.

I will add more later.

Facebook onsite: Three weeks learner - Amazing learner

July 24, 2020


It is such great experience to go over two month preparation for Facebook phone screen. Everything runs smoothly, work, preparation and practice. I have learned so many lessons as a software programmer, I do believe that most important thing is to train myself and push myself hard to be a problem solver. 

Three weeks learner

I like to adapt to be a learner and also take some time to look into system design, and also work on nonstop on algorithm practice as well. 

I did ask a few friends met on last two years, and then quickly I got guidelines for my system design study. 

Amazing linkedin and to make world connected. Here is my github page. 

INTC stock: 15% plunge of Intel stock

July 24, 2020


It is my favorite company Intel and the stock. I did make purchase today.

INTC 170 shares

Wednesday, July 22, 2020

System design: Distributed database

I plan to watch this video in short future.
Here is the link.

System design advice: 10 - 15 popular system design questions

For system design, I would say do as many mock interviews in as possible. Prepare through 10-15 popular system design questions. Think about fault tolerance, alternate options and make sure you can explain the props and cons of the approach. Good luck with the interview.

Leetcode 1040: Longest duplicate string

Longest duplicate string is binary search with hash

Binary search for the length, use Robin karp hash

Question about Leetcode 1040:

There is no pattern string, how to find which one to compare. Save all the same length one in the hashset? Rabin hash is to compare to given a pattern string.

Here is my gist saved. I will play Java code and see how it works. 

System design: Youtube channel recommendations

July 22, 2020


It is day one again for my system design study. I also need to ask friends on first. I met them as an interviewer.

VMWARE engineer's recommendation

There is another one by Gaurav Sen. you can check that as well. But Tech Dummies has really good stuff. He explains well.

  • Additionally there is a system design channel on YouTube by Narendra. You can follow that.
  • It’s call tech dummies

Weekend marathon on Leetcode mock interview phone screen

July 18, 2020

It is so important for me to work on my crafting skills. I started marathon to work on Leetcode mock interview phone screen last Friday evening.

My marathon

I am not sure how many algorithms I can complete in weekends. I have 5 mock interviews. So far, I completed over 10 algorithms.

Tuesday, July 21, 2020

华尔街有一句名言:“buy on rumor. Sell on news.“

不要赌财报!不要在财报日当天做day trade,因为上下幅度会很大,而且回调速度很快,人根本反应不过来(大神除外)。另外,华尔街有一句名言:“buy on rumor. Sell on news.“ 如果你特别看好一家公司,你可以提前几天埋伏做多该公司股票。然后在财报正式出来之前,我建议大家把股票卖了。财报出来之后,价格波动会很大,而且股价怎么走,我们散户是永远无法干预的。就算财报利好,股价也不一定会涨。财报利空,股价也不一定会跌。无论在哪个股票市场,我们散户永远不是庄家,切记切记

I like to look into this viewpoint. Day trading is hard to play. Market takes a random walk. I have to think clearly what I should do as an investor.


Here is the link.


choose stock with biggest capital or largest volume.

TSLA - for example

ETF - 6%
one to two month losses -

Algorithm: Find longest repeated substring

Here is the link. 

Algorithm: Find longest repeated substring without overlap

Here is my github page for the algorithm. 

Stocks making the biggest moves in the premarket: Halliburton, Chevron, eBay, Delta & more

Here is the article.

Leetcode solved problem: From 461 to 492

July 21, 2020


It is important for me to push myself to write code every day. I did not do that since January 2020, coronavius, running to prepare for Vancouver sun run, and then hay fever, and stock market crashes. Starting from May 28, 2020, I had to prepare for Facebook phone screen, and then I started to work on algorithms again. I only solved 32 new algorithms so far.

32 algorithms

I am so glad to learn the benefit to write code for those simple algorithms. Even the tough one, it only took me less than three or four hours to make it work.

Things I like to talk about is about Trie data structure, using stack, and other things like tree algorithms.

Facts to review

It takes 3 days nonstop practice, so that I can find out how many weakness I have in my thinking process and drafting process.

After my first break-down, it took me 40 minutes to go back to think efficiently using knightdial algorithm. I learn that I have to let my brain get used to those stress, and then I can perform better.

At my peak time, it only takes me five minutes to recall the whole thing, after six months break, the first one will take me 40 minutes. To prepare for Facebook phone screen, I need something like 2 - 3 minutes to refresh my muscle memory.

Two hours research: Oil stock 10% gain

Here is the link.

I am studying Chevron, and deal to purchase Nobel energy in 5 billion dollars.

Inflations -> good structure company with a lot of debt - cash deal to purchase stock of Nobel

Debt-burden energy company

Energy - all sectors - analyze things - who is good credit star rating ...

How do I handle my USA stock portfolio?

Five ideas to get back to more sports life

July 21, 2020


It is tough project to work on. I like to lose 10 lb, and also play more tennis sports as well. I like to write down five ideas to go back to more sports life.

Five ideas 

  1. Need to learn how to balance work, algorithm practice, stock investment and sports activities; 
  2. Put sports first after the work and in the weekends; 
  3. Start to read more about weight control, running and tennis sports;
  4. Plan to finish first 20 tennis workout in one week; 
  5. Plan to hike a few times in short future.