<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: liamlo-dev</title>
    <description>The latest articles on Forem by liamlo-dev (@liamlodev).</description>
    <link>https://forem.com/liamlodev</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F964229%2F9b67b161-da03-4c74-8b90-0b940a77e797.png</url>
      <title>Forem: liamlo-dev</title>
      <link>https://forem.com/liamlodev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/liamlodev"/>
    <language>en</language>
    <item>
      <title>Download dood video (+ js -&gt; img)</title>
      <dc:creator>liamlo-dev</dc:creator>
      <pubDate>Wed, 02 Aug 2023 04:58:15 +0000</pubDate>
      <link>https://forem.com/liamlodev/download-dood-video-51b3</link>
      <guid>https://forem.com/liamlodev/download-dood-video-51b3</guid>
      <description>&lt;p&gt;Example: &lt;br&gt;
&lt;a href="https://dooood.com/e/kluhm510q8r9"&gt;https://dooood.com/e/kluhm510q8r9&lt;/a&gt;&lt;br&gt;
&lt;a href="https://asiajjj.com/view1/54691/"&gt;https://asiajjj.com/view1/54691/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Online decoder (may not work later):&lt;br&gt;
&lt;a href="https://9xbuddy.com/"&gt;https://9xbuddy.com/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Passing the 1st guard (no right click / F12):&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;View -&amp;gt; Developer&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Passing the 2nd guard (Paused in debugger):&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Deactivate breakpoints&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--v_OebwTL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yd2n2xtw640ipqtyfz8k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--v_OebwTL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yd2n2xtw640ipqtyfz8k.png" alt="Deactivate breakpoints" width="800" height="82"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Passing the 3rd guard (download):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;saveFile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;blob&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;navigator&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;msSaveOrOpenBlob&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;navigator&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;msSaveOrOpenBlob&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;blob&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;createElement&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;a&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;appendChild&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;URL&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;createObjectURL&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;blob&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;href&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;download&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;click&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nx"&gt;setTimeout&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;URL&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;revokeObjectURL&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;removeChild&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="c1"&gt;// copy paste from a stackoverflow&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;videojs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getAllPlayers&lt;/span&gt;&lt;span class="p"&gt;()[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;src&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]());&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;reader&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;getReader&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;total&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;content-length&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;chunks&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[];&lt;/span&gt;
&lt;span class="k"&gt;while&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;done&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;reader&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;read&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;done&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nx"&gt;chunks&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;total&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;toFixed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;%&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;blob&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;Blob&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;chunks&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;saveFile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;blob&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;video.mp4&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Passing the 4th guard (img src = "xxx.js"):&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Download it anyway. Then change the file extension to &lt;code&gt;jpg&lt;/code&gt; or &lt;code&gt;png&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Source: &lt;a href="https://www.reddit.com/r/DataHoarder/comments/11m8eqa/need_help_downloading_videos_from_doodstream/"&gt;https://www.reddit.com/r/DataHoarder/comments/11m8eqa/need_help_downloading_videos_from_doodstream/&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Keynote high resolution image</title>
      <dc:creator>liamlo-dev</dc:creator>
      <pubDate>Tue, 25 Jul 2023 09:34:42 +0000</pubDate>
      <link>https://forem.com/liamlodev/keynote-high-resolution-image-4243</link>
      <guid>https://forem.com/liamlodev/keynote-high-resolution-image-4243</guid>
      <description>&lt;p&gt;Use this as an alternative to Canva, which offers low resolution (even for Instagram profile photos) in its free version.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Establish image resolution in Keynote: Inspector (RHS) &amp;gt; Document &amp;gt; Document &amp;gt; Slide Size &lt;em&gt;For IG, 4xxx is recommended&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;Export to JPEG: File &amp;gt; Export &amp;gt; Images&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Source: &lt;a href="https://discussions.apple.com/thread/4536285"&gt;https://discussions.apple.com/thread/4536285&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Auto Join Zoom Meetings with Python</title>
      <dc:creator>liamlo-dev</dc:creator>
      <pubDate>Mon, 08 May 2023 02:43:32 +0000</pubDate>
      <link>https://forem.com/liamlodev/auto-join-zoom-meetings-with-python-2c8e</link>
      <guid>https://forem.com/liamlodev/auto-join-zoom-meetings-with-python-2c8e</guid>
      <description>&lt;p&gt;&lt;strong&gt;Step 1 Installation:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Installing pip:&lt;br&gt;
