DHAHAB · ذهب
Guides
Every formula printed on the page, every example worked out, every claim I can't back up left off. Most guides pair with a free calculator you can run in your browser.
If a term here is unfamiliar, the glossary defines 120+ of them in one sentence each before explaining them properly. Shorter questions are answered on the FAQ.
The formulas are printed so you can run them against your own numbers instead of trusting mine. None of this is financial, legal or immigration advice, and anything time-sensitive — a rate, a deadline, an agency rule — should be re-checked against the primary source before you act on it. Full disclaimer at the foot of the page.
01 · Trading & risk
Trading & risk
Sizing, expectancy, setups, and the tests that killed most of them.
R-multiple & expectancy, explained
Position sizing from the stop, results in R, expectancy per trade, the break-even win rate table, and why a 70% win rate can still lose money.
- What is an R-multiple?
- How do you calculate expectancy?
- What is risk of ruin?
Anchored VWAP, and the one setup that survived testing
What anchored VWAP is, how it differs from session VWAP, where to anchor, what a reclaim means, and the walk-forward result behind it.
- What is anchored VWAP?
- How is anchored VWAP different from regular VWAP?
- Where should you anchor a VWAP?
How backtests lie, and what an honest one looks like
Why in-sample backtests lie, what lookahead and survivorship bias look like in code, how walk-forward works, and how to spot a curve fit.
- What is lookahead bias in backtesting?
- What is walk-forward testing?
- Why do in-sample backtests look so good?
A trading journal that changes behaviour
The fields that change behaviour in a trading journal — R-multiple, setup tag, mistake tag, MAE/MFE — and how to review without lying to yourself.
- What should you log in a trading journal?
- Why record trades in R instead of dollars?
- What are MAE and MFE?
Kelly, fractional Kelly, and the gap between them
How the Kelly criterion works, the formula for trading with an R-multiple edge, why full Kelly is unusable in practice, and how half and quarter Kelly compare.
- What is the Kelly criterion?
- How do you calculate Kelly for trading?
- Why do traders use half or quarter Kelly?
VCP and bases, described honestly
What a base is, how contractions are counted, why volume dry-up matters, where the pivot sits, and the walk-forward result that came out breakeven.
- What is a VCP in trading?
- How do you count contractions in a base?
- What is volume dry-up?
Where the stop goes, and what it decides
Structure-based, ATR-based, or percentage stops. Why the stop sets position size rather than the other way round, and the places never to put one.
- Where should you place a stop loss?
- Does the stop determine position size, or the other way round?
- How do you calculate ATR for a stop?
Volume profile, and what the histogram at the bottom cannot tell you
How volume profile differs from a volume-by-time histogram, what POC and the value area mean, how to read volume nodes, and how it pairs with anchored VWAP.
- What is a volume profile?
- What is the point of control (POC)?
- What is the value area and how is it calculated?
Leveraged ETFs, and the arithmetic nobody reads
Daily rebalancing, volatility drag, and a worked two-day example where a 3x ETF loses on a flat round trip. When they fit, and why sizing must be tighter.
- Why do leveraged ETFs lose money over time?
- Can you show an example of leveraged ETF decay?
- Is there a formula for leveraged ETF decay?
The gap between paper and real money
What paper does not simulate: slippage, partial fills, borrow, emotion. Why a promotion gate matters, and the 60-trade rule my engine enforces in code.
- What does paper trading fail to simulate?
- Is paper trading worth doing at all?
- What is a promotion gate in trading?
Alpaca vs Interactive Brokers vs Robinhood for algo trading
API quality, real paper trading, data access and costs across three brokers, plus why unofficial reverse-engineered trading APIs get accounts restricted.
- Does Robinhood have an official API for algorithmic trading?
- Is it safe to use an unofficial Robinhood trading library?
- Which broker has the best paper trading for algo development?
How much to risk per trade
Fixed-fractional, fixed-dollar, and ATR-adjusted sizing with worked arithmetic. Where the 1% rule comes from, portfolio heat, and notional caps.
- How much should I risk per trade?
- What is the 1 percent rule in trading?
- What is the difference between risk per trade and position size?
How to tell whether your edge is fake
In-sample vs held-out testing, parameter plateaus vs spikes, the multiple-testing arithmetic, and the random-entry control that kills most edges.
- What is backtest overfitting?
- How do you know if a trading edge is real?
- Why does testing many strategy variants create false positives?
The arithmetic of digging out
The recovery formula, a full table from 5% to 90%, losing-streak probabilities, risk of ruin, and how a drawdown budget sets your position size.
- How much do you need to gain back after a 50% loss?
- How much do you need to gain back after a 30% loss?
- Why does a percentage loss need a bigger percentage gain?
Reading a backtest report honestly
Stat by stat: what win rate, profit factor, Sharpe, max drawdown and CAGR hide, with worked confidence intervals and cost maths.
- How do you read a backtest report honestly?
- Is a high win rate good in trading?
- What is a good profit factor in a backtest?
Vertical spreads, from the arithmetic up
The four verticals, max profit and max loss formulas with worked dollar examples, buying power reduction, break-even win rates, and assignment risk.
- What is a vertical spread in options?
- What is the max loss on a credit spread?
- How do you calculate breakeven on a vertical spread?
02 · AI & engineering
AI & engineering
Local models, retrieval, automation, and shipping things that stay shipped.
Running a local LLM, and when it is actually the right call
Running a local LLM with Ollama: picking a model for your RAM, the HTTP API, quantisation, context limits, and when local beats a cloud API.
- What is Ollama?
- How much RAM do you need to run a local LLM?
- Should you call Ollama from the CLI or the HTTP API?
RAG, without the diagram everyone reposts
What retrieval-augmented generation is, how chunking, embeddings and reranking fit together, where RAG breaks, and when a graph beats vector search.
- What is retrieval-augmented generation (RAG)?
- What is the difference between RAG and fine-tuning?
- What is chunking in RAG?
Picking an embedding model, and why it matters less than you think
How to pick an embedding model for RAG: dimensions vs cost, local vs API, chunking interactions, recall@k evaluation, and when a reranker wins.
- What is an embedding in RAG, in plain terms?
- Do more embedding dimensions mean better retrieval?
- Should I use a local embedding model or a hosted API?
Getting JSON out of a language model, reliably
JSON mode vs tool calling vs constrained decoding vs schema validation with retry, why parsing free text fails, and idempotency for partial LLM output.
- What is the difference between JSON mode and tool calling?
- What is constrained decoding and why is it stronger?
- Do I still need schema validation if the provider enforces the schema?
Memory like a 30B, speed like a 3B
What mixture-of-experts changes about RAM, quantization levels, KV cache math, Ollama tuning, and realistic tokens per second on Apple Silicon.
- How much RAM do I need to run a 30B MoE model?
- Why is a 30B MoE model faster than a 30B dense model?
- Which quantization level should I use?
Prompt caching, and the traffic pattern where it costs you more
How LLM prefix caching works, cache TTL and break-even math, ordering a prompt so the stable part comes first, and when caching costs you more.
- How does prompt caching actually work?
- Why is my prompt cache hit rate zero?
- How long does a prompt cache entry last?
What an answer engine actually fetches from your site
llms.txt, robots.txt rules for named AI crawlers, JSON-LD entity graphs with @id, mirrored FAQ schema, and what an answer engine cannot see in an SPA.
- Can AI answer engines read a client-side rendered SPA?
- What is llms.txt and does it actually do anything?
- Should I block AI crawlers in robots.txt?
Automate the deadline work, not the thinking
A practical filter for which small-business tasks AI should handle, the two-tier local plus frontier pattern, and why the quality gate is the product.
- Which business tasks are worth automating with AI?
- How do you decide which task to automate first?
- How do you calculate the ROI of an automation?
Snyk vs Trivy vs DIRA: choosing a security scanner
An honest matrix across three security scanners, written by the author of one of them: coverage, container scanning, licensing, cost, and where each one loses.
- Is DIRA a replacement for Snyk or Trivy?
- Which security scanner is best for containers?
- Is Snyk free?
Ollama vs LM Studio vs llama.cpp
A practical comparison of Ollama, LM Studio, and llama.cpp for running local LLMs on Apple Silicon: setup, model management, APIs, and quantization.
- Can I run Ollama, LM Studio, and llama.cpp at the same time on one Mac?
- Do I need a discrete GPU to run local LLMs on a Mac?
- What quantization level should I start with?
Notion vs Obsidian vs a Folder of Markdown Files
A second brain comparison for students: where your notes really live, what leaving each tool costs you, and which one actually fits how you work.
- Can I use Notion and Obsidian at the same time?
- Is Obsidian really free to use?
- Does Notion have a student discount?
An installable app, no backend, no app store
How to build an installable offline PWA with no backend: manifest fields, service worker caching, cache versioning, and how iOS install differs.
- What makes a website installable as a PWA?
- What is the difference between cache-first and network-first?
- Why do users still see the old version after I deploy a PWA?
Tools with no backend, and the honest trade
No account means no breach surface. What you gain from browser-only tools, what you give up in sync and compute, what it costs to run, and how to say so.
- What is a client-side-only tool?
- Is a tool without accounts more secure?
- What do you lose with no backend?
Turning long footage into clips, automatically
Scene-change detection, audio-energy highlights, lossless cutting and concatenation, 9:16 vertical conversion, and why a local pipeline beats a cloud API.
- How do you detect scene changes with ffmpeg?
- How do you find highlights in a video automatically?
- How do you cut a video without re-encoding?
Getting cited when the answer replaces the click
Entity consolidation, llms.txt, robots.txt rules for named AI crawlers, FAQPage that mirrors visible text, answer-first writing, and IndexNow for fast recrawl.
- What is generative engine optimization (GEO)?
- Why does entity consolidation matter for AI search?
- What is llms.txt?
18 things to fix before your first real user
An 18-point security checklist for student founders shipping their first product: secrets, dependency CVEs, config, TLS, backups, and more.
- What is the fastest way to check if I've ever committed a secret?
- If a secret key leaked, do I need to rewrite git history?
- What's the minimum security setup before a first paying customer?
03 · Career & students
Career & students
Applications, interviews, work authorization, and research.
CPT vs OPT for F-1 students
Who authorizes what, the one-academic-year rule, the 12-month limits, the STEM extension, unemployment days, and how to plan the timeline backwards.
- What is the difference between CPT and OPT?
- Does CPT affect OPT eligibility?
- When should you file for OPT?
What an ATS actually does to your resume
What applicant tracking systems really do to a resume, the formatting rules that matter, how to mirror a job description honestly, and the myths.
- What does an ATS actually do to a resume?
- What resume format is safest for an ATS?
- How do I test whether my resume parses correctly?
The internship search, run as a system
How international students should run a SWE internship search: the timeline, the sponsorship question, who to target, and how work authorization fits.
- When should international students apply for summer SWE internships?
- Do internships require employer sponsorship?
- How should you answer the work authorization question on an application?
Write the profile for how recruiters actually search
How recruiters actually search LinkedIn, what belongs in the headline and About, why the first two lines decide everything, and what costs replies.
- How do recruiters search LinkedIn?
- What should a LinkedIn headline contain?
- How long should the About section be?
Verify sponsorship yourself. Every list is already wrong.
A repeatable method for verifying visa sponsorship yourself: req language, H-1B and LCA disclosure data, careers-page patterns, and what none of it proves.
- How do I find out if a company sponsors international interns?
- Does an internship require visa sponsorship for an F-1 student?
- Is a company's H-1B filing history proof that they will sponsor me?
Three firm types, three calendars, and a lot of wrong dates
When quant internships actually open by firm type, rolling versus hard deadlines, how OAs and superdays sequence, and why most circulating deadlines are wrong.
- When do quant internship applications open?
- Are quant internships rolling or do they have hard deadlines?
- Why are the deadlines people share online usually wrong?
One full academic year, full-time, in F-1 status
What one full academic year of full-time enrollment means for CPT, how the clock is counted, CPT versus OPT versus day-1 CPT, and what breaks eligibility.
- What is the one-year rule for CPT?
- Does one full academic year mean twelve months?
- Does time in the US before starting my program count toward the one year?
Five sentences, one paper, one small ask
What actually gets a reply: reading the lab's recent papers, a five-sentence structure, what to attach, follow-up cadence, and two complete examples.
- What should a cold email to a professor actually ask for?
- How long should the email be?
- How much of the professor's paper do I need to read?
The first pass is eight seconds, on a phone, by a non-engineer
What recruiters and applicant tracking systems actually parse, why three projects beat ten, quantified outcomes, README as landing page, and the live-demo rule.
- What do recruiters actually look at in a technical portfolio?
- Does an applicant tracking system read my portfolio site?
- How many projects should a portfolio have?
Free vs Paid: What a CS Student Should Actually Pay For
A decision framework and scored table across 15 tool categories for CS students on what deserves money and what free option is already enough.
- What's the single most important test before buying a student tool?
- Should I buy an annual subscription to save money over monthly?
- Is a local LLM actually a good substitute for a paid AI subscription?
Shipped and reachable beats impressive-sounding
What a student software portfolio needs: a live URL, a README that pitches, three strong projects instead of ten weak ones, and case studies reviewers finish.
- What makes a student software portfolio effective?
- How many projects should be in a portfolio?
- How do you decide which projects to include?
Track which pattern you fail, not how many problems you did
The pattern-based approach to technical interviews: the ten recurring problem patterns, why tracking the pattern you fail beats counting, and spaced repetition.
- What are the main coding interview patterns?
- Why is counting solved problems a bad metric?
- How do you identify which pattern a problem uses?
How undergraduates actually get into a lab
How to find a lab, email a professor, survive the first task, and why publishing as an undergraduate is disproportionately valuable.
- How do you find an undergraduate research lab?
- How should you email a professor about research?
- What types of undergraduate research positions exist?
Learning to program in your second language
What bilingual coding is, why second-language load hurts novice programmers, and what a 60-participant SIGCSE 2026 study found about confidence.
- What is bilingual coding in CS education?
- Why is learning to program harder in a second language?
- What did the SIGCSE 2026 bilingual coding study examine?
Eligibility first, essays second
How international students find and win scholarships, where eligibility usually breaks, and how to run an application pipeline that survives deadlines.
- Can international students get scholarships in the US?
- Where does eligibility usually break for international students?
- What is the difference between a scholarship, grant, and fellowship?
Read it out of order, and check the effect size first
The order to read sections in, how to judge a sample size, what p-values and effect sizes actually mean, and how to spot a claim the data does not support.
- What order should you read a scientific paper in?
- Is a sample size of 60 participants enough?
- What does a p-value actually mean?
The schedule is the skill, not the problem count
The study system, not the problem list: Leitner spaced repetition, how to review a solved problem, timeboxing, and a hint ladder for when you are stuck.
- Why does solving lots of problems not work?
- What is the Leitner system and how do you use it for coding?
- How do you review a coding problem you already solved?
04 · Business & freight
Business & freight
The arithmetic and the operations behind small businesses, brands, and brokerages.
Freight broker margin & rate per mile
Margin versus markup, all-in rate per mile, what deadhead really costs, how a fuel surcharge is built, when detention gets paid, and the break-even on a load.
- How is broker margin calculated?
- How is a fuel surcharge calculated?
- What is the break-even rate on a load?
After the load books, the real work starts
What a small brokerage does after the load books: confirmations, check calls, POD chasing, invoicing and AR — and what automates cleanly.
- What does a freight broker do after a load is booked?
- Why do freight invoices get paid late?
- What is the most chased document in freight?
Vet the carrier before the load, not after the claim
How to verify FMCSA authority, read a certificate of insurance, spot double-brokering, and build a vetting file that survives a cargo claim.
- How do you verify a carrier's FMCSA authority?
- What should a certificate of insurance show?
- Why should a COI come from the insurance agent, not the carrier?
The linehaul is the quote. The accessorials are the profit.
What each charge is, who owes it, how to document time in and out so a claim survives, typical free time, and how unbilled accessorials eat a load's margin.
- What is the difference between detention and demurrage?
- How much free time is typical before detention starts?
- Who pays detention, the shipper or the broker?
The price is a decision. The take-home is arithmetic.
Platform take-home compared on the same list price, VAT and merchant of record, tier design, refund assumptions, and the break-even unit math.
- Which platform leaves you the most on a digital product sale?
- What is a merchant of record and do I need one?
- Do I owe VAT on digital products sold to the EU?
Where every dollar of a $32 tee actually goes
Blank cost, print cost and platform cut separated, a $32 tee and a $58 hoodie worked end to end, plus shipping, returns and the pre-order break-even.
- What does a print-on-demand tee actually net?
- Are hoodies more profitable than tees?
- How much does free shipping cost a clothing brand?
A stranger, on a phone, with four seconds
The one-job rule, above-the-fold structure, specificity over adjectives, proof when you have none, and how to measure a page without a tracking stack.
- What is the most common landing page mistake?
- What belongs above the fold?
- How do you write a headline that converts?
Lemon Squeezy vs Gumroad vs Payhip vs Etsy
Take-home arithmetic on one list price across four digital product platforms, plus merchant of record, VAT, payouts, and when discovery is worth the cut.
- Which platform takes the smallest cut on a digital product?
- What does merchant of record mean and why does it matter?
- Do I have to charge VAT on digital products sold to the EU?
The margin is fine. The volume is the problem.
Base cost, retail, platform fees, and net per unit on a tee and a hoodie — plus the costs people forget: returns, samples, artwork time, and ads.
- How do you calculate print-on-demand profit per unit?
- What margin is realistic on print-on-demand?
- Is print-on-demand profitable?
05 · Body
Body
Calorie math and tracking that survives a bad week.
260 to 200, and the arithmetic that got there
How a calorie deficit actually works: maintenance estimation, deficit size, protein, why the scale lies week to week, and how to track it without obsessing.
- How do you calculate maintenance calories?
- How do you correct a maintenance estimate using real data?
- How big should a calorie deficit be?
The scale is a noisy instrument. Treat it like one.
Why a daily weigh-in is mostly noise, how big that noise actually is, what a moving average recovers, and how long to wait before a trend means anything.
- Should I weigh myself every day or once a week?
- How much can body weight fluctuate in a day?
- What is a weight trend line and how do I calculate one?
06 · Pairs with
The free tools
No signup, no backend — everything runs in your browser and stays on your device.
5 tools
Trader's risk toolkit
Position sizer, R-multiple, expectancy, risk of ruin, Kelly, break-even win rate.
Open →Freight calculators
Rate per mile, deadhead, margin, detention, fuel surcharge, break-even.
Open →Visa Navigator
Backward-planned CPT/OPT and change-of-status timeline with a document checklist.
Open →Bilingual CS glossary
Python terms and the ten most common error messages, explained in English, Spanish, Vietnamese and Arabic.
Open →All apps
TradeLog, Cut, Fire, and GRAMPA — installable, offline, local-only.
Open →Want this arithmetic applied to your product?
The same person who wrote these guides builds AI tooling, trading research software, and client-side apps — fixed scope, quoted price, every claim backed the way these pages back theirs.