The plan to equip Ryzen

Division 1: A Baseline NAS

Component Product Name Cost Source Status
HDD Beracuda 2TB JD Already owned
CPU AMD Athlon 200GE with Radeon Vega Graphics ¥239 Taobao New
Mobo ASRock B450 Gaming-ITX/ac (AM4 Socket) ¥853 JD New
RAM MAXSUN Q3 DDR4 2666 8G ¥179 Taobao New
PSU FSP MS450 450W SFX ¥439 JD New
Case CyberPowerPC Syber CSCCO100 Orange Mini ITX Gaming Case $34.99 Gamestop New
Heat sink New
Subtotal ~$281.5

Division 2: A “Rig” for Computing & Rendering

Stage 1

Component Product Name Cost Source Status
Graphics Sapphire Radeon NITRO+ RX 590 8GB GDDR5 PCI-E $215.99 Amazon Already owned
PSU Thermaltake Smart White RGB 500W 80+ White 12V ATX - PS-SPR-0500NHFAWU-1 $49.99 Walmart Already owned
RAM G.Skill TridentZ RGB Series 16GB (2 x 8GB) 288-Pin SDRAM DDR4 3200 (PC4 25600) F4-3200C14D-16GTZR $164.54 Amazon New
Case BitFenix Prodigy M $94.99 Amazon New
Mobo MSI B450M MORTAR ¥618.99 JD New
SSD SAMSUNG 500GB M.2(NVMe) 970 EVO MZ-V7E500BW ¥598.99 JD New
CPU AMD RYZEN 7 3700X w/ Wraith Prism Cooler $324.99 Amazon New
Subtotal ~$1026

Notes:

  • Some may suggest MSI B450M MORTAR TITANIUM / MAX, which turn out to be almost the same except in another color / capable of higher RAM frequency.
  • The stylish inverted BitFenix Prodigy M case has some unique air flow issues.

Stage 2

Component Product Name Cost Source Status
RAM ** The same (2 x 8GB) ** $154.99 Amazon New
Graphics ** Starting from GTX1660 Super, RX 5700, RTX 2060, … **
PSU Thermaltake Toughpower Grand RGB 750W 80+ Gold MB 12V RGB $112.85 Amazon New
Water Cooling JONSBO SHADOW 240 ¥399 JD New
Fan CoolerMaster MasterFan MF120R ARGB x3 bundle w/ controller ¥349 JD New

Notes:

  • Entry-level AIO water coolers are not recommended, which can’t even beat tower fan coolers.

Video Editing PC Building

Deep Learning Rig Building

macos-disk-cleanup

Basics: Purgeable space is not unused space.

Purgeable space is logically unoccupied at the scope of macOS System, but physically not.

Idiot apps like Xcode would refuse to install, though the “available” space is fairly enough, given that purgeable space included.

Use df -h to query for unused disk space physically.

Purgeable space can be released manually by making local snapshots thinner.

tmutil thinlocalsnapshots / 10000000000 4

Shrink TimeMachine backups.

Remove local Photo Library

Stop icloud photo syncing.

Remove unused Simulators

They can be downloaded again from Xcode when in need.

xcrun simctl delete unavailable/all

Remove unused Docker local image

Advanced Python Programming

  • What are the method(s) that iterator object must implement?

    __iter__() and __next__()

  • If a function contains at least one yield statement, it becomes a generator function.

  • In Python, there is a built-in function property() that returns a property object. The property object has which of the following methods?

    getter(), setter() and delete()

  • zip produces an iterator which can only be iterated once. Once you have iterated it, it’s exhausted.

  • Where to use closure

    • We must have a nested function (function inside a function).
    • The nested function must refer to a value defined in the enclosing function.
    • The enclosing function must return the nested function.

Insight into advanced C++ OOP

Source and Header

The reasons to separate are:

  • To improve build times. Faster recompiles: If your implementation is split up into separate compilation units, you only need to recompile the ones that change when making edits.
  • To link against code without having the source for the definitions.
  • To avoid marking everything “inline”.

Polymorphism in C++

Compile time polymorphism

Function/Operator Overloading

Runtime polymorphism

Function overriding on the other hand occurs when a derived class has a definition for one of the member functions of the base class.

  • To avoid ambiguity error when multiple inheritence.

  • Virtual functions are functions that can be overridden in derived class with the same signature.

  • Virtual functions enable run-time polymorphism in a inheritance hierarchy.

  • If a function is ‘virtual’ in the base class, the most-derived class’s implementation of the function is called according to the actual type of the object referred to, regardless of the declared type of the pointer or reference. In non-virtual functions, the functions are called according to the type of reference or pointer.

  • Static functions are class specific and may not be called on objects. Virtual functions are called according to the pointed or referred object.

  • Virtual function has a VPTR that poccesses some memory.

  • A member function can be virtual even if we have not uses virtual keyword with it. When a class has a virtual function, functions with same signature in all descendant classes automatically become virtual. We don’t need to use virtual keyword in declaration of fun() in B and C. They are anyways virtual.

  • A base class function can be accessed with scope resolution operator even if the function is virtual.

Replacing system-wide `nodejs` by another version managed by `nvm`

Some legacy codes are not compatible with latest nodejs. nvm helps with this situation to provide older stable version.

Uninstall system-wide nodejs and install nvm via package management.

Config fish-shell:

1
2
3
4
5
6
function nvm
bass source (brew --prefix nvm)/nvm.sh --no-use ';' nvm $argv
end

set -x NVM_DIR ~/.nvm
nvm use default --silent

Take effect immediately:

source ~/.config/fish/config.fish

An extension to fish-shell is bass.

Bass makes it easy to use utilities written for Bash in fish shell.

An extension to homebrew is cask.