&lt;a href="https://stackoverflow.com/questions/17271319/how-do-i-install-pip-on-macos-or-os-x"&gt;https://stackoverflow.com/questions/17271319/how-do-i-install-pip-on-macos-or-os-x&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Installing virtualenv:&lt;br&gt;
&lt;code&gt;pip uninstall virtualenv&lt;/code&gt;&lt;br&gt;
&lt;code&gt;sudo pip install virtualenv&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;mkdir zoom_automation
cd zoom_automation
virtualenv env
source env/bin/activate          *** for Mac
.\env\scripts\activate           *** for Windows
pip install schedule
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 2: Simple code&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;touch meeting_scheduler.py&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import schedule
import time
import webbrowser

def open_link(link):
    webbrowser.open(link)

def demo_meeting():
    open_link('MY ZOOM MEETING URL')

schedule.every().friday.at("12:25").do(demo_meeting)

while 1:
    schedule.run_pending()
    time.sleep(1)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 3: Run&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;python meeting_scheduler.py&lt;/code&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Uniswap Deep Dive 1:</title>
      <dc:creator>liamlo-dev</dc:creator>
      <pubDate>Mon, 07 Nov 2022 01:38:35 +0000</pubDate>
      <link>https://forem.com/liamlodev/uniswap-deep-dive-1-3h7b</link>
      <guid>https://forem.com/liamlodev/uniswap-deep-dive-1-3h7b</guid>
      <description>&lt;h1&gt;
  
  
  Before we start
&lt;/h1&gt;

&lt;p&gt;For introduction, please read &lt;br&gt;
&lt;a href="https://uniswap.org/blog/uniswap-v2"&gt;Uniswap V2 Overview by Uniswap&lt;/a&gt;&lt;br&gt;
&lt;a href="https://ethereum.org/en/developers/tutorials/uniswap-v2-annotated-code/#main-content"&gt;Uniswap V2 Contract Walk-through&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For source code,&lt;br&gt;
&lt;a href="https://github.com/Uniswap/v2-core"&gt;Uniswap V2 Core&lt;/a&gt; and &lt;a href="https://github.com/Uniswap/v2-periphery"&gt;Uniswap V2 Peripheral&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  Overview
&lt;/h1&gt;

&lt;p&gt;Uniswap V2 Core has 3 contracts: Factory, Pair, WETH and Uniswap V2 Periphery has 1 contract: Router.&lt;/p&gt;
&lt;h2&gt;
  
  
  Factory contract (UniswapV2Factory.sol)
&lt;/h2&gt;

&lt;p&gt;It is responsible for creating trading pairs and saving the addresses of all trading pairs.&lt;/p&gt;
&lt;h2&gt;
  
  
  Pair contract (UniswapV2Pair.sol)
&lt;/h2&gt;

&lt;p&gt;It saves the pool information of a single trading pair, including the addresses of the two ERC20 tokens in each trading pair, and their respective reserve. &lt;br&gt;
It handles mint, burn and swap operations. &lt;br&gt;
UniswapV2Pair &lt;strong&gt;itself&lt;/strong&gt; is also an unique ERC20 token. Whenever liquidity is deposited into a pool, unique tokens known as liquidity tokens are minted and sent to the provider's address. These tokens represent a given liquidity provider's contribution to a pool. The proportion of the pool's liquidity provided determines the number of liquidity tokens the provider receives. If the provider is minting a new pool, the number of liquidity tokens they will receive will equal sqrt(x * y), where x and y represent the amount of each token provided.&lt;br&gt;
totalSupply of pair token === sqrt(reserve1 * reserve2) [not sure] &lt;/p&gt;
&lt;h2&gt;
  
  
  WETH contract
&lt;/h2&gt;

