Ligang Yan
Full-stack software engineer in Halifax, Canada. Twelve years across Android, React and Node.js, from a 1M-DAU e-commerce app to small tools I ship on my own. This site holds my writing, the things I'm building, and experiments that don't have a home yet.
颜力刚 · ligangyan.com
Recent writing
All →- Gradient Descent, Line by Line: Twelve Lines of Python and the Calculus Behind ThemA twelve-line function fits the best straight line through a cloud of points: it starts flat at zero and 900 times over asks which way is less wrong. Taking it apart one line at a time — what a gradient actually is, where the formulas come from, why the minus sign, and what alpha does.
- Rebuilding my personal site on Astro and Cloudflare WorkersThe first post on the new site, on why I picked this stack and how the site is meant to grow.
- Does Canada really have no estate tax? The real gap between the two countries' death taxesCanada has no estate tax but it has deemed disposition: every unrealised gain is taxed at once on the final return, and an RRSP is included at 100%. The US has step-up in basis and a $15 million exemption. Four household scenarios with the bill worked out, plus a trap few people know about: a Canadian holding more than $60,000 of US stocks has a US estate-tax filing obligation.
- Hong Kong participating insurance, taken apart: structure, commissions, sales scripts, and how it compares to just investingThe guaranteed part is about 1%; the illustrated 6 to 7% only approaches after twenty or thirty years, and break-even usually takes 15 to 20. First-year commissions once reached 100% of first-year premium. It does not escape CRS reporting and is not a compliant way to move mainland renminbi offshore. All of that laid out, then compared with term life and an index fund.
- Importing from China to Canada, end to end: 22 steps, 9 parties, one cost checklistUsing my first small shipment of EV charging accessories from a factory in Guangdong to my home in Halifax as the example: Incoterms, what a freight forwarder actually does, CARM registration, HS codes, cUL certification, bills of lading and telex release, customs and taxes, and the trap of clearing under someone else's name.
- The Coca-Cola "Dividend Arbitrage" Is an IllusionBuy before the ex-dividend date, sell after, and pocket the dividend for free? The price drops by the dividend amount on the ex-date. The people claiming they made a thousand dollars in a few days made it on the share price — and the post is usually an ad for tokenized stock.
Projects & tools
All →SweetValueLab
Equity research your Claude can use. Connect it as an MCP server, then research stocks, paper-trade and review your portfolio in one conversation. Free tools include a portfolio backtester and a FIRE calculator.
US Equity Research
My own equity research, one interactive page per company: sum-of-the-parts valuations, earnings breakdowns, what you have to believe, and the risks. Starts with SpaceX.
The Debate Arena
Critical-thinking practice for kids aged 5 to 12. 25 questions with no right answer, an AI opponent that argues back, and an audience of 20 that only moves for good reasons.
Mahjong AI, from zero to playing
A learning project with a 16-chapter tutorial: write a Mahjong engine, a rule-based bot, train a network to imitate it by supervised learning, then beat it with PPO. Includes a full Riichi Mahjong engine.
System Design Notes
My system design interview notes: eight classic problems (Ticketmaster, Uber, Web Crawler, TinyURL and more) written as the questions an interviewer asks and the answers I'd give.
IELTS Notes
IELTS study notes in Chinese: speaking topics with model answers and General Training writing samples for every letter type and common Task 2 theme.
Travel
All →Places I have been. The goal is to fill in the whole map.7 of 195 countries · 48 places