Jekyll2022-12-31T15:41:27+00:00https://lincoln-zhou.github.io/feed.xmlLincoln ZhouDeveloper's Personal BlogDownload Reddit Saved Posts2022-10-24T00:00:00+00:002022-10-24T00:00:00+00:00https://lincoln-zhou.github.io/Download-Reddit-Saved-Posts<p>When using the Reddit social media platform, we would sometimes save a post to view it later on. As time goes by, there could be quite a few posts saved. To view all of them in a more efficient manner, we can download them to our local disks, and here comes the method introduced today.</p>
<p>First, install the <a href="https://github.com/aliparlakci/bulk-downloader-for-reddit">bulk-downloader-for-reddit</a> library. It is written in Python, so the most convenient way is to use pip:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>pip install bdfr
</code></pre></div></div>
<p>Then, what we need to do is using the CLI interface to start the downloading. But before that, we need to initiate the authorization step, to make the program able to access our Reddit account.</p>
<p><strong><em>This step presents near zero risk to your Reddit account security, so no need to worry.</em></strong></p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>python -m bdfr download /Desktop --user me --saved --authenticate -L 6
</code></pre></div></div>
<p>And what exactly does the above command do?</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>/Desktop: Save the downloaded file to a specific path, here I choose a Desktop folder
--user me: Specify the user, which in here is the authorized account
--saved: Download posts from the 'Saved' section in your account
--authenticate: Initiate the OAuth process, it is necessary here since we specify the 'me' user
-L 6: Set maximum download limit to 6, so the program would just download the first 6 in your saved posts.
</code></pre></div></div>
<p>And that’s it. Once execute the above command, you would see all posts downloaded to your designated destination. It works well with most media types you’ll find on Reddit, including images, GIF, video, etc.</p>
<p>Also, the <code class="language-plaintext highlighter-rouge">bdrf</code> library has much more features then what I presented here, feel free to try more!</p>When using the Reddit social media platform, we would sometimes save a post to view it later on. As time goes by, there could be quite a few posts saved. To view all of them in a more efficient manner, we can download them to our local disks, and here comes the method introduced today.Batch-Download Image Data From Pinterest2022-08-14T00:00:00+00:002022-08-14T00:00:00+00:00https://lincoln-zhou.github.io/Batch-Download-Image-Data-From-Pinterest<p><a href="www.pinterest.com">Pinterest</a> is a popular image-based social platform. It provides a feature named ‘Collection’, where multiple images can be put together to make an album, making finding multiple images of the same topic much easier.</p>
<p>Under some scenarios, we may want to download all the images present in a collection. For example, we may need images in the ‘Flower’ collection fetched to train a neural network. However, Pinterest doesn’t have such feature, and to make things worse, most functions on this website require user login, adding to the difficulty of making a crawler from scratch.</p>
<p>Here I demonstrate using the <a href="https://github.com/mikf/gallery-dl">gallery-dl</a> library to solve this task. Generally speaking, it has the following advantages:</p>
<ul>
<li>Open-source, no need to worry about malware issues</li>
<li>Developed in Python, can be easily installed using package managers such as <code class="language-plaintext highlighter-rouge">pip</code></li>
<li>Very lightweight, taking less than 20 MB of RAM when downloading, can be deployed to devices such as NAS or Raspberry Pi</li>
<li>Robust, can be configured with multiple options, and can handle large image-batches well, support many more websites other than Pinterest</li>
</ul>
<p>The usage is pretty simple. Most basic syntax:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>gallery-dl URL
</code></pre></div></div>
<p>For Pinterest, we may want to add the following options before the <code class="language-plaintext highlighter-rouge">URL</code>:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>--proxy http://host:port # bypass possible network block
-d DESTINATION_PATH # image save path
--cookies PATH_TO_COOKIE_TEXT_FILE
</code></pre></div></div>
<p>Since Pinterest has a relatively strict auth system, <code class="language-plaintext highlighter-rouge">gallery-dl</code> needs Pinterest browser cookies to make downloading possible. Just use an extension such as <a href="https://chrome.google.com/webstore/detail/editthiscookie/fngmhnnpilhplaeedifhccceomclgfbg?hl=en">EditThisCookie</a> to export cookie text, save it in an plain text file and you’re all set.</p>
<p>That’s it. For more advanced configurations of <code class="language-plaintext highlighter-rouge">gallery-dl</code>, please refer to the project’s GitHub <a href="https://github.com/mikf/gallery-dl#configuration">docs</a>.</p>Pinterest is a popular image-based social platform. It provides a feature named ‘Collection’, where multiple images can be put together to make an album, making finding multiple images of the same topic much easier.Install ROS on Ubuntu 20.04.32022-01-15T00:00:00+00:002022-01-15T00:00:00+00:00https://lincoln-zhou.github.io/Install-ROS-on-Ubuntu-20.04.3<p>ROS is a fundamental library to bridge SLAM systems with real world vehicle applications. This article briefly explains the overall installation process, as well as proposing solutions to some common errors during installation.</p>
<p>Here, we install ROS Noetic Ninjemys on Ubuntu 20.04.3, the overall process is the same for older visions. Please refer to <a href="http://wiki.ros.org/ROS/Installation">ROS Official Wiki</a> for more details.</p>
<h2 id="some-setup-before-installation">Some Setup Before Installation</h2>
<ul>
<li>
<p>Configure Ubuntu repositories to allow all four repository type. Under a few circumstances, it’s the system’s default setting and can be skipped.</p>
</li>
<li>
<p>Setup <code class="language-plaintext highlighter-rouge">sources.list</code>:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
</code></pre></div> </div>
</li>
<li>
<p>Setup keys. Make sure <code class="language-plaintext highlighter-rouge">curl</code> is installed, and then:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
</code></pre></div> </div>
</li>
</ul>
<p>The most common error here is <code class="language-plaintext highlighter-rouge">no valid OpenPGP data found</code>, these are some possible workarounds:</p>
<ul>
<li>
<p>Check Internet connection, especially if you are in worldwide web restricted areas such as mainland China. Use a proxy if possible.</p>
</li>
<li>
<p>Use <code class="language-plaintext highlighter-rouge">wget</code> to manually download the key and then add it. Personally, I believe it is a more robust method since this error may persist even using a proxy:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>wget http://packages.ros.org/ros.key
sudo apt-key add ros.key
</code></pre></div> </div>
</li>
</ul>
<h2 id="installation">Installation</h2>
<p>If the previous steps completed without error, we can head straight to installing ROS, be sure to run <code class="language-plaintext highlighter-rouge">sudo apt update</code> first.</p>
<p>After that, run <code class="language-plaintext highlighter-rouge">sudo apt install ros-noetic-desktop-full</code> to perform a full install. A detailed list of installation options is available on ROS wiki mentioned above.</p>
<p>This is a pretty trivial step and all you need to do is wait patiently. Still, if an error appears saying something like <code class="language-plaintext highlighter-rouge">no packages are found</code>, try open the following URL in your Ubuntu browser:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>apt:ros-noetic-desktop-full?refresh=yes
</code></pre></div></div>
<p>Or directly click <a href="apt:ros-noetic-desktop-full?refresh=yes">here</a>. This will activate the installation process in Ubuntu GUI.</p>
<h2 id="post-installation-setup--initialize">Post-Installation Setup & Initialize</h2>
<p>Run the following command in bash to setup environment:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
source ~/.bashrc
</code></pre></div></div>
<p>And install some other dependencies:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>sudo apt install python3-rosdep python3-rosinstall python3-rosinstall-generator python3-wstool build-essential
</code></pre></div></div>
<p>Next and final step, initialize <code class="language-plaintext highlighter-rouge">rosdep</code>:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>sudo apt install python3-rosdep
sudo rosdep init
rosdep update
</code></pre></div></div>
<p>The step <code class="language-plaintext highlighter-rouge">sudo rosdep init</code> will commonly throw an <code class="language-plaintext highlighter-rouge">Website may be down</code> error, it’s a pretty widespread issue, and these are some solutions <strong>may</strong> work:</p>
<ul>
<li>
<p>Install CA certificate:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>sudo apt-get install ca-certificates
</code></pre></div> </div>
</li>
<li>
<p>Since this error indicates that the target website cannot be connected, it’s <strong>most likely</strong> (also sadly) still an Internet connection issue. Try to use a proxy.</p>
</li>
<li>
<p>If all these failed, we can generate the target file manually:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>mkdir -p /etc/ros/rosdep/sources.list.d
cd /etc/ros/rosdep/sources.list.d
touch 20-default.list
</code></pre></div> </div>
<p>And edit this file:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>sudo nano /etc/ros/rosdep/sources.list.d/20-default.list
</code></pre></div> </div>
<p>Paste the following content then save it:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code># os-specific listings first
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml osx
# generic
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml
gbpdistro https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml fuerte
# newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead
</code></pre></div> </div>
<p>Please notice that, when using this solution, skip <code class="language-plaintext highlighter-rouge">sudo rosdep init</code> command after editing the <code class="language-plaintext highlighter-rouge">20-default.list</code> file. Directly executing <code class="language-plaintext highlighter-rouge">rosdep update</code> is sufficient.</p>
</li>
</ul>
<p>If everything goes right, the last output will be something like:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>reading in sources list data from /etc/ros/rosdep/sources.list.d
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml
Hit https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml
Query rosdistro index https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml
Skip end-of-life distro "ardent"
Skip end-of-life distro "bouncy"
Skip end-of-life distro "crystal"
Skip end-of-life distro "dashing"
Skip end-of-life distro "eloquent"
Add distro "foxy"
Add distro "galactic"
Skip end-of-life distro "groovy"
Skip end-of-life distro "hydro"
Skip end-of-life distro "indigo"
Skip end-of-life distro "jade"
Skip end-of-life distro "kinetic"
Skip end-of-life distro "lunar"
Add distro "melodic"
Add distro "noetic"
Add distro "rolling"
updated cache in /home/lincoln/.ros/rosdep/sources.cache
</code></pre></div></div>
<p>And congratulations, ROS is successfully installed.</p>ROS is a fundamental library to bridge SLAM systems with real world vehicle applications. This article briefly explains the overall installation process, as well as proposing solutions to some common errors during installation.Steam转区教程(2020年8月)2020-08-10T00:00:00+00:002020-08-10T00:00:00+00:00https://lincoln-zhou.github.io/Steam%E8%BD%AC%E5%8C%BA%E6%95%99%E7%A8%8B(2020%E5%B9%B48%E6%9C%88)<p>在2020年7月末,Valve更新了Steam商店的转区规则,转区在一定程度上变得更为复杂。本文将围绕转区前后给出一定的建议,并介绍一种当前(2020年8月初)仍然可用的转区方案。</p>
<p>事先声明,转区<strong>理论上</strong>讲存在着上至红信(帐户封禁)的风险,且本文存在着一些未经官方证实的推测,根据本文对自身Steam帐户进行操作而产生的一切风险请自行承担。由于本人仅仅实际操作过国区转美区,故本文主要讨论转向美区的方案。</p>
<h2 id="为什么要转区">为什么要转区</h2>
<p>在转区还没有被如此严格的限制之时,转区的主要目的是前往低价区购买游戏。诸如俄罗斯区、阿根廷区等游戏价格相对来说要比国区低不少(尽管就在最近低价区部分游戏迎来了一波涨价,游戏厂商不傻)。然而相对于美区等区域,国区游戏的价格实际上已经相当便宜,因此在之前,转区并无多大必要。</p>
<p>但蒸汽平台(由完美世界代理的Steam中国“特供版”)的传闻让转区在某种程度上变得值得考虑。在有关机构收紧海外文娱产品在国内发行的大背景下,综合多个消息来源,这个平台的存在恐怕并非空穴来风。近日SteamDB的一份标记为<code class="language-plaintext highlighter-rouge">steamchinaapproved</code>的游戏列表似乎暗示了蒸汽平台公开上线的进程正在快速推进。</p>
<p><img src="https://raw.githubusercontent.com/Lincoln-Zhou/Lincoln-Zhou.github.io/master/images/gamelist01.jpg" alt="" /></p>
<p><img src="https://raw.githubusercontent.com/Lincoln-Zhou/Lincoln-Zhou.github.io/master/images/gamelist02.jpg" alt="" /></p>
<p>从各个消息源中提取相似信息,蒸汽平台上线后有可能会有以下几个区别于其他区域的特点(仅仅是推测):</p>
<ul>
<li>无国内版号的游戏全部下架(参考App Store按照监管要求于8月1日下架大量无版号游戏),这一点也可以在上面放出的疑似首批获批游戏列表中得到印证。Steam库中已有的游戏应该不会受到影响</li>
<li>出现防沉迷系统、实名认证等已在国内网游中得到大量应用的机制</li>
<li>所有游戏出现开屏文字警告(类似于CS: GO国服启动界面文字)</li>
<li>Steam社区从国际版本独立</li>
<li>关闭或严格限制蒸汽平台向其他区域Steam的帐户转移渠道</li>
</ul>
<p>因此所谓的蒸汽平台如果上线,大概率会因为这些规章而变成一个和国区PSN Store(索尼主机的游戏商店)一样的残废版本,游戏屈指可数,还有极其严格的监管制度。尽管理论上讲游戏可以通过申请版号的方式合规上架,但有一些(或者说绝大多数)游戏大概是无缘再见了。诸如GTA V、Cyberpunk 2077之类的3A能够过审的概率几乎为零。在这种情况下,转区我个人认为是十分有必要的。</p>
<h2 id="转区的风险和劣势">转区的风险和劣势</h2>
<p>按照<a href="https://store.steampowered.com/subscriber_agreement/?snr=1_44_44_#3">Steam订户协议3章A节4款</a>(摘录如下),</p>
<blockquote>
<p>You agree that you will not use IP proxying or other methods to disguise the place of your residence, whether to circumvent geographical restrictions on game content, to purchase at pricing not applicable to your geography, or for any other purpose. If you do this, Valve may terminate your access to your Account.</p>
</blockquote>
<p>Valve在检测到你使用IP代理等方式伪装地区时<strong>有权终止你的帐户</strong>。因此转区行为在一定程度上存在着风险。</p>
<p>当然不用过于担心。参考Reddit上的<a href="https://www.reddit.com/r/Steam/comments/7bfo6y/did_anyone_ever_get_in_trouble_using_a_vpn_for/">这个帖子</a>,迄今为止除了几年前Valve曾封禁过一批跨俄区账号外(而那次封禁本身是否与这项协议有关也存在争议),并没有普遍确凿的翻车案例出现。</p>
<p>为了安全考虑,这篇教程主要讲的是转向美区。由于厂商定价策略、购买力差异、高昂税率等种种原因,美区Steam商店中游戏价格普遍较国区贵(如当前正在全区折扣的荒野大镖客2,美区不含税价格47.99美元折合约334元,而国区只要199元)。这个巨大的差价会使得购买游戏成本大大上升(因此我建议把想入手的大作在转区之前买掉)。但从另一角度讲,Valve作为一家以盈利为目的的商业公司,对低价区(国区)转高价区(美区)的行为做出严厉打击的可能性很小(钱不香吗),也使得相较于俄罗斯区、阿根廷区等(更)低价区,转美区是一个昂贵但相对安全的策略。况且由于宽松的政策,锁美区的游戏很少,可以尽情的入正。</p>
<p>转美区的另一个阻碍是支付方式。当前国区可用的支付宝、微信支付在美区不可用。因此需要另辟蹊径。支付方式的解决方案会在转区具体操作中给出。</p>
<h2 id="转区的具体操作">转区的具体操作</h2>
<p>Valve于最近改变了转区规则。就以往而言,只需使用美国IP地址登陆不在冷却期的Steam帐户即可在帐户明细中进行转区。但经过修订,当前规则如下:</p>
<blockquote>
<p>Your country is part of your Steam account settings. Your country setting affects what you see on the Steam store, the currency you see prices in, and the currency of your wallet.</p>
<p>If you have moved to a new country, or are living abroad for an extended period of time, you can update your Steam country setting when you complete your first purchase using a payment method from that country. If your location differs from your current Steam account store country setting you’ll have an option to change your store region while you view your cart or as you complete your purchase.</p>
<p>If you are unable to complete a purchase using a payment method from the region you have moved to please contact Steam Support.</p>
</blockquote>
<p>概括大意,改变Steam帐户的地区需要在以转入地区的支付方式进行一次购买后进行。因此需要解决的核心问题是找到一个美区能够使用的支付方式。</p>
<p>在此给出一个操作性较强的方案(其他方案没有进行验证,但如果你持有Visa卡或原生美国支付方式等理论上转区会变得非常简单,此处讨论适用于大多数人的方案),即通过国区PayPal绑定国内银联借记卡进行付款。在本人实际操作中使用了绑定中国农业银行借记卡的国区PayPal账户。首先使用美国IP登陆Steam(美国IP代理的获取此处不讨论),随便选择一款游戏(不能是免费)放入购物车。将购物车页面右上角的国家由中国改为美国,此时应会出现地区更改的提示信息。确认后,商店和购物车中物品的货币单位应该已变为美元。回到购物车,付款时选择PayPal支付并等待唤出PayPal页面进行支付确认即可。如果一切正常,等待片刻后会提示付款成功,并会收到分别来自Steam和PayPal的收据邮件。</p>
<p>至此转区基本完成。进入帐户明细页面,若钱包余额货币单位变为美元且<code class="language-plaintext highlighter-rouge">国家/地区</code>项为美国(如图示),则你的Steam帐户已顺利进入美区。</p>
<p><img src="https://raw.githubusercontent.com/Lincoln-Zhou/Lincoln-Zhou.github.io/master/images/sample.png" alt="" /></p>
<p>还有一些细枝末节要注意。在通过PayPal支付的方式成功转往美区后,你转区时使用的PayPal账户似乎会被关联到Steam帐户。但往后的购物中还是建议直接用付款选项中的PayPal付款(即使用付款选项中的“贝宝”,而非“我的PayPal账户”,如图示)。<img src="https://raw.githubusercontent.com/Lincoln-Zhou/Lincoln-Zhou.github.io/master/images/paypal.png" alt="" />实际测试中“我的PayPal账户”会遇到错误无法支付,而唤出的“贝宝”可以正常付款(对跨国交易这块不了解,但猜测是前者试图直接从PayPal余额中扣除美元,后者走了PayPal自己的汇率结算通道从绑定的借记卡中转出人民币)。</p>
<p>另一个要注意的是账单地址的问题,这可能会影响税率(美国各州联邦法律规定了不同的税率)。更改账单地址需要在选择支付方式时进行。如果在上图中未看见“我的Steam钱包”选项,点击底部的“后退”即会出现如下图所示页面:<img src="https://raw.githubusercontent.com/Lincoln-Zhou/Lincoln-Zhou.github.io/master/images/address.png" alt="" />这里需要填写一个美国的账单地址并勾选保留付款信息选项。如果有亲友熟人在美国的话那最好填写他们的地址(这样万一出现风控可以应对),不然去Google Maps上搜个正常点的地址填上去也无妨。至于税的问题,美国当前有五个免消费税州(Alaska, Delaware, Montana, New Hampshire, Oregon),也有一些税率较低的州,具体可以参见<a href="https://www.thebalance.com/states-without-a-sales-tax-3193305">这篇文章</a>。在美区购买游戏请务必考虑到税和汇率的存在,银行卡余额预先备足。</p>
<h2 id="转区后的一些注意事项和疑问解答">转区后的一些注意事项和疑问解答</h2>
<ul>
<li>理论上转区过后可以直接国内网络直连玩Steam,可使用国内网络正常下载更新游戏。但出于谨慎考虑,建议购买游戏或进行市场交易时使用美国IP代理。</li>
<li>由于网络封锁原因,即使转区后,Steam社区和部分敏感内容游戏可能仍然需要IP代理来正常访问。</li>
<li>转区后,一些需要绑定国内第三方平台账号的联机游戏仍可正常游玩,如国服CS: GO等;第三方饰品交易平台如Netease Buff等仍可正常使用。</li>
<li>转区后,好友间可正常进行交易,但由于售价差异无法跨区赠送礼物。</li>
<li><strong>请务必不要频繁转换区域!!!</strong>在美区和国区之间反复横跳的行为有较大可能触发Valve风控,带来不必要的损失。</li>
<li><strong>请务必注意电商平台余额充值卡的来源!!!</strong>一般来说,充值卡售价与其面额经汇率转换后的价格相差较大的很有可能来路不正(如100美元的余额充值卡只卖500元),给自己的Steam帐户带来额外的风险。最安全的还是拿前文提到的方式付款,或者在正规店铺购买实体充值卡。</li>
</ul>
<p>以上就是本人对于当前情况下Steam转区提出的一个方案。由于这篇文章是临时起意进行创作,在准备素材之前我就已经完成了转区操作,所以某些操作步骤可能凭记忆描述得略有偏差,如出现错误或实际操作中的疑问欢迎评论指出,谢谢。</p>
<p>本文已由本人账号在<a href="https://zhuanlan.zhihu.com/p/173719305">知乎专栏</a>发表,保留一切权利,拒绝任何形式转载。文章中所含内容可能会得到更新,请前往知乎平台查看。</p>
<p>由于本文主要面向中国大陆地区用户,故未翻译英文版本。</p>在2020年7月末,Valve更新了Steam商店的转区规则,转区在一定程度上变得更为复杂。本文将围绕转区前后给出一定的建议,并介绍一种当前(2020年8月初)仍然可用的转区方案。Choosing a Mac Laptop in 20202020-07-15T00:00:00+00:002020-07-15T00:00:00+00:00https://lincoln-zhou.github.io/Choosing-a-Mac-Laptop-in-2020<p>Currently Mac laptop has a relatively sophisticated line-up, each intended for different needs. In this post, we briefly talk about whether you should buy a Mac and which Mac laptop to choose from.</p>
<h2 id="consider-these-before-choosing-a-mac">Consider These Before Choosing a Mac</h2>
<h3 id="your-budget">Your Budget</h3>
<p><strong>Mac is expensive</strong>. Generally, Mac costs about 1.5~3 times the price of a similar Windows laptop. You should think twice if your money isn’t that sufficient.</p>
<h3 id="games">Games?</h3>
<p>Frankly speaking, with the growing market share of macOS and native graphical framework like Metal, macOS has lots of games to play currently, even including some 3A games such as Tomb Raider trilogy, COD 12, etc. However, Mac isn’t designed for that. Its keyboard or cooling design can make gaming experience not so satisfying. With the same or even lower price, you can buy a way better Windows gaming laptop. If you are a heavy gamer, choosing Mac as your primary computer isn’t a good choice.</p>
<h3 id="habits">Habits</h3>
<p>Quite a few people are reluctant to get accustomed to new things, and think about this if you are one of them. For people switching from WIndows to macOS, it means something new to learn and adapt to: new UI design, new interactive logic etc. Still, don’t be too worried. I’ll talk about how to move from Windows to macOS fluently in a future post.</p>
<h3 id="software">Software</h3>
<p>While most large companies now consider developing a macOS version for their software products, some do not. Thus some applications critical for specific fields may be unavailable on Mac, such as CAD. If you have strong need for those softwares, don’t buy a Mac as your primary computer.</p>
<h2 id="which-mac-to-choose-from">Which Mac to Choose From</h2>
<p>Currently there are two common Mac laptop types available in the market: MacBook Pro and MacBook Air.</p>
<hr />
<p>MacBook Pro has two versions: 16 inch and 13 inch.</p>
<p>The 16 inch version is the most powerful one in Mac laptop line-up. It was introduced in late 2019, replacing the previous 15 inch version. It’s also the most expensive one. The basic version has an Intel Core i7-9750H CPU and AMD Radeon Pro 5300M GPU, with 16GB memory and 512GB SSD, comes at the price of 2399 USD. You can choose to upgrade to up to i9-9980HK CPU and Radeon Pro 5600M GPU.</p>
<p><img src="https://raw.githubusercontent.com/Lincoln-Zhou/Lincoln-Zhou.github.io/master/images/mbp16.jpeg" alt="image" /></p>
<p>MacBook Pro 16’’ is suitable for those who use Mac as a primary computer, and not caring so much about portability. Be advised, the 16’’ inch version hasn’t been upgraded since its initial release in Q4 2019, meaning it hasn’t been equipped with Intel Core 10th generation CPU. Wait for the upgrade if that bothers you.</p>
<hr />
<p>13 inch MacBook Pro sacrifices dedicated graphics card and high-end CPU for better battery time and smaller size.</p>
<p><img src="https://raw.githubusercontent.com/Lincoln-Zhou/Lincoln-Zhou.github.io/master/images/mbp13.jpeg" alt="image" /></p>
<p>For its CPU, you can choose between i5-1038NG7 and i7-1068NG7. Their performence, compared with i9-9880H (which is used in one of the 16 inch models) and a common low voltage 10th gen i7:</p>
<p><img src="https://raw.githubusercontent.com/Lincoln-Zhou/Lincoln-Zhou.github.io/master/images/Picture3.png" alt="image" /></p>
<p>You can see from the picture that the difference in performence between i5 and i7 isn’t that huge, while choosing i7 costs 200 USD more. That’s why I recommend the i5 version. To be more precise, the model in <a href="https://www.apple.com/shop/buy-mac/macbook-pro/13-inch-space-gray-2.0ghz-quad-core-processor-with-turbo-boost-up-to-3.8ghz-512gb#">this link</a>. It’s a quite balanced one, satisfying most needs.</p>
<p>Also notice, you can still choose the 8th generation model, starting from 1299 USD. However, if your budget is higher than that, it’s strongly recommended to choose 10th generation model.</p>
<p>MacBook Pro 13 inch suits those who have portable needs while unwilling to sacrifice too much performence. It’s also relatively cheap, good for those with limited budgets.</p>
<hr />
<p>MacBook Air upgraded its models in early 2020, bringing a new designed keyboard and so on. It sacrifices a lot in performence, for more portability and battery time.</p>
<p><img src="https://raw.githubusercontent.com/Lincoln-Zhou/Lincoln-Zhou.github.io/master/images/mba2020.jpeg" alt="image" /></p>
<p>To be honest, if you’re a heavy computer user, the Air version should really be ruled out of consideration since its CPU are not so powerful regarding performence.</p>
<p><img src="https://raw.githubusercontent.com/Lincoln-Zhou/Lincoln-Zhou.github.io/master/images/Picture5.png" alt="image" /></p>
<p>Right two are the CPUs MacBook Air use, with their TDP not higher than 10W, which means longer battery time. Good news for those who only use Mac to perform light tasks or frequently carry it out.</p>
<p>MacBook Air is the cheapest Mac laptop you can get right now, starting at 999 USD. You can also choose to upgrade it to up to 2249 USD, not worth it though. MacBook Air is suitable for those who need a light, portable laptop, or just want to try macOS.</p>
<hr />
<p>A notice here. In WWDC 2020, Apple announces Apple Silicon. Acoording to plan, the whole Mac line-up will gradually transfer from Intel CPUs to Apple’s own ARM based processors. However, it doesn’t mean you shouldn’t buy Intel based Macs right now. Support for Intel based Macs won’t be dropped in the near future, and it’s safe to buy one whenever you want. A further post will talk more about this after the release of the first Apple Silicon Mac.</p>
<p><strong><em>The CPU benchmarks appeared in this post are mainly from <a href="https://www.cpubenchmark.net">cpubenchmark.net</a>, price data are from <a href="https://www.apple.com/">Apple US</a>.</em></strong></p>Currently Mac laptop has a relatively sophisticated line-up, each intended for different needs. In this post, we briefly talk about whether you should buy a Mac and which Mac laptop to choose from.Add Advanced Features to the Blog2020-07-03T00:00:00+00:002020-07-03T00:00:00+00:00https://lincoln-zhou.github.io/Add-Advanced-Features-to-the-Blog<p>This post introduces two advanced features already implemented in jekyll framework: DISQUS and Google Analytics.</p>
<p>After reading this, you’ll learn about:</p>
<ul>
<li>Using DISQUS comment system to interact with your blog readers</li>
<li>Using Google Analytics to monitor your blog and better understand your visitors</li>
</ul>
<h2 id="disqus">DISQUS</h2>
<p>DISQUS provides your blog with a comment system, and is built inside jekyll. You may notice in <code class="language-plaintext highlighter-rouge">_config.yml</code> that there’s one entry like this:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code># Enter your Disqus shortname (not your username) to enable commenting on posts
# You can find your shortname on the Settings page of your Disqus account
disqus:
</code></pre></div></div>
<p>This is where you can enable DISQUS in your blog. But first, you need to get your blog a shortname.</p>
<p>Go to <a href="https://disqus.com">DISQUS</a>, follow the instructions to sign up and register your blog. The instructions are clear in the website and I won’t talk too much about detailed procedures. Just notice that you need to fill your DISQUS <strong>shortname</strong> to <code class="language-plaintext highlighter-rouge">_config.yml</code>, and finding that can be a bit frustrating. If you get lost in the website’s complex system, refer to <a href="https://help.disqus.com/en/articles/1717111-what-s-a-shortname">this page</a>. This official doc instructed you on finding the shortname in detail.</p>
<p>After filling in the shortname to <code class="language-plaintext highlighter-rouge">_config.yml</code>, DISQUS should be loaded in the posts of your blog. You will be notified by emails when there’s a new comment.</p>
<p>If there displays an error saying DISQUS can’t be loaded, check whether your blog is properly registered and whether you get the shortname right. Mostly, that’s where things go wrong. Check your network connection either, DISQUS can be unstable or unavailable in some regions.</p>
<h2 id="google-analytics">Google Analytics</h2>
<p>Google Analytics is something you will need when wanting to get an overview of your blog’s visitors. It’s powerful, with many advanced features. Here, we just talk about the basics.</p>
<p>Go to Google Analytics and register your blog (the procedure is somewhat similar to previous one), after that you’ll get a <em>Google Analytics Web Tracking Code</em>, copy and paste it here in <code class="language-plaintext highlighter-rouge">_config.yml</code>:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code># Enter your Google Analytics web tracking code (e.g. UA-2110908-2) to activate tracking
google_analytics:
</code></pre></div></div>
<p>That’s all you need to do. Leave behind the JavaScript code Google Analytics told you to put in your blog after successfully registered, jekyll has included that inside.</p>
<p>When done, go to <a href="https://analytics.google.com">Google Analytics</a>, the system may take some time to fetch data. After that, you can analyze your blog data easily.</p>
<h2 id="conclusion">Conclusion</h2>
<p>With these two systems, your blog now has a place for interaction and a system for statistical analysis, use them wisely.</p>
<p>Also, notice that using these systems means your blog visitors’ information will be gathered or analyzed in some ways, so you’d better add a terms & conditions page or privacy policy page to avoid potential legal issues.</p>
<p>This blog together with the previous two (<a href="https://lincoln-zhou.github.io/The-Basics-of-Building-a-Blog/">The Basics of Building a Blog</a>; <a href="https://lincoln-zhou.github.io/Customize-the-Blog/">Customize the Blog</a>) briefly introduces ways to build a fully functional personal blog, and those should cover most things you need. More advanced instructions may be introduced in future posts.</p>This post introduces two advanced features already implemented in jekyll framework: DISQUS and Google Analytics.Customize the Blog2020-07-02T00:00:00+00:002020-07-02T00:00:00+00:00https://lincoln-zhou.github.io/Customize-the-Blog<p>This post introduces how to make the blog looks more decent.</p>
<p>After reading this, you will learn how to:</p>
<ul>
<li>Customize your blog’s name and description shown in web browser</li>
<li>Add personal contact information to your blog</li>
<li>Use images in your blog</li>
<li>Add a favicon to your blog</li>
<li>Add a new page to your blog</li>
</ul>
<h2 id="customize-the-blog-with-_configyml">Customize the Blog with _config.yml</h2>
<p>In the root directory of your GitHub Pages project, you should find the <code class="language-plaintext highlighter-rouge">_config.yml</code> file. This is where you control website properties in jekyll, and is exactly what we need to complete the first two tasks.</p>
<p>The file has detailed instructions inside, informing you about what and how to change. Currently, don’t mess with anything else, just go to the <code class="language-plaintext highlighter-rouge">name</code> and <code class="language-plaintext highlighter-rouge">description</code> entry to customize your name and the blog’s description.</p>
<p>To add your personal contact information, go to the <code class="language-plaintext highlighter-rouge">footer-links</code> part, and choose entries you want to add. For example, if you want to publish your GitHub account info, fill that entry with your GitHub account name, and an icon will appear at the bottom of your blog linking to your GitHub account’s profile page. Use this wisely, bear in mind that anyone can see it, so make sure you only publish profiles links to those you feel free to make public.</p>
<p>In later blog posts I will introduce more about using <code class="language-plaintext highlighter-rouge">_config.yml</code>, right now we have all we need. Remember to commit file changes to your repository before closing the tab.</p>
<h2 id="use-images-in-the-blog">Use Images In the Blog</h2>
<p>Images help making the blog looks better. In your blog, you’re supposed to store most images used in the <code class="language-plaintext highlighter-rouge">/images</code> directory. To use the image uploaded to GitHub, open the image, right click on the previewed image and choose <code class="language-plaintext highlighter-rouge">Open Image in New Tab</code> (if no preview options available, choose <code class="language-plaintext highlighter-rouge">View raw</code>), then copy the new tab’s URL. Under most circumstances, the URL will be something like:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>https://raw.githubusercontent.com/userName/userName.github.io/...
</code></pre></div></div>
<p>Then you can use this URL in your post’s <code class="language-plaintext highlighter-rouge">.md</code> file to show an image or to config your avatar in <code class="language-plaintext highlighter-rouge">_config.yml</code>.</p>
<p>Be advised, this is only one of the solutions, you actually can upload the image file to wherever you prefer, just make sure the image is accessible in the public Internet. For example, upload the image to some host provider such as <a href="https://imgur.com/">Imgur</a> and use the generated link in your blog also works, while upload to your personal Google Photos may fail, since it can be accessed only with your personal Google account.</p>
<h2 id="add-a-favicon">Add a Favicon</h2>
<p>To add a favicon, you need to have some favicon icons first. You can design one by yourself (which can be unique but time-consuming), or just use some online generators, such as <a href="https://favicon.io/favicon-generator/">favicon.io</a>, or <a href="https://www.websiteplanet.com/webtools/favicon-generator/">Favicon Generator</a>, each with their unique features, just choose one which suits your demand!</p>
<p>Now you have a favicon file named <code class="language-plaintext highlighter-rouge">favicon.ico</code>, upload it to root directory of your blog repository in GitHub.</p>
<p>Next, go to <code class="language-plaintext highlighter-rouge">/_layouts/default.html</code>, in the <code class="language-plaintext highlighter-rouge">head</code> part of the file, add the following code:</p>
<div class="language-html highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nt"><link</span> <span class="na">rel=</span><span class="s">"shortcut icon"</span> <span class="na">type=</span><span class="s">"image/x-icon"</span> <span class="na">href=</span><span class="s">"/favicon.ico?"</span><span class="nt">></span>
</code></pre></div></div>
<p>Commit changes and wait a minute, your blog should have a customized favicon now, no more being ugly with Google Chrome’s default favicon.</p>
<h2 id="add-a-new-page">Add a New Page</h2>
<p>Sometimes we want something more than merely posts in the blog. For example, adding a privacy policy page. This isn’t complex. You can write the content of this new page in Markdown and let jekyll render it for you, the front matter is a bit different. To create a new <strong>page</strong>, add something like this in the beginning of your <code class="language-plaintext highlighter-rouge">.md</code> file:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>---
layout: page
title: Privacy Policy
permalink: /privacy.html
---
</code></pre></div></div>
<p>Next, rename the file to something like <code class="language-plaintext highlighter-rouge">privacy.md</code>, and upload it to the root directory of the repository.</p>
<p>Now, your new page can be accessed with <code class="language-plaintext highlighter-rouge">https://yourBlogName/privacy.html</code>.</p>
<p>Please notice, you can also create more organized pages using subfolders, the official docs can be found <a href="https://jekyllrb.com/docs/pages/">here</a>.</p>
<h2 id="conclusion">Conclusion</h2>
<p>This part can be a bit complex sometimes, and a few glitches may happen. Remember to refer to the official docs when encountering problems. In the next post, I’ll introduce ways to monitor your blog and interact with readers better, using Google Analytics and DISQUS.</p>This post introduces how to make the blog looks more decent.The Basics of Building a Blog2020-07-01T00:00:00+00:002020-07-01T00:00:00+00:00https://lincoln-zhou.github.io/The-Basics-of-Building-a-Blog<p>In this post, I will briefly introduce ways to bulid a free personal blog using GitHub Pages and jekyll framework.</p>
<p>Follow the steps, and you will:</p>
<ul>
<li>Learn the basics about GitHub Pages and jekyll framework</li>
<li>Have a personal blog hosted on GitHub Pages and be able to access it with your web browser</li>
<li>Learn how to add new posts to your blog</li>
</ul>
<p>To follow the steps smoothly, it’s suggested that you should be equipped with the following:</p>
<ul>
<li>Basic knowlege of GitHub and Markdown (tutorials can be found <a href="https://guides.github.com/features/mastering-markdown/">here</a>)</li>
<li>A personal GitHub account</li>
</ul>
<h2 id="create-the-blog">Create the Blog</h2>
<p>Shortly speaking, GitHub Pages offers you an environment to host your static website pages, while jekyll helps you handling most technical things and enables you to focus on content of the blog. A combination of the two makes it easy for beginners to build their personal blogs. While it may not be as powerful as blogs based on other frameworks such as WordPress, it meets the needs of most people.</p>
<p>To get your blog ready, fork <a href="https://github.com/barryclark/jekyll-now">this repository</a> to your GitHub account, and change your own repository (which you just forked from the URL above) name to this format:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>yourName.github.io
// yourName is your GitHub account name
</code></pre></div></div>
<p>For example, if my GitHub account name is Lincoln, change the name of repository to <code class="language-plaintext highlighter-rouge">Lincoln.github.io</code> .</p>
<p>Now, just wait a minute, then open your web browser and go to <code class="language-plaintext highlighter-rouge">yourName.github.io</code>, you shall see the icon of jekyll and a notice telling that you’re up and running.</p>
<p>Till here, a blog with your unique URL has been generated and is accessible online.</p>
<h2 id="add-new-posts">Add New Posts</h2>
<p>Most times, you are suggested to write posts using Markdown, which means you can merely focus on writing the post, and jekyll will handle everything else.</p>
<p>While GitHub website has basic ability to write Markdown, I still recommend you to use a editor you like, such as Typora, Visual Studio Code and so on.</p>
<p>I’m not gonna talk about how to write Markdown here, but be advised, in order to make jekyll recognize your post file, there are some unique syntax you should pay attention to in your <code class="language-plaintext highlighter-rouge">.md</code> file, for example, each new <strong>post</strong> should start with this:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>---
layout: post
title: yourTitle //title of this post
---
</code></pre></div></div>
<p>Also, bear in mind that <strong>what you see in your editor isn’t exactly what you’ll see in the rendered webpage</strong>, the UI can be ugly if you write some part of the Markdown file inappropriately. You may need to try a few times before making the post looks exactly what you want.</p>
<p>After finishing the writing work, let’s release the post. First, change the Markdown file name to:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>YYYY-MM-DD-postTitle.md
</code></pre></div></div>
<p>For example, I have a new post called “About This Blog”, and I released it on July 1st, 2020, then the file should be renamed into <code class="language-plaintext highlighter-rouge">2020-7-1-About-This-Blog.md</code>.</p>
<p>Next, upload the file to <code class="language-plaintext highlighter-rouge">yourName.github.io/_posts</code> on GitHub, commit changes, done.</p>
<p>Now wait a moment, and the post you just upload will be accessible from the index page of your personal blog.</p>
<h2 id="conclusion">Conclusion</h2>
<p>This part is the most basic yet most important one to build a personal blog. In the next post, I’ll introduce more on customizing your personal blog.</p>In this post, I will briefly introduce ways to bulid a free personal blog using GitHub Pages and jekyll framework.About This Blog2020-06-28T00:00:00+00:002020-06-28T00:00:00+00:00https://lincoln-zhou.github.io/About-This-Blog<p>A brief introduction to the purpose of this blog</p>
<h2 id="introduction">Introduction</h2>
<p>This blog is a place to share my personal ideas and perspectives. I write articles on programming, Apple ecosystem, hardware and so on.</p>
<p>This is a technical blog, all posts here focus on technology, nothing else.</p>
<p>This blog is hosted on <a href="https://pages.github.com/">GitHub Pages</a>, using <a href="https://github.com/barryclark/jekyll-now">jekyll</a> framework.</p>
<h2 id="legal-notice">Legal Notice</h2>
<p>All rights reserved, any kind of copying, pirating or reposting is prohibited.</p>
<p>This blog uses <a href="https://disqus.com/">Disqus</a> comment system, all comments should comply with regulations of the United States, and will be removed if otherwise.</p>
<p>This blog uses several third parties’ logo designs, including the Swift logo, GitHub logo, StackOverflow logo, etc. The blog doesn’t have and doesn’t intend to show affiliation to the respective holders of these logos.</p>
<p>For legal notice and license of the open-source framework this blog uses, please refer to the <a href="https://github.com/barryclark/jekyll-now/blob/master/LICENSE">jekyll’s license page</a>.</p>
<p>For this site’s privacy policy, refer to the <a href="https://lincoln-zhou.github.io/privacy">privacy policy page</a>.</p>
<h2 id="contact-me">Contact Me</h2>
<p>To contact the owner of this blog, go to the bottom of the blog and send an e-mail.</p>A brief introduction to the purpose of this blog