&lt;p&gt;This contract is a special ERC20, for the sole purpose to facilitate users to directly trade between ETH and ERC20. Think of WETH as a fully guaranteed bond: the ETH stored in this contract is always equal to the WETH it issued (unless someone sent ETH to it directly using WETH_address.transfer ). &lt;br&gt;
WETH is created because the trading pair of the Pair contract are always ERC20 tokens and it does not support trading between ETH and ERC20.&lt;br&gt;
It has 2 methods, deposit() and withdraw(). The former is to deposit ETH to get WETH, and the latter is to destroy WETH to get ETH. But these two methods are usually called by the Router, such as the swapExactETHForTokens function in the Router&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
                external
                virtual
                override
                payable
                ensure(deadline)
                returns (uint[] memory amounts)
            {
                require(path[0] == WETH, 'UniswapV2Router: INVALID_PATH');
                amounts = UniswapV2Library.getAmountsOut(factory, msg.value, path);
                require(amounts[amounts.length - 1] &amp;gt;= amountOutMin, 'UniswapV2Router: INSUFFICIENT_OUTPUT_AMOUNT');
                IWETH(WETH).deposit{value: amounts[0]}();
                assert(IWETH(WETH).transfer(UniswapV2Library.pairFor(factory, path[0], path[1]), amounts[0]));
                _swap(amounts, path, to);
            }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>uniswap</category>
      <category>blockchain</category>
      <category>web3</category>
      <category>solidity</category>
    </item>
    <item>
      <title>Solve one problem a day</title>
      <dc:creator>liamlo-dev</dc:creator>
      <pubDate>Thu, 03 Nov 2022 15:02:22 +0000</pubDate>
      <link>https://forem.com/liamlodev/solve-one-problem-a-day-31fl</link>
      <guid>https://forem.com/liamlodev/solve-one-problem-a-day-31fl</guid>
      <description>&lt;h2&gt;
  
  
  3 November 2022
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Installing &lt;code&gt;nvm&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt; Have been using &lt;code&gt;n&lt;/code&gt;, which is much easier to install and to use. However, since it is a &lt;code&gt;npm package&lt;/code&gt; which may cause a circular dependency-like problem, I guess there is no harm to install nvm too. &lt;a href="https://www.sobyte.net/post/2022-04/node-mvn-n/"&gt;See more&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Problem:&lt;/strong&gt; Using &lt;code&gt;brew&lt;/code&gt; as always, followed the instruction popped up.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt; Thanks to &lt;a href="https://stackoverflow.com/questions/63757008/terminal-not-recognizing-nvm-after-installed-with-home-brew"&gt;this&lt;/a&gt;,&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Add &lt;code&gt;source $(brew --prefix nvm)/nvm.sh&lt;/code&gt; to &lt;code&gt;~/.zshrc&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Restart the terminal or &lt;code&gt;source ~/.zshrc&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  4 November 2022
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Reverting back to &lt;code&gt;n&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt; Can't believe I am reverting back to &lt;code&gt;n&lt;/code&gt; in only 1 day... &lt;a href="https://cranq.io/"&gt;CRANQ&lt;/a&gt; seems to be only working with &lt;code&gt;n&lt;/code&gt;, seemingly because &lt;code&gt;n&lt;/code&gt; always stores node in &lt;code&gt;/usr/local/bin&lt;/code&gt; when &lt;code&gt;nvm&lt;/code&gt; stores it in a user specific path (and with redirection), while CRANQ only recognizes &lt;code&gt;/usr/local/bin&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Lack of ETH
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt; Goerli is the only official testnet now after ETH Merge, as Rinkeby is depreciated.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Problem:&lt;/strong&gt; Due to the above reason, Goerli gas fee 10x in 2 months causing contract deployment to be very "expensive". Talked to some devs, 2 months ago the average gas is 6Gwei * 6m for 1 contract. Now it is 60Gwei.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://goerli-faucet.pk910.de/"&gt;https://goerli-faucet.pk910.de/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://faucets.chain.link/"&gt;https://faucets.chain.link/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  useDApp setup
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Problem:&lt;/strong&gt; I run into &lt;code&gt;opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ]&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Downgrade your node to 16 or &lt;/li&gt;
&lt;li&gt;use &lt;code&gt;NODE_OPTIONS=--openssl-legacy-provider npm run react-app:start&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;If the above is troublesome, put &lt;code&gt;export NODE_OPTIONS=--openssl-legacy-provider&lt;/code&gt; in &lt;code&gt;~/.zshrc&lt;/code&gt; first then &lt;code&gt;npm run react-app:start&lt;/code&gt;. If &lt;code&gt;export...&lt;/code&gt; doesn't work, do &lt;code&gt;unset NODE_OPTIONS&lt;/code&gt; first. &lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  9 November 2022
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Regex
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Replace all HTML tags:&lt;/strong&gt;&lt;code&gt;replaceAll("\\&amp;lt;[^&amp;gt;]*&amp;gt;","")&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;Split by punctuation:&lt;/strong&gt;&lt;code&gt;.split("[\\p{Punct}\\s]+")&lt;/code&gt;&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>programming</category>
      <category>tutorial</category>
      <category>100daysofcode</category>
    </item>
  </channel>
</rss>
