<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Chinh Do</title>
	<atom:link href="https://www.chinhdo.com/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.chinhdo.com/</link>
	<description>Chinh&#039;s semi-random thoughts on software development, gadgets, and other things.</description>
	<lastBuildDate>Wed, 20 Dec 2023 22:33:03 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>How to switch to a different Kubernetes context or namespace?</title>
		<link>https://www.chinhdo.com/20231023/how-to-switch-to-a-different-kubernetes-namespace/</link>
					<comments>https://www.chinhdo.com/20231023/how-to-switch-to-a-different-kubernetes-namespace/#view_comments</comments>
		
		<dc:creator><![CDATA[Chinh Do]]></dc:creator>
		<pubDate>Mon, 23 Oct 2023 20:17:08 +0000</pubDate>
				<category><![CDATA[Programming]]></category>
		<guid isPermaLink="false">https://www.chinhdo.com/?p=2913</guid>

					<description><![CDATA[<p>To list available contexts: To show the current context: To switch to a new context: To switch to a new namespace: See more at the kubectl Cheat Sheet.</p>
<p>The post <a href="https://www.chinhdo.com/20231023/how-to-switch-to-a-different-kubernetes-namespace/">How to switch to a different Kubernetes context or namespace?</a> appeared first on <a href="https://www.chinhdo.com">Chinh Do</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>To list available contexts:</p>



<pre class="wp-block-code"><code lang="bash" class="language-bash">kubectl config get-contexts</code></pre>



<p>To show the current context:</p>



<pre class="wp-block-code"><code lang="bash" class="language-bash">kubectl config current-context</code></pre>



<p>To switch to a new context:</p>



<pre class="wp-block-code"><code lang="bash" class="language-bash">kubectl config use-context my-cluster-name</code></pre>



<p>To switch to a new namespace:</p>



<pre class="wp-block-code"><code lang="bash" class="language-bash">kubectl config set-context --current --namespace=my-namespace
</code></pre>



<p>See more at the <a href="https://kubernetes.io/docs/reference/kubectl/cheatsheet/">kubectl Cheat Sheet</a>.</p>
<p>The post <a href="https://www.chinhdo.com/20231023/how-to-switch-to-a-different-kubernetes-namespace/">How to switch to a different Kubernetes context or namespace?</a> appeared first on <a href="https://www.chinhdo.com">Chinh Do</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.chinhdo.com/20231023/how-to-switch-to-a-different-kubernetes-namespace/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
			</item>
		<item>
		<title>How to ssh into Kubernetes pod</title>
		<link>https://www.chinhdo.com/20231023/how-to-ssh-into-kubernetes-pod/</link>
					<comments>https://www.chinhdo.com/20231023/how-to-ssh-into-kubernetes-pod/#comments_reply</comments>
		
		<dc:creator><![CDATA[Chinh Do]]></dc:creator>
		<pubDate>Mon, 23 Oct 2023 20:04:24 +0000</pubDate>
				<category><![CDATA[Programming]]></category>
		<guid isPermaLink="false">https://www.chinhdo.com/?p=2909</guid>

					<description><![CDATA[<p>To get a list of running pods in the current namespace: To ssh into a specific container:</p>
<p>The post <a href="https://www.chinhdo.com/20231023/how-to-ssh-into-kubernetes-pod/">How to ssh into Kubernetes pod</a> appeared first on <a href="https://www.chinhdo.com">Chinh Do</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<pre class="wp-block-code"><code class="">kubectl exec -it &lt;podname&gt; -- sh</code></pre>



<p>To get a list of running pods in the current namespace:</p>



<pre class="wp-block-code"><code class="">kubectl get pods</code></pre>



<p>To ssh into a specific container:</p>



<pre class="wp-block-code"><code class="">kubectl exec -it &lt;podName> -c &lt;containerName> -- sh
</code></pre>
<p>The post <a href="https://www.chinhdo.com/20231023/how-to-ssh-into-kubernetes-pod/">How to ssh into Kubernetes pod</a> appeared first on <a href="https://www.chinhdo.com">Chinh Do</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.chinhdo.com/20231023/how-to-ssh-into-kubernetes-pod/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to Create a Soft Symbolic Link (symlink) in Unix/Linux</title>
		<link>https://www.chinhdo.com/20220922/how-to-create-a-soft-symbolic-link-symlink-in-unix-linux/</link>
					<comments>https://www.chinhdo.com/20220922/how-to-create-a-soft-symbolic-link-symlink-in-unix-linux/#comments_reply</comments>
		
		<dc:creator><![CDATA[Chinh Do]]></dc:creator>
		<pubDate>Thu, 22 Sep 2022 18:20:27 +0000</pubDate>
				<category><![CDATA[Programming]]></category>
		<guid isPermaLink="false">https://www.chinhdo.com/?p=2706</guid>

					<description><![CDATA[<p>See also:</p>
<p>The post <a href="https://www.chinhdo.com/20220922/how-to-create-a-soft-symbolic-link-symlink-in-unix-linux/">How to Create a Soft Symbolic Link (symlink) in Unix/Linux</a> appeared first on <a href="https://www.chinhdo.com">Chinh Do</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<pre class="wp-block-code"><code lang="bash" class="language-bash"># Create a soft symbolic link from /mnt/original (file or folder) to ~/link
ln -s /mnt/original ~/link</code></pre>



<h2 class="wp-block-heading">See also:</h2>



<ul class="wp-block-list">
<li><a href="https://man7.org/linux/man-pages/man1/ln.1.html">Linux manual page for &#8220;ln&#8221;</a></li>



<li></li>
</ul>
<p>The post <a href="https://www.chinhdo.com/20220922/how-to-create-a-soft-symbolic-link-symlink-in-unix-linux/">How to Create a Soft Symbolic Link (symlink) in Unix/Linux</a> appeared first on <a href="https://www.chinhdo.com">Chinh Do</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.chinhdo.com/20220922/how-to-create-a-soft-symbolic-link-symlink-in-unix-linux/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to Configure Git Username and Email Address</title>
		<link>https://www.chinhdo.com/20220922/how-to-configure-git-username-and-email-address/</link>
					<comments>https://www.chinhdo.com/20220922/how-to-configure-git-username-and-email-address/#comments_reply</comments>
		
		<dc:creator><![CDATA[Chinh Do]]></dc:creator>
		<pubDate>Thu, 22 Sep 2022 16:30:20 +0000</pubDate>
				<category><![CDATA[Programming]]></category>
		<guid isPermaLink="false">https://www.chinhdo.com/?p=2699</guid>

					<description><![CDATA[<p>Related Commands Show current git configuration: Additional Information If you get this error in Visual Studio Code when trying to commit without first setting git username/email, then run the above commands to fix: &#8220;Make sure you configure your &#8216;user.name&#8217; and &#8216;user.email&#8217; in git.&#8221; You way be wondering why I wrote this blog post? The reason&#8230;</p>
<p>The post <a href="https://www.chinhdo.com/20220922/how-to-configure-git-username-and-email-address/">How to Configure Git Username and Email Address</a> appeared first on <a href="https://www.chinhdo.com">Chinh Do</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<pre class="wp-block-code"><code lang="bash" class="language-bash"><code>git config --global user.name "&lt;your name>"</code>
<code>git config --global user.email "&lt;youremail@somewhere.com>"</code></code></pre>



<h2 class="wp-block-heading">Related Commands</h2>



<p>Show current git configuration:</p>



<pre class="wp-block-code"><code lang="bash" class="language-bash">git config --list </code></pre>



<h2 class="wp-block-heading">Additional Information</h2>



<p>If you get this error in Visual Studio Code when trying to commit without first setting git username/email, then run the above commands to fix: &#8220;Make sure you configure your &#8216;user.name&#8217; and &#8216;user.email&#8217; in git.&#8221;</p>



<p>You way be wondering why I wrote this blog post? The reason is that most of the current Google results require you to scroll down very far to get to the main point. So with this post, I can just google for &#8220;chinhdo git username&#8221; and I find what I need immediately right at the top of the page.</p>
<p>The post <a href="https://www.chinhdo.com/20220922/how-to-configure-git-username-and-email-address/">How to Configure Git Username and Email Address</a> appeared first on <a href="https://www.chinhdo.com">Chinh Do</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.chinhdo.com/20220922/how-to-configure-git-username-and-email-address/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Getting the Last Monday for Any Month with TypeScript/JavaScript</title>
		<link>https://www.chinhdo.com/20210527/getting-the-last-monday-for-any-month-with-typescript-javascript/</link>
					<comments>https://www.chinhdo.com/20210527/getting-the-last-monday-for-any-month-with-typescript-javascript/#comments_reply</comments>
		
		<dc:creator><![CDATA[Chinh Do]]></dc:creator>
		<pubDate>Thu, 27 May 2021 20:51:51 +0000</pubDate>
				<category><![CDATA[Programming]]></category>
		<guid isPermaLink="false">https://www.chinhdo.com/?p=2563</guid>

					<description><![CDATA[<p>TypeScript/JavaScript</p>
<p>The post <a href="https://www.chinhdo.com/20210527/getting-the-last-monday-for-any-month-with-typescript-javascript/">Getting the Last Monday for Any Month with TypeScript/JavaScript</a> appeared first on <a href="https://www.chinhdo.com">Chinh Do</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">TypeScript/JavaScript</h2>



<pre class="wp-block-code"><code lang="javascript" class="language-javascript">function getLastMonday(d: Date) {
    let d1 = new Date(d.getFullYear(), d.getMonth() + 1, 0);
    let wd = d1.getDay();
    d1.setDate(d1.getDate() - (wd &lt; 1 ? 6 : wd - 1));
    return d1;
}
</code></pre>



<p></p>
<p>The post <a href="https://www.chinhdo.com/20210527/getting-the-last-monday-for-any-month-with-typescript-javascript/">Getting the Last Monday for Any Month with TypeScript/JavaScript</a> appeared first on <a href="https://www.chinhdo.com">Chinh Do</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.chinhdo.com/20210527/getting-the-last-monday-for-any-month-with-typescript-javascript/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to View Raw SMTP Email Headers in Outlook</title>
		<link>https://www.chinhdo.com/20201123/how-to-view-raw-smtp-email-headers-in-outlook/</link>
					<comments>https://www.chinhdo.com/20201123/how-to-view-raw-smtp-email-headers-in-outlook/#comments_reply</comments>
		
		<dc:creator><![CDATA[Chinh Do]]></dc:creator>
		<pubDate>Mon, 23 Nov 2020 16:36:36 +0000</pubDate>
				<category><![CDATA[Programming]]></category>
		<guid isPermaLink="false">https://www.chinhdo.com/?p=2329</guid>

					<description><![CDATA[<p>I had to do some SMTP relay troubleshooting and it wasn&#8217;t obvious how to view the raw SMTP message in Outlook. So here&#8217;s how: In the message window, choose File/Properties and look at the &#8220;Internet headers&#8221; at the bottom of the Properties dialog. I am using Office Professional Plus 2016. If you have a different&#8230;</p>
<p>The post <a href="https://www.chinhdo.com/20201123/how-to-view-raw-smtp-email-headers-in-outlook/">How to View Raw SMTP Email Headers in Outlook</a> appeared first on <a href="https://www.chinhdo.com">Chinh Do</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>I had to do some SMTP relay troubleshooting and it wasn&#8217;t obvious how to view the raw SMTP message in Outlook. So here&#8217;s how:</p>



<p>In the message window, choose File/Properties and look at the &#8220;Internet headers&#8221; at the bottom of the Properties dialog.</p>



<figure class="wp-block-image size-large is-style-default"><img fetchpriority="high" decoding="async" width="742" height="697" src="https://www.chinhdo.com/wp-content/uploads/2020/11/image-2.png" alt="Microsoft Outlook Properties dialog - Internet headers" class="wp-image-2334" srcset="https://www.chinhdo.com/wp-content/uploads/2020/11/image-2.png 742w, https://www.chinhdo.com/wp-content/uploads/2020/11/image-2-300x282.png 300w" sizes="(max-width: 742px) 100vw, 742px" /></figure>



<p>I am using Office Professional Plus 2016. If you have a different version of Outlook such as Outlook 2010 or Outlook 2013, the steps may be different for your version.</p>
<p>The post <a href="https://www.chinhdo.com/20201123/how-to-view-raw-smtp-email-headers-in-outlook/">How to View Raw SMTP Email Headers in Outlook</a> appeared first on <a href="https://www.chinhdo.com">Chinh Do</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.chinhdo.com/20201123/how-to-view-raw-smtp-email-headers-in-outlook/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Tips &#038; Tricks for Changing the Design/Content of a WordPress Site</title>
		<link>https://www.chinhdo.com/20201122/tips-tricks-changing-design-wordpress-site/</link>
					<comments>https://www.chinhdo.com/20201122/tips-tricks-changing-design-wordpress-site/#comments_reply</comments>
		
		<dc:creator><![CDATA[Chinh Do]]></dc:creator>
		<pubDate>Sun, 22 Nov 2020 20:30:26 +0000</pubDate>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">https://www.chinhdo.com/?p=2263</guid>

					<description><![CDATA[<p>I spent a good part of the weekend on a re-design of a client&#8217;s dental practice site. Like probably 95% of dentist/doctor practices&#8217; sites out there, this site runs on WordPress. Here&#8217;s the updated design: Here&#8217;s the mobile version: I didn&#8217;t have time to find/get better photos for the mobile dentistry service at the bottom&#8230;</p>
<p>The post <a href="https://www.chinhdo.com/20201122/tips-tricks-changing-design-wordpress-site/">Tips &#038; Tricks for Changing the Design/Content of a WordPress Site</a> appeared first on <a href="https://www.chinhdo.com">Chinh Do</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>I spent a good part of the weekend on a re-design of a client&#8217;s <a href="https://www.divadentistry.com/">dental practice site</a>. Like probably 95% of dentist/doctor practices&#8217; sites out there, this site runs on WordPress. Here&#8217;s the updated design:</p>



<figure class="wp-block-image size-full"><img decoding="async" width="1791" height="5340" src="https://www.chinhdo.com/wp-content/uploads/2020/11/screencapture-www-divadentistry-com-1606074527151.png" alt="Dental Innovations of Virginia - Advanced General Dentistry and Mobile Dentistry Clinic" class="wp-image-2266" srcset="https://www.chinhdo.com/wp-content/uploads/2020/11/screencapture-www-divadentistry-com-1606074527151.png 1791w, https://www.chinhdo.com/wp-content/uploads/2020/11/screencapture-www-divadentistry-com-1606074527151-101x300.png 101w, https://www.chinhdo.com/wp-content/uploads/2020/11/screencapture-www-divadentistry-com-1606074527151-343x1024.png 343w, https://www.chinhdo.com/wp-content/uploads/2020/11/screencapture-www-divadentistry-com-1606074527151-768x2290.png 768w, https://www.chinhdo.com/wp-content/uploads/2020/11/screencapture-www-divadentistry-com-1606074527151-515x1536.png 515w, https://www.chinhdo.com/wp-content/uploads/2020/11/screencapture-www-divadentistry-com-1606074527151-687x2048.png 687w" sizes="(max-width: 1791px) 100vw, 1791px" /></figure>



<p>Here&#8217;s the mobile version:</p>



<figure class="wp-block-image size-large is-resized is-style-default"><img decoding="async" src="https://www.chinhdo.com/wp-content/uploads/2020/11/image-1-502x1024.png" alt="" class="wp-image-2269" width="377" height="768" srcset="https://www.chinhdo.com/wp-content/uploads/2020/11/image-1-502x1024.png 502w, https://www.chinhdo.com/wp-content/uploads/2020/11/image-1-147x300.png 147w, https://www.chinhdo.com/wp-content/uploads/2020/11/image-1-768x1567.png 768w, https://www.chinhdo.com/wp-content/uploads/2020/11/image-1-753x1536.png 753w, https://www.chinhdo.com/wp-content/uploads/2020/11/image-1.png 848w" sizes="(max-width: 377px) 100vw, 377px" /></figure>



<p>I didn&#8217;t have time to find/get better photos for the mobile dentistry service at the bottom of the page, so those photos will have to do for now.</p>



<p>So, here are some tips for how to quickly make changes to an existing WordPress site:</p>



<h2 class="wp-block-heading">Learn the Theme</h2>



<p>Familiarize yourself with the WordPress theme in use. Every theme works a little differently. The theme for this site exposes a lot of the options via its  Theme Options menu, but not all theme customizations can be done there. Some of the options must be done in WordPress&#8217;s built-in Appearance/Customize menu.</p>



<p>Most commercial themes also come with fairly extensive documentation. Give the docs a read-over at least once.</p>



<h2 class="wp-block-heading">Learn the Plug-ins</h2>



<p>Many sites / themes make heavy use of plug-ins. For example, this dentist office&#8217;s site uses Slider Evolution to show a slider on the home page. Slider Evolution itself is fairly deep application with lots of options.</p>



<h2 class="wp-block-heading">Use the String Locator Plug-in</h2>



<p>The <a href="https://wordpress.org/plugins/string-locator/">String Location plug-in</a> is great for when you see some element on a page that you need to change, but have no idea how it gets there. This plug-in lets you easily search through your themes, plugins, or even WordPress core to find files containing the text.</p>



<h2 class="wp-block-heading">Track Your WordPress Site in Git</h2>



<p>Adding the site&#8217;s files to a git repo allow you to track changes you make to the theme&#8217;s files (style.css, header.php, etc.) and easily revert or identify exactly what you changed.</p>



<p>You should configure your .gitignore to ignore at least the following folders/files:</p>



<ul class="wp-block-list"><li>uploads</li><li>/wp-content/plugins/</li><li>/wp-content/mu-plugins/</li><li>cache/</li><li>backups/</li></ul>



<h2 class="wp-block-heading">Make Frequent Site &amp; MySql Backups</h2>



<p>Set up automated backups of the site&#8217;s files and database, so that in the case a disaster happens, you have something to go back to.</p>



<p>Here&#8217;s the script I use to back up my files and database:</p>



<pre class="wp-block-code"><code lang="bash" class="language-bash"># database

/usr/local/bin/mysqldump -h&lt;host> -u&lt;user> -p&lt;password> &lt;dbname> > ~/backup/divadentistry_main.sql

# Files
/bin/tar zcvf ~/backup/divadentistry.gz ~/public_html/divadentistry.com</code></pre>



<h2 class="wp-block-heading">Override CSS with Appearance/Customize/Additional CSS</h2>



<p>With WordPress themes, the &#8220;Additional CSS&#8221; feature can be used to customize CSS to your liking. I find that the best way to use this is in conjunction with Chrome Dev Tools. I would try to get a relevant class for the element I need to tweak, and customize its CSS. A lot of times you need to add &#8220;!important&#8221; for your override to take effect. A really cool thing about the Additional CSS feature is that any CSS change takes effect right away in the preview pane.</p>
<p>The post <a href="https://www.chinhdo.com/20201122/tips-tricks-changing-design-wordpress-site/">Tips &#038; Tricks for Changing the Design/Content of a WordPress Site</a> appeared first on <a href="https://www.chinhdo.com">Chinh Do</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.chinhdo.com/20201122/tips-tricks-changing-design-wordpress-site/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Sending WAN/Internet Bandwidth Usage Data to Splunk from Tomato Routers using Splunk HEC</title>
		<link>https://www.chinhdo.com/20200621/sending-wan-internet-bandwidth-usage-data-to-splunk-from-tomato-routers-using-splunk-hec/</link>
					<comments>https://www.chinhdo.com/20200621/sending-wan-internet-bandwidth-usage-data-to-splunk-from-tomato-routers-using-splunk-hec/#comments_reply</comments>
		
		<dc:creator><![CDATA[Chinh Do]]></dc:creator>
		<pubDate>Mon, 22 Jun 2020 00:32:39 +0000</pubDate>
				<category><![CDATA[Gadgets]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Smart Home]]></category>
		<category><![CDATA[Splunk]]></category>
		<category><![CDATA[Technology]]></category>
		<guid isPermaLink="false">https://www.chinhdo.com/?p=1104</guid>

					<description><![CDATA[<p>A while back I wrote about sending data from SmartThings and other home devices data to Splunk so I can monitor what goes on in my home via Splunk Dashboards. In addition to SmartThings devices, I also pulled data from other data sources such as network routers, Windows event logs, weather data retrieval scripts, etc.&#8230;</p>
<p>The post <a href="https://www.chinhdo.com/20200621/sending-wan-internet-bandwidth-usage-data-to-splunk-from-tomato-routers-using-splunk-hec/">Sending WAN/Internet Bandwidth Usage Data to Splunk from Tomato Routers using Splunk HEC</a> appeared first on <a href="https://www.chinhdo.com">Chinh Do</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>A while back I wrote about sending data from <a href="https://www.chinhdo.com/20200330/monitor-visualize-your-smart-home-with-splunk/">SmartThings and other home devices data to Splunk</a> so I can monitor what goes on in my home via Splunk Dashboards. In addition to SmartThings devices, I also pulled data from other data sources such as network routers, Windows event logs, weather data retrieval scripts, etc.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="873" height="354" src="https://www.chinhdo.com/wp-content/uploads/2020/06/image-4.png" alt="" class="wp-image-1112" srcset="https://www.chinhdo.com/wp-content/uploads/2020/06/image-4.png 873w, https://www.chinhdo.com/wp-content/uploads/2020/06/image-4-300x122.png 300w, https://www.chinhdo.com/wp-content/uploads/2020/06/image-4-768x311.png 768w" sizes="auto, (max-width: 873px) 100vw, 873px" /></figure>



<p>To monitor our Internet bandwidth usage I wrote a Node.js program to scrape the data from the admin web UI for my Verizon Actiontec MI424WR router. <a href="https://github.com/chinhdo/shell-scripts/tree/master/node.js/verizon-actiontec-bandwidth-scraper">Here</a>&#8216;s the code for that.</p>



<p>Last week I upgraded my internet to Verizon Fios Gigabit and with that upgrade, the Actiontec router was replaced with another router: a Netgear R7000 running Advanced Tomato (open source Linux-based firmware for Broadcom based Wi-fi routers). Advanced Tomato has a pretty click interface to monitor bandwidth, but I still want the data in my Splunk instance.</p>



<p>Luckily, <a href="https://advancedtomato.com/">Advanced Tomato</a> runs a variant of Linux, so all I needed was a shell script to calculate bandwidth usage data and send to Splunk via the Splunk Http Event Collector.</p>



<p>I found a <a href="https://www.linksysinfo.org/index.php?threads/how-to-monitor-the-ip-traffic-and-bandwidth-with-cli.71998/">script by WaLLy3K</a> that already had the bandwidth calculation logic and all I had to add was a little more code to send the data to Splunk.</p>



<h2 class="wp-block-heading">Step-by-step Instructions</h2>



<h3 class="wp-block-heading">Enable JFFS Partition on Your Router</h3>



<p>Enable JFFS Partition on your router so that you have permanent storage for your script. Otherwise if you saved your script in /tmp, it&#8217;ll be gone after the next reboot. Log into your router&#8217;s admin UI, choose Administration/JFFS, select Enabled and Save.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="563" src="https://www.chinhdo.com/wp-content/uploads/2020/06/image-5-1024x563.png" alt="" class="wp-image-1117" srcset="https://www.chinhdo.com/wp-content/uploads/2020/06/image-5-1024x563.png 1024w, https://www.chinhdo.com/wp-content/uploads/2020/06/image-5-300x165.png 300w, https://www.chinhdo.com/wp-content/uploads/2020/06/image-5-768x422.png 768w, https://www.chinhdo.com/wp-content/uploads/2020/06/image-5.png 1332w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<h3 class="wp-block-heading">Create Your Script</h3>



<p>SSH into your router and create a shell script at /jffs/bandwidth.sh with the content from <a href="https://github.com/chinhdo/shell-scripts/blob/master/sh/bandwidth.sh">here</a>. Update the splunkUrl variable with your Splunk HEC URL. If you are not able to SSH, make sure you have SSH Daemon enabled under Administration/Admin Access.</p>



<p>For more info on installing Splunk HTTP Event Collection, see my <a href="https://www.chinhdo.com/20200330/monitor-visualize-your-smart-home-with-splunk/">previous post</a>.</p>



<pre class="wp-block-code"><code lang="bash" class="language-bash"># this is just an excerpt of the code. For full code see 
# https://github.com/chinhdo/shell-scripts/blob/master/sh/bandwidth.sh

...
wan_iface=`nvram get wan_iface`
calc(){ awk "BEGIN { print $*}"; }    # Calculate floating point arithmetic using AWK instead of BC

checkWAN () {
    [ -z $1 ] &amp;&amp; sec="1" || sec="$1"

    netdev=`grep "$wan_iface" /proc/net/dev`
    pRX=$(echo $netdev | cut -d' ' -f2)
    pTX=$(echo $netdev | cut -d' ' -f10)
    sleep $sec
    netdev=`grep "$wan_iface" /proc/net/dev`
    cRX=$(echo $netdev | cut -d' ' -f2)
    cTX=$(echo $netdev | cut -d' ' -f10)

    [ $cRX \&lt; $pRX ] &amp;&amp; getRX=`calc "$cRX + (0xFFFFFFFF - $pRX)"` || getRX=`calc "($cRX - $pRX)"`
    [ $cTX \&lt; $pTX ] &amp;&amp; getTX=`calc "$cTX + (0xFFFFFFFF - $pTX)"` || getTX=`calc "($cTX - $pTX)"`
    dlBytes=$(($getRX/$sec)); ulBytes=$(($getTX/$sec))
    [ $dlBytes -le "12000" -a $ulBytes -le "4000" ] &amp;&amp; wanStatus="idle" || wanStatus="busy"

    getDLKbit=$(printf "%.0f\n" `calc $dlBytes*0.008`);        getULKbit=$(printf "%.0f\n" `calc $ulBytes*0.008`)
    getDLMbit=$(printf "%.2f\n" `calc $dlBytes*0.000008`);    getULMbit=$(printf "%.2f\n" `calc $ulBytes*0.000008`)
}</code></pre>



<p>Create another shell script /jffs/bandwidth-env.sh with the following content:</p>



<pre class="wp-block-code"><code class="">export SPLUNK_AUTH="YOUR_SPLUNK_AUTH_KEY"
/jffs/bandwidth.sh</code></pre>



<p>To test your script run it manually and confirm the data is showing in Splunk:</p>



<pre class="wp-block-code"><code class="">/jffs/bandwidth-env.sh</code></pre>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="773" src="https://www.chinhdo.com/wp-content/uploads/2020/06/image-1-1024x773.png" alt="Splunk raw data" class="wp-image-1108" srcset="https://www.chinhdo.com/wp-content/uploads/2020/06/image-1-1024x773.png 1024w, https://www.chinhdo.com/wp-content/uploads/2020/06/image-1-300x227.png 300w, https://www.chinhdo.com/wp-content/uploads/2020/06/image-1-768x580.png 768w, https://www.chinhdo.com/wp-content/uploads/2020/06/image-1-1536x1160.png 1536w, https://www.chinhdo.com/wp-content/uploads/2020/06/image-1.png 1659w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<h3 class="wp-block-heading">Schedule Your Script</h3>



<p>To schedule your script, you can use the Scheduler (Administration/Schedule) in the router&#8217;s web admin UI. I have an automatic reboot scheduled at 4 AM, so I scheduled a custom script at 4:15 AM to run the bandwidth-env.sh script:</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="987" src="https://www.chinhdo.com/wp-content/uploads/2020/06/image-7-1024x987.png" alt="" class="wp-image-1119" srcset="https://www.chinhdo.com/wp-content/uploads/2020/06/image-7-1024x987.png 1024w, https://www.chinhdo.com/wp-content/uploads/2020/06/image-7-300x289.png 300w, https://www.chinhdo.com/wp-content/uploads/2020/06/image-7-768x740.png 768w, https://www.chinhdo.com/wp-content/uploads/2020/06/image-7-1536x1480.png 1536w, https://www.chinhdo.com/wp-content/uploads/2020/06/image-7.png 1539w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>To start the script right away, spawn a process for it:</p>



<pre class="wp-block-code"><code class="">/jffs/bandwidth-env.sh &amp;</code></pre>



<h2 class="wp-block-heading">Additional Info</h2>



<p>Here&#8217;s a little bit of info on how the script works. The raw bandwidth data is read from /proc/net/dev.</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p>Per <a href="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/deployment_guide/s2-proc-dir-net">redhad.com</a>, /proc/net/dev <code>"</code>Lists the various network devices configured on the system, complete with transmit and receive statistics. This file displays the number of bytes each interface has sent and received, the number of packets inbound and outbound, the number of errors seen, the number of packets dropped, and more.&#8221;</p></blockquote>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="966" height="139" src="https://www.chinhdo.com/wp-content/uploads/2020/06/image-2.png" alt="Total bytes received and sent" class="wp-image-1110" srcset="https://www.chinhdo.com/wp-content/uploads/2020/06/image-2.png 966w, https://www.chinhdo.com/wp-content/uploads/2020/06/image-2-300x43.png 300w, https://www.chinhdo.com/wp-content/uploads/2020/06/image-2-768x111.png 768w" sizes="auto, (max-width: 966px) 100vw, 966px" /></figure>



<p>For our purpose, we are interested in the first column which contains the cumulative number of bytes received by the interface, and the 10th column, which contains the number of bytes sent.</p>



<p>The script retrieves the current data, then sleeps for a number of seconds, and reads the updated data. The download/upload Mbit/s data is calculated by taking the difference and divide by the time elapsed. There&#8217;s also some logic to handle when the counters wrap around the max value back to zero.</p>



<p>Here&#8217;s how the data shows up in my Splunk Home dashboard:</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="895" src="https://www.chinhdo.com/wp-content/uploads/2020/06/image-1024x895.png" alt="Splunk Dashboard showing  WAN/Internet download/upload speed in Mbps" class="wp-image-1107" srcset="https://www.chinhdo.com/wp-content/uploads/2020/06/image-1024x895.png 1024w, https://www.chinhdo.com/wp-content/uploads/2020/06/image-300x262.png 300w, https://www.chinhdo.com/wp-content/uploads/2020/06/image-768x671.png 768w, https://www.chinhdo.com/wp-content/uploads/2020/06/image.png 1494w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
<p>The post <a href="https://www.chinhdo.com/20200621/sending-wan-internet-bandwidth-usage-data-to-splunk-from-tomato-routers-using-splunk-hec/">Sending WAN/Internet Bandwidth Usage Data to Splunk from Tomato Routers using Splunk HEC</a> appeared first on <a href="https://www.chinhdo.com">Chinh Do</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.chinhdo.com/20200621/sending-wan-internet-bandwidth-usage-data-to-splunk-from-tomato-routers-using-splunk-hec/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Deploying Your Web Site to Azure Static Web Apps</title>
		<link>https://www.chinhdo.com/20200523/deploying-your-web-site-to-azure-static-web-apps/</link>
					<comments>https://www.chinhdo.com/20200523/deploying-your-web-site-to-azure-static-web-apps/#view_comments</comments>
		
		<dc:creator><![CDATA[Chinh Do]]></dc:creator>
		<pubDate>Sat, 23 May 2020 04:22:31 +0000</pubDate>
				<category><![CDATA[Cloud]]></category>
		<category><![CDATA[Git]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[azure]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[react]]></category>
		<category><![CDATA[web]]></category>
		<guid isPermaLink="false">https://www.chinhdo.com/?p=1025</guid>

					<description><![CDATA[<p>💭 Imagine: merging a Pull Request is all it takes to automatically deploy your static or single-page app to a secure, dynamically scaled, and globally distributed network with integrated API support &#8211; that&#8217;s the promise of Azure Static Web Apps. Announced during Microsoft Build 2020, Azure Static Web App is a service that automatically builds&#8230;</p>
<p>The post <a href="https://www.chinhdo.com/20200523/deploying-your-web-site-to-azure-static-web-apps/">Deploying Your Web Site to Azure Static Web Apps</a> appeared first on <a href="https://www.chinhdo.com">Chinh Do</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="702" src="https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step16-1024x702.png" alt="" class="wp-image-1065" srcset="https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step16-1024x702.png 1024w, https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step16-300x206.png 300w, https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step16-768x526.png 768w, https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step16-1536x1053.png 1536w, https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step16.png 1862w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f4ad.png" alt="💭" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Imagine: merging a Pull Request is all it takes to automatically deploy your static or single-page app to a secure, dynamically scaled, and globally distributed network with integrated API support &#8211; that&#8217;s the promise of Azure Static Web Apps.</p>



<p>Announced during Microsoft Build 2020, Azure Static Web App is a service that automatically builds and deploys static web apps to Azure from a GitHub repository. The features that I find the most interesting are:</p>



<ul class="wp-block-list"><li>First-party Github integration</li><li>Globally distributed </li><li>Free, auto-renewed SSL certificates</li><li>Integrated API support by Azure Functions</li><li>For now &#8211; Free hosting for your static site (Angular, React, etc)</li></ul>



<p>I gave it a try and I have to say: it&#8217;s pretty cool! <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f44d.png" alt="👍" class="wp-smiley" style="height: 1em; max-height: 1em;" /> I&#8217;ll have the step-by-step on how to configure and deploy an existing site to Azure Static Web Apps below. The steps seem lengthy but there are really just a few basic steps:</p>



<ul class="wp-block-list"><li>Create a new &#8220;Static Web App&#8221; resource and configure basic parameters.</li><li>Point to the GitHub repository of your app. </li><li>After a few screens, your app is automatically deployed and available on its own secure URL on Azure Static Web Apps.</li></ul>



<p>If you want to create a brand new site from scratch, see the official documentation <a href="https://docs.microsoft.com/en-us/azure/static-web-apps/getting-started?tabs=react">docs.microsoft.com</a>.</p>



<h2 class="wp-block-heading">Deploying an Existing Static Site to Azure Static Web Apps</h2>



<p>As part of the <a href="https://www.100daysofcode.com/">#100DaysOfCode</a> challenge, I&#8217;ve been working on a React site that hosts various programming utilities like encoders/decoders, UUID generator, test data generators, etc. It&#8217;s a perfect candidate to test out Azure Static Web Apps.</p>



<h3 class="wp-block-heading">Create Your Static Web App</h3>



<p>First, log into Azure Portal and click &#8220;<strong>Create a resource</strong>&#8220;, then search for &#8220;<strong>Azure static web</strong>&#8220;. You should see Static Web App (Preview) in the search results. <strong>Click </strong>on it.</p>



<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="1337" height="777" src="https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step1.png" alt="Azure Static Web App - Search" class="wp-image-1026" srcset="https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step1.png 1337w, https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step1-300x174.png 300w, https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step1-1024x595.png 1024w, https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step1-768x446.png 768w" sizes="auto, (max-width: 1337px) 100vw, 1337px" /></figure>



<p>Click <strong>Create</strong>.</p>



<figure class="wp-block-image size-medium"><img loading="lazy" decoding="async" width="300" height="191" src="https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step2-300x191.png" alt="" class="wp-image-1027" srcset="https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step2-300x191.png 300w, https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step2-768x490.png 768w, https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step2.png 785w" sizes="auto, (max-width: 300px) 100vw, 300px" /></figure>



<p>Fill out the Basics tab. Most of the fields are self-explanatory. Click &#8220;<strong>Sign in with GitHub</strong>&#8220;.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="846" src="https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step14-1024x846.png" alt="" class="wp-image-1043" srcset="https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step14-1024x846.png 1024w, https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step14-300x248.png 300w, https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step14-768x635.png 768w, https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step14.png 1026w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>The page expands, showing a few more fields for GitHub. Fill out with the info for your app&#8217;s GitHub repository, and choose &#8220;<strong>Next: Build&gt;</strong>&#8220;.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="992" height="443" src="https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step12.png" alt="" class="wp-image-1040" srcset="https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step12.png 992w, https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step12-300x134.png 300w, https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step12-768x343.png 768w" sizes="auto, (max-width: 992px) 100vw, 992px" /></figure>



<p>On the Build tab, fill in the appropriate values for &#8220;<strong>App location</strong>&#8220;, &#8220;<strong>Api location</strong>&#8220;, and &#8220;<strong>App artifact location</strong>&#8220;. Then click &#8220;<strong>Review + create</strong>&#8220;.</p>



<p>&#8220;<strong>App location</strong>&#8221; is the root folder for your app. It&#8217;s typically <strong>/</strong> or <strong>/app</strong>. &#8220;<strong>Api location</strong>&#8221; should be left blank if you are unsure. &#8220;<strong>App artifact location</strong>&#8221; is the folder to your build.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="573" src="https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step13-1024x573.png" alt="" class="wp-image-1041" srcset="https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step13-1024x573.png 1024w, https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step13-300x168.png 300w, https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step13-768x430.png 768w, https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step13.png 1327w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>Review your settings and click <strong>Create</strong>. Wait a few seconds for the deployment to complete. During the initial deployment, Static Web Apps automatically creates a GitHub Action for you (in the file named <strong>azure-static-web-apps-&lt;id&gt;.yml</strong> and adds it to your chosen branch. When it&#8217;s all done you should see this page:</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="396" src="https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step6-1024x396.png" alt="" class="wp-image-1032" srcset="https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step6-1024x396.png 1024w, https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step6-300x116.png 300w, https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step6-768x297.png 768w, https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step6.png 1323w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>Click &#8220;<strong>Go to resource</strong>&#8221; to go to the resource page for your new Static Web App. On the Overview page, you will see a link to your web app.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="557" src="https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step7-1024x557.png" alt="" class="wp-image-1033" srcset="https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step7-1024x557.png 1024w, https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step7-300x163.png 300w, https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step7-768x418.png 768w, https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step7.png 1327w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>Click on &#8220;<strong>GitHub Action runs</strong>&#8221; to go over to your GitHub repo and view the status of your deploy Action. You should see a new Action named &#8220;ci: add Azure Static Web Apps workflow file&#8221;. It should take about two minutes to run.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="514" src="https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step8-1024x514.png" alt="" class="wp-image-1036" srcset="https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step8-1024x514.png 1024w, https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step8-300x151.png 300w, https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step8-768x385.png 768w, https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step8.png 1329w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p><strong>Switch </strong>to the Code tab and see that a new Action file was added to your repo. This is what tells GitHub to automatically build and deploy your app to Azure Static Web Apps.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="956" height="1024" src="https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step9-956x1024.png" alt="" class="wp-image-1037" srcset="https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step9-956x1024.png 956w, https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step9-280x300.png 280w, https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step9-768x822.png 768w, https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step9.png 1326w" sizes="auto, (max-width: 956px) 100vw, 956px" /></figure>



<h3 class="wp-block-heading">Bring Up Your Static Web App</h3>



<p>It&#8217;s time to bring up our web site on Azure Static Web Apps! </p>



<p>Go back to Azure Portal and <strong>click </strong>on the URL to your app to bring it up. The below screenshot shows my app now running on Azure Static Web Apps with its own unique secure URL.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="952" height="1024" src="https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step10-952x1024.png" alt="" class="wp-image-1038" srcset="https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step10-952x1024.png 952w, https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step10-279x300.png 279w, https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step10-768x826.png 768w, https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApp-Step10.png 1323w" sizes="auto, (max-width: 952px) 100vw, 952px" /></figure>



<h2 class="wp-block-heading">Custom Domain Name</h2>



<p>Adding a custom domain name is pretty straightforward. On Azure Portal, go to the home page of your Static Web App, and click on &#8220;<strong>Custom domains</strong>&#8220;, then <strong>Add</strong>.</p>



<p>On the &#8220;<strong>Add custom domain</strong>&#8221; page, note the Azure host name for your site. You will need to create a DNS CNAME record to point your custom domain to that Azure host name. The specifics of this part depends on your domain registrar or web hosting provider. For me, the domain name chinhdo.com is hosted on Pair Networks so I went to their control panel and created there CNAME record there.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="702" height="75" src="https://www.chinhdo.com/wp-content/uploads/2020/05/image-4.png" alt="" class="wp-image-1048" srcset="https://www.chinhdo.com/wp-content/uploads/2020/05/image-4.png 702w, https://www.chinhdo.com/wp-content/uploads/2020/05/image-4-300x32.png 300w" sizes="auto, (max-width: 702px) 100vw, 702px" /></figure>



<p>After you have created your DNS CNAME record, go back to Azure Portal and paste your custom domain into the &#8220;<strong>Custom domain</strong>&#8221; box, then click <strong>Validate</strong>.</p>



<p>Depending on your DNS settings it can take up to 48 hours for a new DNS record to propagate. In practice it should not take more than an hour. In my case it took about 15 minutes. If you get an error in the next step, just wait some time and try again.</p>



<p>After you get the &#8220;<strong>Validation succeeded</strong>&#8221; message, click <strong>Add</strong> to add your custom domain to your Static Web App. This step took about one minute for me </p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="793" src="https://www.chinhdo.com/wp-content/uploads/2020/05/image-8-1024x793.png" alt="" class="wp-image-1052" srcset="https://www.chinhdo.com/wp-content/uploads/2020/05/image-8-1024x793.png 1024w, https://www.chinhdo.com/wp-content/uploads/2020/05/image-8-300x232.png 300w, https://www.chinhdo.com/wp-content/uploads/2020/05/image-8-768x594.png 768w, https://www.chinhdo.com/wp-content/uploads/2020/05/image-8.png 1155w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>And now I am able to get to the web site via the custom domain name <a href="https://programmers-toolbox.chinhdo.com/">https://programmers-toolbox.chinhdo.com</a>:</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="950" src="https://www.chinhdo.com/wp-content/uploads/2020/05/image-9-1024x950.png" alt="" class="wp-image-1053" srcset="https://www.chinhdo.com/wp-content/uploads/2020/05/image-9-1024x950.png 1024w, https://www.chinhdo.com/wp-content/uploads/2020/05/image-9-300x278.png 300w, https://www.chinhdo.com/wp-content/uploads/2020/05/image-9-768x713.png 768w, https://www.chinhdo.com/wp-content/uploads/2020/05/image-9.png 1329w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<h2 class="wp-block-heading">Adding Server Routes</h2>



<p>To handle server routes, you need a routes.json file to your build folder. In my React  app, I added it to the /public folder.</p>



<p>Server routing is required to handling &#8220;hard&#8221; navigation to routes that are handled by your single page app. In my case, I have a React route for /uuid which works fine when you navigate there within the app. But you will get a 404 if you go there directly, or do a browser refresh while you are on that page. Server routes take care of that. See the <a href="https://docs.microsoft.com/en-us/azure/static-web-apps/routes">official docs</a> for more info.</p>



<pre class="wp-block-code"><code lang="javascript" class="language-javascript">{
  "routes": [
    {
      "route": "/uuid",
      "serve": "/index.html",
      "status": 200
    },
    {
      "route": "/encode",
      "serve": "/index.html",
      "status": 200
    },
    {
      "route": "/login",
      "serve": "/index.html",
      "status": 200
    }
  ]
}</code></pre>



<p></p>



<h2 class="wp-block-heading">Troubleshooting Tips</h2>



<p>I did run into one problem with a test site. The initial deployment for it did not happen automatically. I verified that the *.yml file was created but the Action never got executed. I was able to get around that by pushing a &#8220;dummy&#8221; change to the repository.</p>



<h2 class="wp-block-heading">Game Changer?</h2>



<p>Azure Static Web Apps looks to be a game changer. You are getting important features like SSL, dynamic scaling, global distribution, and GitHub deployment all in one easy-to-use package. Once configured, deploying your changes is as simple as pushing code to your GitHub repository. In fact I have deployed several new versions of the app over the past few days and it worked perfectly fine each time.</p>



<p>If cost is reasonable, I would definitely use it on a permanent basis for my single-page/static sites. Currently Azure Static Web Apps is in preview and is free, but things may change after it goes out of preview.</p>



<p>What do you think about Azure Static Web Apps? I would love to hear your thoughts. Let me know here in the Comments section or on <a href="https://twitter.com/chinhdo">Twitter</a>!</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="728" height="410" src="https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApps2.jpg" alt="Azure Static Web Apps" class="wp-image-1014" srcset="https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApps2.jpg 728w, https://www.chinhdo.com/wp-content/uploads/2020/05/AzureStaticWebApps2-300x169.jpg 300w" sizes="auto, (max-width: 728px) 100vw, 728px" /></figure>
<p>The post <a href="https://www.chinhdo.com/20200523/deploying-your-web-site-to-azure-static-web-apps/">Deploying Your Web Site to Azure Static Web Apps</a> appeared first on <a href="https://www.chinhdo.com">Chinh Do</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.chinhdo.com/20200523/deploying-your-web-site-to-azure-static-web-apps/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
		<item>
		<title>Best Demo 4K UHD Videos on YouTube</title>
		<link>https://www.chinhdo.com/20200430/best-demo-4k-uhd-videos-on-youtube/</link>
					<comments>https://www.chinhdo.com/20200430/best-demo-4k-uhd-videos-on-youtube/#comments_reply</comments>
		
		<dc:creator><![CDATA[Chinh Do]]></dc:creator>
		<pubDate>Fri, 01 May 2020 01:57:14 +0000</pubDate>
				<category><![CDATA[Gadgets]]></category>
		<category><![CDATA[HDTV]]></category>
		<category><![CDATA[Technology]]></category>
		<guid isPermaLink="false">https://www.chinhdo.com/?p=966</guid>

					<description><![CDATA[<p>Just got a 4K Ultra HD TV/monitor and looking for things to watch/test your new monitor/TV? Try these YouTube videos. From the HDR channel: LG&#8217;s demo video The Ultimate High-resolution 4K movie in Super 35mm vol.01 &#124; Alpha 7R II &#124; Sony &#124; α Real 4K HDR: Cosmos Laundromat in HDR Landscapes: Volume 4K (UHD)&#8230;</p>
<p>The post <a href="https://www.chinhdo.com/20200430/best-demo-4k-uhd-videos-on-youtube/">Best Demo 4K UHD Videos on YouTube</a> appeared first on <a href="https://www.chinhdo.com">Chinh Do</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>Just got a 4K Ultra HD TV/monitor and looking for things to watch/test your new monitor/TV? Try these YouTube videos.</p>



<h2 class="wp-block-heading">From the HDR channel: LG&#8217;s demo video</h2>



<iframe loading="lazy" width="560" height="315" src="https://www.youtube.com/embed/mkggXE5e2yk" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe>



<h2 class="wp-block-heading">The Ultimate High-resolution 4K movie in Super 35mm vol.01 | Alpha 7R II | Sony | α</h2>



<iframe loading="lazy" width="560" height="315" src="https://www.youtube.com/embed/1Jor_WkheaE" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe>



<h2 class="wp-block-heading">Real 4K HDR: Cosmos Laundromat in HDR</h2>



<iframe loading="lazy" width="560" height="315" src="https://www.youtube.com/embed/fLHPIYNtig4" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe>



<h2 class="wp-block-heading">Landscapes: Volume 4K (UHD)</h2>



<iframe loading="lazy" width="560" height="315" src="https://www.youtube.com/embed/9ZfN87gSjvI" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe>



<h2 class="wp-block-heading">TIMELAPSE OF THE FUTURE: A Journey to the End of Time (4K)</h2>



<iframe loading="lazy" width="560" height="315" src="https://www.youtube.com/embed/uD4izuDMUQA" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe>



<h2 class="wp-block-heading">10 Incredible 4K (Ultra HD) Videos</h2>



<iframe loading="lazy" width="560" height="315" src="https://www.youtube.com/embed/6pxRHBw-k8M" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe>



<h2 class="wp-block-heading">Samsung 4K UHD demo video: Cityscape (with great song)</h2>



<iframe loading="lazy" width="560" height="315" src="https://www.youtube.com/embed/6jiNS_4CEug" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe>



<h2 class="wp-block-heading">Demo 4K &#8211; Ultra HD</h2>



<iframe loading="lazy" width="560" height="315" src="https://www.youtube.com/embed/E_YU0HWFzo4" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe>



<h1 class="wp-block-heading">Japan in 8K 60fps</h1>



<iframe loading="lazy" width="560" height="315" src="https://www.youtube.com/embed/zCLOJ9j1k2Y" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe>



<h2 class="wp-block-heading">Transient &#8211; 4K, UHD, 1000FPS</h2>



<iframe loading="lazy" width="560" height="315" src="https://www.youtube.com/embed/nBYZpsbu9ds" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<p>The post <a href="https://www.chinhdo.com/20200430/best-demo-4k-uhd-videos-on-youtube/">Best Demo 4K UHD Videos on YouTube</a> appeared first on <a href="https://www.chinhdo.com">Chinh Do</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.chinhdo.com/20200430/best-demo-4k-uhd-videos-on-youtube/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/?utm_source=w3tc&utm_medium=footer_comment&utm_campaign=free_plugin

Page Caching using Disk: Enhanced 

Served from: www.chinhdo.com @ 2026-04-12 04:19:19 by W3 Total Cache
-->