<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>EricEastwood.com</title><description>Blog posts by Eric Eastwood (MadLittleMods) covering my personal projects and softare development things spanning web development, hardware, and a little game dev.</description><link>https://ericeastwood.com/</link><atom:link href="https://ericeastwood.com/rss.xml" rel="self" type="application/rss+xml" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"/><language>en-us</language><lastBuildDate>Wed, 10 Jul 2024 03:00:48 GMT</lastBuildDate><item><title>Paper backup and recovery guide for `pass` (Password Store) - SSH and GPG keys</title><link>https://ericeastwood.com/blog/paper-backup-and-recovery-guide-for-pass-password-store/</link><guid isPermaLink="true">https://ericeastwood.com/blog/paper-backup-and-recovery-guide-for-pass-password-store/</guid><description>You will want to go through these instructions, copy-paste this blog post to your own Microsoft Word/Google Doc, replace the keys with your own, and print a copy for safe-keeping. This paper copy will be the only thing you need to recover in case of a total loss of all devices.

Printing tips

Select all of the text on this blog post and copy-paste to a new Microsoft Word/Google Doc with the formatting
Adjust the page margins to 0.5&quot; on all sides
In Google Docs, remove the tan background color by selecting everything then Format -&gt; Paragraph styles -&gt; Borders and shading -&gt; Background color -&gt; None


If you&apos;re curious to get a preview of how the setup will look and how pass works, this</description><pubDate>Tue, 11 Jun 2024 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;You will want to go through these instructions, copy-paste this blog post to your own Microsoft Word/Google Doc, replace the keys with your own, and print a copy for safe-keeping. This paper copy will be the only thing you need to recover in case of a total loss of all devices.&lt;/p&gt;
&lt;details&gt;
&lt;summary&gt;Printing tips&lt;/summary&gt;
&lt;ol&gt;
&lt;li&gt;Select all of the text on this blog post and copy-paste to a new Microsoft Word/Google Doc with the formatting&lt;/li&gt;
&lt;li&gt;Adjust the page margins to 0.5&quot; on all sides&lt;/li&gt;
&lt;li&gt;In Google Docs, remove the tan background color by selecting everything then &lt;strong&gt;Format&lt;/strong&gt; -&gt; &lt;strong&gt;Paragraph styles&lt;/strong&gt; -&gt; &lt;strong&gt;Borders and shading&lt;/strong&gt; -&gt; &lt;strong&gt;Background color&lt;/strong&gt; -&gt; &lt;strong&gt;None&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/details&gt;
&lt;p&gt;If you&apos;re curious to get a preview of how the setup will look and how &lt;a href=&quot;https://www.passwordstore.org/&quot;&gt;&lt;code&gt;pass&lt;/code&gt;&lt;/a&gt; works, &lt;a href=&quot;https://www.youtube.com/watch?v=FhwsfH2TpFA&quot;&gt;this Dreams Of Code video&lt;/a&gt; is a great resource. This blog post also goes over the initial setup of &lt;code&gt;pass&lt;/code&gt; so that the printed instructions include everything you need to fully bootstrap a new device in case of recovery and so you have a reference on how you initially set everything when you&apos;re trying to recall months/years later. The core new piece of information that this blog post goes over is how to backup your SSH and GPG keys to paper and recover from them in case of emergency.&lt;/p&gt;
&lt;p&gt;It&apos;s also a good idea to practice your recovery steps by setting up a new device using the paper copy instead of just copying key files over. For example, I set everything up on my Linux PC and was able to fully recover on my Macbook using the paper copy.&lt;/p&gt;
&lt;p&gt;For reference, I was able to fully migrate from the Chrome&apos;s built-in password manager to &lt;code&gt;pass&lt;/code&gt; (imported everything using my &lt;a href=&quot;https://github.com/MadLittleMods/pass-import-chrome&quot;&gt;&lt;code&gt;pass-import-chrome&lt;/code&gt; project&lt;/a&gt;). I also use &lt;code&gt;pass&lt;/code&gt; as a complete replacement for Authy/Google Authenticator to manage one-time passwords (OTP) with the &lt;a href=&quot;https://github.com/tadfisher/pass-otp&quot;&gt;&lt;code&gt;pass-otp&lt;/code&gt;&lt;/a&gt; extension.&lt;/p&gt;
&lt;p&gt;Table of Contents (quick-links):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#initial-pass-setup&quot;&gt;Initial &lt;code&gt;pass&lt;/code&gt; setup&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#backup-necessary-keys-on-paper&quot;&gt;Backup necessary keys on paper&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#setting-up-a-new-computer-restorerecovery&quot;&gt;Setting up a new computer (restore/recovery)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/paper-backup-and-recovery-guide-for-pass-password-store/paper-copy.jpg&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;h1 id=&quot;pass-password-store---emergency-recovery-instructions&quot;&gt;&lt;code&gt;pass&lt;/code&gt; (Password Store) - Emergency recovery instructions&lt;/h1&gt;
&lt;p&gt;Project: &lt;a href=&quot;https://www.passwordstore.org/&quot;&gt;https://www.passwordstore.org/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If you&apos;re reading these instructions, it probably means:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;You&apos;re setting up a new device&lt;/li&gt;
&lt;li&gt;Everything burned down to the ground and we need to fully recover&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;initial-pass-setup&quot;&gt;Initial &lt;code&gt;pass&lt;/code&gt; setup&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; These initial setup steps are just provided for context in case you need to reference how things were first created. If you&apos;re looking for instructions on how to restore/recover to a new device, jump to the &lt;a href=&quot;#setting-up-a-new-computer-restorerecovery&quot;&gt;&quot;Setting up a new computer (restore/recovery)&quot;&lt;/a&gt; section below.&lt;/p&gt;
&lt;h3 id=&quot;generate-gpg-key-used-to-encryptdecrypt-data&quot;&gt;Generate GPG key used to encrypt/decrypt data&lt;/h3&gt;
&lt;p&gt;Setup a GPG key that will be used to encrypt data. You will be prompted for a name/email but this can be set to anything and is just used to help you recognize the key. You will also be prompted for a passphrase to protect the key. The passphrase should be something memorable because you will be using it over and over to decrypt your passwords.&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;gpg&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;--gen-key&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;gpg&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;--list-keys&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;# Update so that the key doesn&apos;t expire&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;# (key expiry can be updated whenever, even after expiration)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;gpg&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;--edit-key&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;D73297D7CB939CC6DB6302038954DD2384B1769&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;gpg&gt;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;expire&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;Key&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;is&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;valid&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;for?&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; (0) 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;gpg&gt;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;save&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Make sure &lt;a href=&quot;https://wiki.archlinux.org/title/GnuPG#Disable_unsupported_AEAD_mechanism&quot;&gt;AEAD encryption is disabled&lt;/a&gt; otherwise you will run into compatibility problems with other OpenPGP implementations like &lt;a href=&quot;https://github.com/pgpainless/pgpainless&quot;&gt;PGPainless&lt;/a&gt; that the &lt;a href=&quot;https://github.com/android-password-store/Android-Password-Store&quot;&gt;Android Password Store&lt;/a&gt; app uses.&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  $ gpg --expert --edit-key 0D73297D7CB939CC6DB6302038954DD2384B1769&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  # Check if AEAD is advertised as being supported&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  gpg&gt; showpref&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  [ultimate] (1). test-blog-post &amp;#x3C;test-blog-post@ericeastwood.com&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;       Cipher: AES256, AES192, AES, 3DES&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&lt;span style=&quot;user-select: none;&quot;&gt;+&lt;/span&gt;      AEAD: OCB&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;       Digest: SHA512, SHA384, SHA256, SHA224, SHA1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;       Compression: ZLIB, BZIP2, ZIP, Uncompressed&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&lt;span style=&quot;user-select: none;&quot;&gt;+&lt;/span&gt;      Features: MDC, AEAD, Keyserver no-modify&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  # Disable AEAD&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  gpg&gt; setpref AES256 AES192 AES SHA512 SHA384 SHA256 SHA224 ZLIB BZIP2 ZIP&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  Set preference list to:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;       Cipher: AES256, AES192, AES, 3DES&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #E45649&quot;&gt;&lt;span style=&quot;user-select: none;&quot;&gt;-&lt;/span&gt;      AEAD:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;       Digest: SHA512, SHA384, SHA256, SHA224, SHA1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;       Compression: ZLIB, BZIP2, ZIP, Uncompressed&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #E45649&quot;&gt;&lt;span style=&quot;user-select: none;&quot;&gt;-&lt;/span&gt;      Features: MDC, Keyserver no-modify&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  Really update the preferences? (y/N) y&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;setup-pass&quot;&gt;Setup &lt;code&gt;pass&lt;/code&gt;:&lt;/h3&gt;
&lt;p&gt;Install &lt;a href=&quot;https://www.passwordstore.org/&quot;&gt;&lt;code&gt;pass&lt;/code&gt;&lt;/a&gt; and &lt;a href=&quot;https://github.com/tadfisher/pass-otp&quot;&gt;&lt;code&gt;pass-otp&lt;/code&gt;&lt;/a&gt; (see the &lt;a href=&quot;#dependencies-on-linux-manjaro&quot;&gt;dependencies section below&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;Initialize the password store with the GPG key you just generated:&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;$ pass init 0D73297D7CB939CC6DB6302038954DD2384B1769&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;$ pass git init&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Create a private repo on GitHub/GitLab that will be used as the remote backup for our password store. Since the password files are encrypted, the only exposure is revealing which sites you have accounts with, which is not ideal, but the convenience of a git-based remote backup outweighs this small metadata leak in my opinion. Remember, they won&apos;t know the email or username associated with the accounts as long as you avoid using them in the file names. I use a naming scheme like &quot;github.com/personal&quot; and &quot;github.com/work&quot; to keep it ambiguous.&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;$ pass git remote add origin git@github.com:MadLittleMods/password-store.git&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;$ pass git branch -M main&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;$ pass git push -u origin main&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;add-ssh-key-to-clone-password-repo&quot;&gt;Add SSH key to clone password repo&lt;/h3&gt;
&lt;p&gt;Create an SSH key that we can use to clone the password repo without access to our GitHub account:&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;ssh-keygen&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;-t&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;ed25519&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;-C&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;MadLittleMods/password-store deploy key&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;Enter&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;file&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;in&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;which&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;to&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;save&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;the&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;key&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; (/home/eric/.ssh/id_ed25519): /home/eric/.ssh/id_ed25519_password_store_deploy_key&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;Enter&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;passphrase&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; (empty &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;no&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;passphrase&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;):&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;Enter&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;same&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;passphrase&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;again:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;[...]&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;(suggested name: &lt;code&gt;id_ed25519_password_store_deploy_key&lt;/code&gt;)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; No password necessary on the SSH key since the passwords we&apos;re cloning are already encrypted and it&apos;s just another friction step to figure out during recovery.&lt;/p&gt;
&lt;p&gt;Add the public part of the SSH key to the deploy key section of the GitHub repo (deploy keys are just repo-scoped SSH keys). Go to your &lt;strong&gt;repo settings&lt;/strong&gt; -&gt; &lt;strong&gt;Deploy keys&lt;/strong&gt; -&gt; &lt;strong&gt;Add deploy key&lt;/strong&gt; -&gt; For the &lt;strong&gt;Key&lt;/strong&gt; field, paste in &lt;code&gt;cat ~/.ssh/id_ed25519_password_store_deploy_key.pub&lt;/code&gt; and add a &lt;strong&gt;Title&lt;/strong&gt; like &lt;code&gt;SSH key to clone repo for emergency recovery&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&quot;backup-necessary-keys-on-paper&quot;&gt;Backup necessary keys on paper:&lt;/h2&gt;
&lt;p&gt;Export keys for other devices:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;SSH key in order to clone repo (private)&lt;/li&gt;
&lt;li&gt;GPG key in order to decrypt passwords (public/private)&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;ssh-key&quot;&gt;SSH key&lt;/h3&gt;
&lt;p&gt;Export the SSH &lt;strong&gt;private&lt;/strong&gt; key as a QR Code (see the &lt;a href=&quot;#dependencies-on-linux-manjaro&quot;&gt;dependencies section below&lt;/a&gt; for how to install &lt;code&gt;qrencode&lt;/code&gt;):&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;cat&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;~/.ssh/id_ed25519_password_store_deploy_key&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;|&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;qrencode&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;--size=5&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;--8bit&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;--output&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;ssh-private-password-store.qr.png&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/paper-backup-and-recovery-guide-for-pass-password-store/ssh-private-password-store.qr.png&quot; alt=&quot;QR code image example of the SSH private key&quot;&gt;&lt;/p&gt;
&lt;p&gt;Export the SSH key as text just in case the QR code is unreadable:&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;cat&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;~/.ssh/id_ed25519_password_store_deploy_key&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;-----BEGIN&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;OPENSSH&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;PRIVATE&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;KEY-----&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;QyNTUxOQAAACApYJV4X58eT9gh1M3YdqWI2oCfV8sOjX4KwR32O3RpDAAAAJjTje11043t&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;dQAAAAtzc2gtZWQyNTUxOQAAACApYJV4X58eT9gh1M3YdqWI2oCfV8sOjX4KwR32O3RpDA&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;AAAEBsA8SGtj3IH/2RgDo/6ERGhDV6tny/rsomknNPpKP+NylglXhfnx5P2CHUzdh2pYja&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #E45649&quot;&gt;gJ9Xyw6NfgrBHfY7dGkMAAAADnRlc3QtYmxvZy1wb3N0AQIDBAUGBw&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;=&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;-----END&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;OPENSSH&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;PRIVATE&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;KEY-----&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;gpg-key&quot;&gt;GPG Key&lt;/h3&gt;
&lt;h4 id=&quot;gpg-public-key&quot;&gt;GPG Public Key&lt;/h4&gt;
&lt;p&gt;Export the GPG public key as a QR Code:&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;gpg&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;--export&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;D73297D7CB939CC6DB6302038954DD2384B1769&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;|&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;qrencode&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;--size=5&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;--8bit&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;--output&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;gpg-0D73297D7CB939CC6DB6302038954DD2384B1769-public.qr.png&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/paper-backup-and-recovery-guide-for-pass-password-store/gpg-0D73297D7CB939CC6DB6302038954DD2384B1769-public.qr.png&quot; alt=&quot;QR code image example of the GPG public key&quot;&gt;&lt;/p&gt;
&lt;p&gt;Export the GPG public key as armor/base64 text:&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;gpg&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;--armor&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;--export&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;D73297D7CB939CC6DB6302038954DD2384B1769&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;-----BEGIN&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;PGP&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;PUBLIC&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;KEY&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;BLOCK-----&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;mDMEZmT03xYJKwYBBAHaRw8BAQdACT7nJ/XDcfDHZCDnXDovA78D5W4YvcEYZsyU&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;OF/CP8K0MHRlc3QtYmxvZy1wb3N0IDx0ZXN0LWJsb2ctcG9zdEBlcmljZWFzdHdv&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;b2QuY29tPoiZBBMWCgBBFiEEDXMpfXy5OcxttjAgOJVN0jhLF2kFAmZk9N8CGwMF&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;CQWjmoAFCwkIBwICIgIGFQoJCAsCBBYCAwECHgcCF4AACgkQOJVN0jhLF2l3CgD/&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;V/TTf4lmNn+0mM2VRB8HIKHET1v8IzIe41xwbIT06L4BALW3uf57Cw+4+npuKEhm&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;K0C1wsIcgRdRlYWozgJiaEkEuDgEZmT03xIKKwYBBAGXVQEFAQEHQBqKYxXO8mow&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;FMGJTNkNYqwiPnqLAfLEsqdzavPwejxnAwEIB4h+BBgWCgAmFiEEDXMpfXy5Ocxt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;tjAgOJVN0jhLF2kFAmZk9N8CGwwFCQWjmoAACgkQOJVN0jhLF2nAkwEA7jpzd+9I&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;UTIbpAU7cMISYU1W2z2PVd3sBXoev1kVh9sA/A0tyDWkuFXoMX3z2vq6inS0Y+MO&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;TiJO1lpGW+r/nc8A&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;=NJZ8&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;-----END&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;PGP&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;PUBLIC&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;KEY&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;BLOCK-----&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h4 id=&quot;gpg-secret-key&quot;&gt;GPG Secret key&lt;/h4&gt;
&lt;p&gt;Export the GPG secret key as a QR Code. We&apos;re using &lt;code&gt;paperkey&lt;/code&gt; to reduce the size of the GPG secret key so it fits better in a QR code (see the &lt;a href=&quot;#dependencies-on-linux-manjaro&quot;&gt;dependencies section below&lt;/a&gt; for how to install &lt;code&gt;paperkey&lt;/code&gt;):&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;gpg&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;--export-secret-key&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;D73297D7CB939CC6DB6302038954DD2384B1769&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;|&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;paperkey&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;--output-type&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;raw&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;|&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;qrencode&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;--size=5&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;--8bit&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;--output&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;gpg-0D73297D7CB939CC6DB6302038954DD2384B1769-secret.qr.png&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/paper-backup-and-recovery-guide-for-pass-password-store/gpg-0D73297D7CB939CC6DB6302038954DD2384B1769-secret.qr.png&quot; alt=&quot;QR code image example of the GPG secret key&quot;&gt;&lt;/p&gt;
&lt;p&gt;Export the GPG secret key as armor/base64 text:&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;gpg&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;--armor&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;--export-secret-key&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;D73297D7CB939CC6DB6302038954DD2384B1769&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;-----BEGIN&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;PGP&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;PRIVATE&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;KEY&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;BLOCK-----&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;lIYEZmT03xYJKwYBBAHaRw8BAQdACT7nJ/XDcfDHZCDnXDovA78D5W4YvcEYZsyU&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;OF/CP8L+BwMCWVcI1KGofnH//3oBk13955sm07mVlpRTRT+Qwo+NlYPCtyHc8uH1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;fxZumrId9u3G8TewMk69J/XCvc5GxuETkVcST0iPDJUp2gNPBlyll7QwdGVzdC1i&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;bG9nLXBvc3QgPHRlc3QtYmxvZy1wb3N0QGVyaWNlYXN0d29vZC5jb20+iJkEExYK&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;AEEWIQQNcyl9fLk5zG22MCA4lU3SOEsXaQUCZmT03wIbAwUJBaOagAULCQgHAgIi&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;AgYVCgkICwIEFgIDAQIeBwIXgAAKCRA4lU3SOEsXaXcKAP9X9NN/iWY2f7SYzZVE&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;HwcgocRPW/wjMh7jXHBshPTovgEAtbe5/nsLD7j6em4oSGYrQLXCwhyBF1GVhajO&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;AmJoSQSciwRmZPTfEgorBgEEAZdVAQUBAQdAGopjFc7yajAUwYlM2Q1irCI+eosB&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;8sSyp3Nq8/B6PGcDAQgH/gcDArMYKe1PPgzu/6x3lyVb7FUA7DwO5ErG4SrZ8PeR&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;601kLAcWLtwkwQZ0/dPBnMlxZDstOxZchstmYKXlV3AYjV9TuMt57h1thGeviYq1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;XoGIfgQYFgoAJhYhBA1zKX18uTnMbbYwIDiVTdI4SxdpBQJmZPTfAhsMBQkFo5qA&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;AAoJEDiVTdI4SxdpwJMBAO46c3fvSFEyG6QFO3DCEmFNVts9j1Xd7AV6Hr9ZFYfb&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;APwNLcg1pLhV6DF989r6uop0tGPjDk4iTtZaRlvq/53PAA&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;==&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;=9Djr&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;-----END&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;PGP&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;PRIVATE&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;KEY&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;BLOCK-----&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Depending on how good you think your memory is, you may want to write your GPG passphrase to unlock secret key somewhere in this document &lt;em&gt;after&lt;/em&gt; it&apos;s printed (not good to write the passphrase in the document itself stored on your computer/cloud which isn&apos;t protected). I&apos;ll leave a place for your here in case you want to do that:&lt;/p&gt;
&lt;!-- prettier-ignore --&gt;
&lt;p&gt;GPG passphrase: _______________________________________________&lt;/p&gt;
&lt;h2 id=&quot;setting-up-a-new-computer-restorerecovery&quot;&gt;Setting up a new computer (restore/recovery)&lt;/h2&gt;
&lt;h4 id=&quot;dependencies-on-linux-manjaro&quot;&gt;Dependencies on Linux (Manjaro)&lt;/h4&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;pamac install paperkey&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;pamac install qrencode&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;pamac install zbar&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;pamac install pass&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;pamac install pass-otp&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h4 id=&quot;dependencies-on-macos&quot;&gt;Dependencies on macOS&lt;/h4&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;brew install paperkey&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;brew install qrencode&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;brew install zbar&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;brew install pass&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;brew install pass-otp&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; If another device still exists, we can simply copy the SSH/GPG keys from that device. But it&apos;s also good practice to attempt recovery from paper to make sure our recovery steps are possible.&lt;/p&gt;
&lt;h3 id=&quot;restore-the-ssh-key-from-qr-code&quot;&gt;Restore the SSH key from QR code&lt;/h3&gt;
&lt;p&gt;Restore the SSH key:&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;zbarcam&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;-1&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;--raw&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;-Sbinary&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;~/tmp_ssh_private_key&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Or if you already have an image:&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;zbarimg&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;-1&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;--raw&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;-q&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;-Sbinary&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;secret-key.qr.png&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;~/tmp_ssh_private_key&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;Tip:&lt;/strong&gt; I was having trouble with &lt;code&gt;zbar&lt;/code&gt; recognizing the QR code when it was taking too much of the camera view. At first, I thought it was the fold/crease/wrinkle in the paper but it scanned just fine after backing it up a bit.&lt;/p&gt;
&lt;p&gt;Move the SSH key to your &lt;code&gt;~/.ssh&lt;/code&gt; directory:&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;$ mv ~/tmp_ssh_private_key ~/.ssh/id_ed25519_password_store_deploy_key&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;$ chmod 600 ~/.ssh/id_ed25519_password_store_deploy_key&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Add the SSH key to the agent:&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;ssh-add&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;~/.ssh/id_ed25519_password_store_deploy_key&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;restore-the-gpg-secret-key-from-qr-code&quot;&gt;Restore the GPG secret key from QR code&lt;/h3&gt;
&lt;p&gt;Restore the &lt;strong&gt;public&lt;/strong&gt; key first:&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;zbarcam&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;-1&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;--raw&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;-Sbinary&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;~/tmp-public-key.gpg&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Or if you already have an image:&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;zbarimg&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;-1&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;--raw&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;-q&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;-Sbinary&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;secret-key.qr.png&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;~/tmp-public-key.gpg&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Warning:&lt;/strong&gt; You need to have the public key available when restoring the secret GPG &lt;code&gt;paperkey&lt;/code&gt; backup!&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Restore the GPG &lt;strong&gt;secret&lt;/strong&gt; key from a camera:&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;zbarcam&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;-1&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;--raw&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;-Sbinary&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;|&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;paperkey&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;--pubring&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;~/tmp-public-key.gpg&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;|&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;gpg&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;--import&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Or if you already have an image:&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;zbarimg&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;-1&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;--raw&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;-q&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;-Sbinary&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;secret-key.qr.png&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;|&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;paperkey&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;--pubring&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;~/tmp-public-key.gpg&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;|&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;gpg&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;--import&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;
&lt;p&gt;Note: You will be prompted for the GPG secret key password (below) in order to import&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Change the keys trust to &lt;code&gt;ultimate&lt;/code&gt; :&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;gpg&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;--list-keys&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;gpg&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;--edit-key&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;D73297D7CB939CC6DB6302038954DD2384B1769&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;gpg&gt;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;trust&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;I&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;trust&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;ultimately&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;gpg&gt;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;save&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;clone-the-password-repo&quot;&gt;Clone the password repo&lt;/h3&gt;
&lt;blockquote&gt;
&lt;p&gt;Note: You will need the SSH key from above in order to clone the repo&lt;/p&gt;
&lt;/blockquote&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;git&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;clone&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;git@github.com:MadLittleMods/password-store.git&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;~/.password-store&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Use &lt;code&gt;pass&lt;/code&gt; like normal 🎉&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Note: You will need the GPG secret key from above in order to decrypt passwords&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id=&quot;possible-problems&quot;&gt;Possible problems&lt;/h2&gt;
&lt;h3 id=&quot;fix-gpg-permission-errors&quot;&gt;Fix GPG permission errors&lt;/h3&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;gpg: WARNING: unsafe permissions on homedir &apos;/Users/eric/.gnupg&apos;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;gpg: public key decryption failed: Permission denied&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;gpg: decryption failed: Permission denied&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Solution via Super User answer by Alex Stragies (&lt;a href=&quot;https://superuser.com/questions/954509/what-are-the-correct-permissions-for-the-gnupg-enclosing-folder-gpg-warning/954536#954536&quot;&gt;https://superuser.com/questions/954509/what-are-the-correct-permissions-for-the-gnupg-enclosing-folder-gpg-warning/954536#954536&lt;/a&gt;):&lt;/p&gt;
&lt;!-- prettier-ignore --&gt;
&lt;blockquote&gt;
&lt;ol&gt;
&lt;li&gt;Make sure, the folder+contents belong to you:&lt;br&gt;
&lt;code&gt;chown -R $(whoami) ~/.gnupg/&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Correct access rights for &lt;code&gt;.gnupg&lt;/code&gt; and subfolders:&lt;br&gt;
&lt;code&gt;find ~/.gnupg -type f -exec chmod 600 {} \;&lt;/code&gt;&lt;br&gt;
&lt;code&gt;find ~/.gnupg -type d -exec chmod 700 {} \;&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/blockquote&gt;
&lt;h3 id=&quot;wrong-password-when-trying-to-decrypt-password-in-android-password-store-app&quot;&gt;&quot;Wrong password&quot; when trying to decrypt password in Android Password Store app&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;gpg&lt;/code&gt; uses a certain flavor of AEAD encryption to generate keys that aren&apos;t compatible with other OpenPGP implementations.&lt;/p&gt;
&lt;p&gt;Solution: Disable AEAD preference on your key (already mentioned in the &lt;a href=&quot;#generate-gpg-key-used-to-encryptdecrypt-data&quot;&gt;initial GPG setup steps above&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;Dev notes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://wiki.archlinux.org/title/GnuPG#Disable_unsupported_AEAD_mechanism&quot;&gt;https://wiki.archlinux.org/title/GnuPG#Disable_unsupported_AEAD_mechanism&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/android-password-store/Android-Password-Store/pull/2218#issuecomment-1296146971&quot;&gt;https://github.com/android-password-store/Android-Password-Store/pull/2218#issuecomment-1296146971&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/android-password-store/Android-Password-Store/issues/2653#issuecomment-1682741922&quot;&gt;https://github.com/android-password-store/Android-Password-Store/issues/2653#issuecomment-1682741922&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content:encoded></item><item><title>Converting an old iMac into a standalone monitor</title><link>https://ericeastwood.com/blog/convert-an-old-imac-into-a-standalone-monitor/</link><guid isPermaLink="true">https://ericeastwood.com/blog/convert-an-old-imac-into-a-standalone-monitor/</guid><description>This is a fantastic way to upcycle an old iMac that would otherwise be e-waste. I was able to get a 24&quot; 1920x1200 sleek-looking monitor out of this for about $50 in parts.
This blog post feels a bit long but it&apos;s just a lot of images and reference material. To skip around, here are some links to the sections:

Teardown
Pinouts and references
Project schematics
LCD controller boards
Building it back up
Final result

Most of the images are bigger than they appear in this blog post. Right click and open in a new tab to see the full size.
Figuring out which iMac you have
I&apos;m working with an Apple iMac from 2008, the year before Apple started adding target display mode to iMac&apos;s which allows standalone monitor</description><pubDate>Mon, 05 Sep 2022 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;This is a fantastic way to upcycle an old iMac that would otherwise be e-waste. I was able to get a 24&quot; 1920x1200 sleek-looking monitor out of this for about $50 in parts.&lt;/p&gt;
&lt;p&gt;This blog post feels a bit long but it&apos;s just a lot of images and reference material. To skip around, here are some links to the sections:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#teardown&quot;&gt;Teardown&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#pinouts-and-references&quot;&gt;Pinouts and references&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#project-schematics&quot;&gt;Project schematics&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#lcd-controller-boards&quot;&gt;LCD controller boards&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#building-it-back-up&quot;&gt;Building it back up&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#final-result&quot;&gt;Final result&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Most of the images are bigger than they appear in this blog post. Right click and open in a new tab to see the full size.&lt;/p&gt;
&lt;h2 id=&quot;figuring-out-which-imac-you-have&quot;&gt;Figuring out which iMac you have&lt;/h2&gt;
&lt;p&gt;I&apos;m working with an Apple iMac from 2008, the year before Apple started adding &lt;a href=&quot;https://support.apple.com/en-us/HT204592&quot;&gt;target display mode&lt;/a&gt; to iMac&apos;s which allows standalone monitor functionality out of the box. In order to figure out which iMac model I have, I used one of the many serial number lookup sites. Here are a couple:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Serial number lookups:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;iMac | 2.8 GHz Core 2 Duo | 24 Inch | Early 2008: &lt;a href=&quot;https://techable.com/apple/specs/-8-ghz-core-2-duo-24-inch-early-2008/&quot;&gt;https://techable.com/apple/specs/-8-ghz-core-2-duo-24-inch-early-2008/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://everymac.com/systems/apple/imac/specs/imac-core-2-duo-2.8-24-inch-aluminum-early-2008-penryn-specs.html&quot;&gt;https://everymac.com/systems/apple/imac/specs/imac-core-2-duo-2.8-24-inch-aluminum-early-2008-penryn-specs.html&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;iMac details:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Serial No: QP8390/Z0KM&lt;/li&gt;
&lt;li&gt;Apple Model No: A1225 (EMC 2211)&lt;/li&gt;
&lt;li&gt;Model ID: iMac8,1&lt;/li&gt;
&lt;li&gt;Apple Order No: MB325LL/A&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;LCD details:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Resolution: 1920x1200&lt;/li&gt;
&lt;li&gt;LCD: LM240WU2 SL B3&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can also confirm the details by looking at the sticker on the back of the LCD panel if you want to pre-disassemble the iMac.&lt;/p&gt;
&lt;img srcset=&quot;/images/blog/convert-an-old-imac-into-a-standalone-monitor/lcd-panel-backside.jpg 3.5x&quot; alt=&quot;Backside of the LCD panel on an iMac showing off a sticker that shows the manufacturer and model number&quot;&gt;
&lt;img srcset=&quot;/images/blog/convert-an-old-imac-into-a-standalone-monitor/inside-the-imac.jpg 3.5x&quot; alt=&quot;What the inside of the iMac looks like after it&amp;#x27;s completely disassembled (leaving only he power supply)&quot;&gt;
&lt;h2 id=&quot;teardown&quot;&gt;Teardown&lt;/h2&gt;
&lt;p&gt;For a general teardown guide, see &lt;a href=&quot;https://www.youtube.com/watch?v=Qw9HO5Iaios&quot;&gt;this video by Hugh Jeffreys&lt;/a&gt;. We basically need to gut everything except the LCD panel and power supply.&lt;/p&gt;
&lt;p&gt;Here are some pics of when I did it so I could keep track of screws:&lt;/p&gt;
&lt;!-- prettier-ignore --&gt;













&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;.&lt;/th&gt;&lt;th&gt;.&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img srcset=&quot;/images/blog/convert-an-old-imac-into-a-standalone-monitor/imac-screws-around-bezel-color-map.png 5x&quot; alt=&quot;Colored screw guide showing how 3 different lengths of screws are used around the bezel of the monitor. The 2 longest screws go in bottom middle with the 2 medium screws flanking that on both sides and the 6 small screws go along the top in the remaining holes&quot;&gt;&lt;/td&gt;&lt;td&gt;&lt;img srcset=&quot;/images/blog/convert-an-old-imac-into-a-standalone-monitor/imac-specific-bezel-screw.jpg 4x&quot; alt=&quot;Showing off the specific screw used to hold the LCD panel down to the case after the bezel comes off&quot;&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;Connectors on the LCD:&lt;/p&gt;
&lt;!-- prettier-ignore --&gt;













&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;14-pin backlight connector&lt;/th&gt;&lt;th&gt;30-pin LVDS connector for the video signal&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img srcset=&quot;/images/blog/convert-an-old-imac-into-a-standalone-monitor/lcd-14-pin-backlight-connector.jpg 2x&quot; alt=&quot;14-pin backlight connector on the back of the LCD&quot;&gt;&lt;/td&gt;&lt;td&gt;&lt;img srcset=&quot;/images/blog/convert-an-old-imac-into-a-standalone-monitor/lcd-30-pin-lvds-connector-for-video-signal.jpg 2x&quot; alt=&quot;30-pin LVDS connector for the video signal on the back of the LCD&quot;&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;Connectors from the built-in iMac power supply (ADP-250AF B):&lt;/p&gt;
&lt;!-- prettier-ignore --&gt;













&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;14-pin backlight&lt;/th&gt;&lt;th&gt;12-pin mobo (&lt;code&gt;MB&lt;/code&gt;)&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img srcset=&quot;/images/blog/convert-an-old-imac-into-a-standalone-monitor/imac-power-supply-14-pin-backlight.jpg 2x&quot; alt=&quot;14-pin backlight power cable coming from the iMac power supply. This connector is labeled as CN101&quot;&gt;&lt;/td&gt;&lt;td&gt;&lt;img srcset=&quot;/images/blog/convert-an-old-imac-into-a-standalone-monitor/imac-power-supply-12-pin-mobo.png 2x&quot; alt=&quot;12-pin motherboard power cable coming from the iMac power supply. This connector is labeled as CN102.&quot;&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;h2 id=&quot;pinouts-and-references&quot;&gt;Pinouts and references&lt;/h2&gt;
&lt;p&gt;Here are a bunch of references I found while researching this project:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.ifixit.com/Answers/View/589418/Power+Supply+pin+(voltage,+start+other)&quot;&gt;https://www.ifixit.com/Answers/View/589418/Power+Supply+pin+(voltage,+start+other)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.ifixit.com/Answers/View/213674/iMac+dead.+used+as+a+monitor+lcd+panel&quot;&gt;https://www.ifixit.com/Answers/View/213674/iMac+dead.+used+as+a+monitor+lcd+panel&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Power supply connector pinouts for the original iMac power supply (Delta ADP-250AF B) (&lt;em&gt;&lt;a href=&quot;https://www.ifixit.com/Answers/View/589418/Power+Supply+pin+(voltage,+start+other)&quot;&gt;source&lt;/a&gt; via MrSoul&lt;/em&gt;):&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; MrSoul indicates that the &lt;code&gt;BL_ON&lt;/code&gt;/&lt;code&gt;P_DIM&lt;/code&gt; pinout &quot;are reversed on my diagram.&quot;&lt;/p&gt;
&lt;p&gt;&lt;img srcset=&quot;/images/blog/convert-an-old-imac-into-a-standalone-monitor/mrsoul-power-supply-connector-pinout1.png 1x&quot; alt=&quot;Pinouts for the Delta ADP-250AF B power supply for CN101, CN102, and CN103. CN102 is labeled 1: GND, 2: P_DIM, 3: PS_ON (+3.3v standby), 4: GND (if SATA), 5: +12v standby, 6: GND, 7: GND, 8: BL_ON, 9: +12v, 10: +12v,11: 12v, 12: GND. CN103 is labeled  as 1: GND5v and 2: GND5v. CN101 is labeled as 1 - 5: +24v (standby), 6 - 10: GND, 11: P_DIM, 12: BL_ON&quot;&gt;&lt;img srcset=&quot;/images/blog/convert-an-old-imac-into-a-standalone-monitor/mrsoul-power-supply-connector-pinout2.png 1x&quot; alt=&quot;Pinouts for the power supply to motherboard + SATA power cable (593-0879-A) labeled as PS, MB, GD, and SATA. PS is labeled as 1: GND=mb1, 2: +12v (standby)=mb8, 3: GND (if SATA)=mb9, 4: PS_ON (+3.3v standby)=mb2, 5: P_DIM=mb10, 6: GND=mb6, 7: GND=mb7, 8: +12v=mb4, 9: +12v=mb5, 10: +12V=SATA13,14,15, 11: BL_ON=mb3, 12: GND=SATA10,11,12. MB is labeled as 1: GND=PS1, 2: PS_ON (+3.3v standby)=PS4, 3: BL_ON=PS11, 4: +12v=PS8, 5: +12v=PS9, 6: GND=PS6, 7: GND=PS7, 8: +12v (standby)=PS2, 9: GND (if SATA)=PS3, 10: P_DIM=PS5, 11: +5v=SATA7,8,9, 12: GND5v=SATA4,5,6. GD is labeled as 1: GND5v=X, 2: GND5v=mb12+SATA4,5,6. SATA is labeled as 1 - 3: +3.3v=x, 4 - 6: GND5v=mb12, 7 - 9: +5v=mb11, 10 - 12: GND=PS12, 13 - 15: +12v=PS10&quot;&gt;&lt;/p&gt;
&lt;p&gt;&quot;This is the pinout of the Molex 5569 plug from the genuine Apple ADP-250AFB power supply&quot; (&lt;em&gt;&lt;a href=&quot;https://www.ifixit.com/Answers/View/589418/Power+Supply+pin+(voltage,+start+other)?permalink=answer-701848#answer701848&quot;&gt;source&lt;/a&gt; via DocMaker&lt;/em&gt;). This matches the &lt;code&gt;CN102&lt;/code&gt;/&lt;code&gt;PS&lt;/code&gt; pinouts from above as far as I can tell but the orientation is different:&lt;/p&gt;
&lt;img srcset=&quot;/images/blog/convert-an-old-imac-into-a-standalone-monitor/docmaker-pinout-cn102-molex-5569-12-pin.png 2x&quot; alt=&quot;Pinout of the 12-pin molex 5569 plug from the genuine Apple ADP-250AFB power supply is labeled as 1: GND, 2: 12v (standby), 3: GND (if SATA), 4: PS_ON (2.6v standby), 5: BL_ON, 6: GND, 7: GND, 8: 12v, 9: 12v, 10: 12v, 11: P_DIM/ADJ, 12: GND&quot;&gt;
&lt;blockquote&gt;
&lt;p&gt;Thanks for your help, everyone. My dead old 2008 iMac A1225 EMC2211 will have a new life as a simple display.&lt;/p&gt;
&lt;p&gt;This is the pinout of the Molex 5569 plug from the genuine Apple ADP-250AFB power supply. Use of the three 12V pin to power the &lt;code&gt;M.NT68676.2A&lt;/code&gt; [LCD controller] board. Connect &lt;code&gt;GND&lt;/code&gt; to &lt;code&gt;GND&lt;/code&gt;, Use the 5.5x2.1 connector instead of 12V and &lt;code&gt;GND&lt;/code&gt; of the &lt;code&gt;CN5&lt;/code&gt; plug of the &lt;code&gt;M.NT68676.2A&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Connect &lt;code&gt;BL_ON&lt;/code&gt; and &lt;code&gt;P_DIM/ADJ&lt;/code&gt; respectively to pin &lt;code&gt;3&lt;/code&gt; and &lt;code&gt;4&lt;/code&gt; of the &lt;code&gt;CN5&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;-- DocMaker, &lt;a href=&quot;https://www.ifixit.com/Answers/View/589418/Power+Supply+pin+(voltage,+start+other)#answer701848&quot;&gt;https://www.ifixit.com/Answers/View/589418/Power+Supply+pin+(voltage,+start+other)#answer701848&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;hr&gt;
&lt;h2 id=&quot;project-schematics&quot;&gt;Project schematics&lt;/h2&gt;
&lt;p&gt;A few people have graciously documented their schematics (wiring diagrams). These are very helpful references to understand how to wire everything up. It&apos;s best to just reference all three and pull out what you need.&lt;/p&gt;
&lt;!-- prettier-ignore --&gt;















&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;MrSoul project schematic (&lt;em&gt;&lt;a href=&quot;https://www.ifixit.com/Answers/View/589418/Power+Supply+pin+(voltage,+start+other)?permalink=comment-802559#comment-802559&quot;&gt;source&lt;/a&gt;&lt;/em&gt;)&lt;/th&gt;&lt;th&gt;Bruce Mac (&lt;a href=&quot;https://pbase.com/brucemac/2019octdisplay&quot;&gt;&lt;em&gt;source&lt;/em&gt;&lt;/a&gt; via &lt;a href=&quot;https://www.ifixit.com/Answers/View/213674/iMac+dead.+used+as+a+monitor+lcd+panel#answer596713&quot;&gt;&lt;em&gt;iFixit answer&lt;/em&gt;&lt;/a&gt;)&lt;/th&gt;&lt;th&gt;Comitéquartier Ouest (&lt;a href=&quot;https://www.ifixit.com/Answers/View/213674/iMac+dead.+used+as+a+monitor+lcd+panel#answer739474&quot;&gt;&lt;em&gt;source&lt;/em&gt;&lt;/a&gt;)&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;img srcset=&quot;/images/blog/convert-an-old-imac-into-a-standalone-monitor/mrsoul-project-schematic.jpg 1x&quot; alt=&quot;MrSoul project schematic&quot;&gt;&lt;/td&gt;&lt;td&gt;&lt;img srcset=&quot;/images/blog/convert-an-old-imac-into-a-standalone-monitor/bruce-mac-project-schematic.png 1x&quot; alt=&quot;Bruce Mac project schematic&quot;&gt;&lt;/td&gt;&lt;td&gt;&lt;img srcset=&quot;/images/blog/convert-an-old-imac-into-a-standalone-monitor/comitequartier-ouest-project-schematic.png 2x&quot; alt=&quot;Comitéquartier Ouest project schematic&quot;&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;h3 id=&quot;setting-up-a-power-button&quot;&gt;Setting up a power button&lt;/h3&gt;
&lt;blockquote&gt;
&lt;p&gt;I use a bistable relay to be able to reuse the original iMac push button.&lt;/p&gt;
&lt;p&gt;If you replace it with a classic switch (on/off), you don&apos;t need the relay, just that it makes contact between GND and PS_ON.&lt;/p&gt;
&lt;p&gt;+12V SB is the only track that always outputs 12v, even if the power supply is not activated (but I assume it is not able to offer much amperage), I use it to power the bistable relay.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;-- MrSoul, &lt;a href=&quot;https://www.ifixit.com/Answers/View/589418/Power+Supply+pin+(voltage,+start+other)#comment802578&quot;&gt;https://www.ifixit.com/Answers/View/589418/Power+Supply+pin+(voltage,+start+other)#comment802578&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Bistable relay example &lt;a href=&quot;https://aliexpress.com/item/4000820341572.html&quot;&gt;https://aliexpress.com/item/4000820341572.html&lt;/a&gt; (&lt;a href=&quot;https://www.ifixit.com/Answers/View/213674/iMac+dead.+used+as+a+monitor+lcd+panel#answer739474&quot;&gt;&lt;em&gt;source&lt;/em&gt;&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;Or could probably use a &lt;a href=&quot;https://www.youtube.com/watch?v=y1ROEogHF7A&quot;&gt;latch circuit&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;lcd-controller-boards&quot;&gt;LCD controller boards&lt;/h2&gt;
&lt;p&gt;There are a few different 3rd-party LCD controller boards to choose from. This is what drives the LCD panel independent of the iMac and is the main piece that allows this project to be possible.&lt;/p&gt;
&lt;h3 id=&quot;mnt686762a-lcd-controller-board&quot;&gt;&lt;code&gt;M.NT68676.2A&lt;/code&gt; LCD controller board&lt;/h3&gt;
&lt;p&gt;A lot of people seem to use this one but I ordered the other one below.&lt;/p&gt;
&lt;p&gt;Example for sale: &lt;a href=&quot;https://www.ebay.com/itm/364454394706&quot;&gt;https://www.ebay.com/itm/364454394706&lt;/a&gt;&lt;/p&gt;
&lt;img srcset=&quot;/images/blog/convert-an-old-imac-into-a-standalone-monitor/lcd-controller-m-nt68676-2a.jpg 1x&quot; alt=&quot;M.NT68676.2A LCD controller board with the connectors labeled as CN5: inverter, CN10: IR interface, CN3: power supply, CN11: key interface, CN25: LVDS interface, CN20: speaker&quot;&gt;
&lt;p&gt;CN5 (6pin: Inverter connector) pinout:&lt;/p&gt;
&lt;img srcset=&quot;/images/blog/convert-an-old-imac-into-a-standalone-monitor/controller-cn5-pinout.jpg 2x&quot; alt=&quot;CN5 pinout (6pin: Inverter connector) labeled as 1: 12v, 2: 12v, 3: BLO (back-light on/off control for panel), 4: ADJ (brightness adjustment for panel), 5: GND, 6: GND&quot;&gt;
&lt;h3 id=&quot;other-board-with-hdmi-and-displayport&quot;&gt;Other board with HDMI and DisplayPort&lt;/h3&gt;
&lt;p&gt;I opted for this controller anticipating that I would want to connect to things that used HDMI and DisplayPort in the future.&lt;/p&gt;
&lt;p&gt;Example for sale: &lt;a href=&quot;https://www.ebay.com/itm/234611483402&quot;&gt;https://www.ebay.com/itm/234611483402&lt;/a&gt;&lt;/p&gt;
&lt;img srcset=&quot;/images/blog/convert-an-old-imac-into-a-standalone-monitor/lcd-controller-hdmi-dp-board-overview.jpg 2x&quot; alt=&quot;LCD controller board with HDMI, DisplayPort, and USB Type-C inputs&quot;&gt;
&lt;img srcset=&quot;/images/blog/convert-an-old-imac-into-a-standalone-monitor/lcd-controller-hdmi-dp-with-cabling.jpg 2x&quot; alt=&quot;Zoomed out picture of the LCD controller board with the different cables it comes with&quot;&gt;
&lt;img srcset=&quot;/images/blog/convert-an-old-imac-into-a-standalone-monitor/lcd-controller-hdmi-dp-fully-wired-up-example.jpg 2x&quot; alt=&quot;LCD controller board fully wired up to a monitor example&quot;&gt;
&lt;img srcset=&quot;/images/blog/convert-an-old-imac-into-a-standalone-monitor/lcd-controller-hdmi-dp-power-supply.jpg 2x&quot; alt=&quot;Close-up of the power supply PCB they are using in their example.&quot;&gt;
&lt;h2 id=&quot;panel-mount-connectors&quot;&gt;Panel mount connectors&lt;/h2&gt;
&lt;p&gt;You can get panel mount connectors to extend the outputs from the driver board to a nice panel mount to the iMac case. Here are a couple options depending on how you want to lay things out. I ended up using this first option and having the HDMI port come out the back of the iMac in the deepest spot in the middle through the old air vent (pictured below).&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://www.aliexpress.com/item/3256804506817061.html&quot;&gt;https://www.aliexpress.com/item/3256804506817061.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;img srcset=&quot;/images/blog/convert-an-old-imac-into-a-standalone-monitor/panel-mount-hdmi1.png 2x&quot; alt=&quot;Front view of panel mount HDMI connectors&quot;&gt; &lt;img srcset=&quot;/images/blog/convert-an-old-imac-into-a-standalone-monitor/panel-mount-hdmi2.png 1.5x&quot; alt=&quot;Side view of panel mount HDMI connectors with a dust cover&quot;&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;HDMI: &lt;a href=&quot;https://www.aliexpress.com/item/3256803048450080.html&quot;&gt;https://www.aliexpress.com/item/3256803048450080.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;DisplayPort: &lt;a href=&quot;https://www.aliexpress.com/item/2255800165025739.html&quot;&gt;https://www.aliexpress.com/item/2255800165025739.html&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;img srcset=&quot;/images/blog/convert-an-old-imac-into-a-standalone-monitor/panel-mount-ribbon-hdmi.png 2x&quot; alt=&quot;Panel mount female HDMI with a ribbon cable to a male HDMI connector (extension)&quot;&gt;
&lt;img srcset=&quot;/images/blog/convert-an-old-imac-into-a-standalone-monitor/panel-mount-ribbon-dp.png 2x&quot; alt=&quot;Panel mount female DisplayPort with a ribbon cable to a male DisplayPort connector (extension)&quot;&gt;
&lt;h2 id=&quot;building-it-back-up&quot;&gt;Building it back up&lt;/h2&gt;
&lt;p&gt;Luckily, building on the prior art of people doing this before, this project wasn&apos;t too hard to figure out. There is a lot of space to mount things inside the iMac case and I was able to re-use a few standoffs and screws from the original iMac.&lt;/p&gt;
&lt;img srcset=&quot;/images/blog/convert-an-old-imac-into-a-standalone-monitor/conversion-wiring1.jpg 4x&quot; alt=&quot;Inside of the iMac conversion without the LCD panel on&quot;&gt;
&lt;img srcset=&quot;/images/blog/convert-an-old-imac-into-a-standalone-monitor/conversion-wiring2.jpg 4x&quot; alt=&quot;Inside of the iMac conversion with the LCD panel connected but propped up to still be able to access the wiring&quot;&gt;
&lt;img srcset=&quot;/images/blog/convert-an-old-imac-into-a-standalone-monitor/conversion-wiring3.jpg 4x&quot; alt=&quot;Another angle of inside of the iMac conversion with the LCD panel connected but propped up to still be able to access the wiring&quot;&gt;
&lt;img srcset=&quot;/images/blog/convert-an-old-imac-into-a-standalone-monitor/conversion-wiring4.jpg 4x&quot; alt=&quot;Used some connectors for the P_DIM/BL_ON wires&quot;&gt;
&lt;img srcset=&quot;/images/blog/convert-an-old-imac-into-a-standalone-monitor/conversion-wiring5.jpg 4x&quot; alt=&quot;Another angle of the connectors and a better view of the bistable relay for the power button&quot;&gt;
&lt;img srcset=&quot;/images/blog/convert-an-old-imac-into-a-standalone-monitor/conversion-lcd-driver-board-wiring.jpg 4x&quot; alt=&quot;Close-up of the LCD driver board&quot;&gt;
&lt;p&gt;I used a bistable relay so the power supply turns on when the original iMac power button is pressed. Just spliced into the existing connectors after labeling them. Nice clean result.&lt;/p&gt;
&lt;img srcset=&quot;/images/blog/convert-an-old-imac-into-a-standalone-monitor/conversion-bistable-relay-wiring.jpg 3x&quot; alt=&quot;Close-up of the bistable relay with 12v (standby) and ground connected on one side and PS_ON and ground connected on the other side&quot;&gt;
&lt;p&gt;I cut a hole for the panel mount HDMI connector in the grill where the fan used to go. Not very pretty but the panel mount connector covers it all up.&lt;/p&gt;
&lt;p&gt;Also had to shave down the right-angle HDMI cable sheath so there would be enough clearance behind the panel when it&apos;s stacked up with the panel mount HDMI connecter.&lt;/p&gt;
&lt;img srcset=&quot;/images/blog/convert-an-old-imac-into-a-standalone-monitor/conversion-panel-mount-hdmi.jpg 2x&quot; alt=&quot;Panel mounted HDMI going through the old vent with a right-angle HDMI on the inside shaved down so it fits behind the LCD panel&quot;&gt;
&lt;p&gt;The little extra PCB that has the LCD controller push buttons and status LED is just tied to the memory access door on the bottom edge of the iMac for somewhat convenient access after everything is put back together. I thought about doing something more elegant on the back of the monitor with some panel mount buttons but that blows up the cost of the project. I haven&apos;t had to change any settings since setting it up anyway.&lt;/p&gt;
&lt;h2 id=&quot;final-result&quot;&gt;Final result&lt;/h2&gt;
&lt;p&gt;Using the references above, I was able to get everything up and running and it&apos;s now being used as a second monitor for a MacBook Pro 🎉&lt;/p&gt;
&lt;p&gt;It doesn&apos;t have the best brightness but perhaps that&apos;s just how these old monitors perform anyway. I don&apos;t have a good frame of reference for how the original iMac worked before I inherited the e-waste.&lt;/p&gt;
&lt;img srcset=&quot;/images/blog/convert-an-old-imac-into-a-standalone-monitor/conversion-final-result.jpg 2x&quot; alt=&quot;Old iMac from 2008 converted to be used as a standalone monitor. Hooked up as a secondary monitor to a MacBook Pro&quot;&gt;</content:encoded></item><item><title>Fixing a &quot;stuck&quot; main rolling brush on a Eufy RoboVac 25c (Robot Vacuum)</title><link>https://ericeastwood.com/blog/robot-vacuum-rolling-brush-replacement/</link><guid isPermaLink="true">https://ericeastwood.com/blog/robot-vacuum-rolling-brush-replacement/</guid><description>This guide is just meant as a light reference for others who may be trying to fix their own robot vacuum and wanting to replace the main rolling brush motor. It isn&apos;t meant to be a comprehensive guide and will probably only make sense to someone who is already familiar with electronics and debugging.
Note: I&apos;m working with a Eufy RoboVac 25C but the Eufy 11S (slim) seems to be pretty much the same vaccuum so this should apply to that as well.

Symptoms: &quot;Rolling brush is stuck&quot;
This just started out as my vacuum often stopping and giving 10 beep code. Since, I didn&apos;t have the app on my phone (no one wants that vendor spyware), I just thought the cliff sensors</description><pubDate>Mon, 13 Sep 2021 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;This guide is just meant as a light reference for others who may be trying to fix their own robot vacuum and wanting to replace the main rolling brush motor. It isn&apos;t meant to be a comprehensive guide and will probably only make sense to someone who is already familiar with electronics and debugging.&lt;/p&gt;
&lt;p&gt;Note: I&apos;m working with a &lt;strong&gt;Eufy RoboVac 25C&lt;/strong&gt; but the &lt;strong&gt;Eufy 11S (slim)&lt;/strong&gt; seems to be pretty much the same vaccuum so this should apply to that as well.&lt;/p&gt;
&lt;img srcset=&quot;/images/blog/robot-vacuum-rolling-brush-replacement/eufy-25c-robot-vacuum.png 2x&quot; alt=&quot;Eufy RoboVac 25C&quot;&gt;
&lt;h2 id=&quot;symptoms-rolling-brush-is-stuck&quot;&gt;Symptoms: &quot;Rolling brush is stuck&quot;&lt;/h2&gt;
&lt;p&gt;This just started out as my vacuum often stopping and giving 10 beep code. Since, I didn&apos;t have the app on my phone (no one wants that vendor spyware), I just thought the cliff sensors were triggering randomly on dark edges in the rug/carpet or transitions to hard surfaces. There weren&apos;t any obstructions in the main rolling brush or side brushes for me to notice something wrong either. And unfortunately, their beep sound error code feedback system doesn&apos;t distinguish between different reasons for why it stops. My first stab at solving this was covering up the cliff sensors with paper laminated in tape so the beam would just reflect back up to mimic a flat surface and never trigger. But the issue persisted!&lt;/p&gt;
&lt;p&gt;After enduring with the problem for weeks, I checked the app which was saying &quot;Rolling brush is stuck&quot;. Since there wasn&apos;t any obstruction which would normally cause that over-current protection &quot;stuck&quot; message to kick-in, the next logical step is to check the motor.&lt;/p&gt;
&lt;img srcset=&quot;/images/blog/robot-vacuum-rolling-brush-replacement/eufy-home-app-rolling-brush-is-stuck-notification.png 1x&quot; alt=&quot;EufyHome notification: Rolling brush is stuck. Turn off and remove any hair/debris caught in the rolling brush.&quot;&gt;
&lt;p&gt;Before taking it completely apart, I took out the brush and started the robot and could see that the little white square peg wasn&apos;t spinning to drive the brush. This suggests that the motor was likely stalling, causing it to heat up until it drew too much current and saved itself by shutting down.&lt;/p&gt;
&lt;img srcset=&quot;/images/blog/robot-vacuum-rolling-brush-replacement/square-peg-main-brush-drive.png 4x&quot; alt=&quot;Upside down Eufy pointing out the white square peg that drives the main rolling brush&quot;&gt;
&lt;p&gt;After taking it apart, the motor spun freely by hand but was really weak and I could easily stop it with my hands and observe the same stalling behavior (needed a little poke to get it going). To rule out the power supply as the problem, I tried hooking it up to a separate 9v battery and it had the same behavior.&lt;/p&gt;
&lt;p&gt;Popping the gear assembly out, the bigger bearing inside the assembly also felt a little scratchy which probably doesn&apos;t help with the starting force required and potentially led to the downfall of the motor in the first place.&lt;/p&gt;
&lt;p&gt;Using a flashlight to look inside the motor housing, nothing seemed burnt on the motor windings but the motor definitely seems to be the problem so I decided to order a replacement.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;As a note while you are debugging, the Eufy 25c does not work when the side brushes, main rolling brush, or suction fan are disconnected. It will just roll for about 6.5 seconds before it says one of those items are stuck and need to be checked.&lt;/p&gt;
&lt;p&gt;In the comments, there are claims that another Eufy will run with things disconnected but that doesn&apos;t seem to be the case with mine. You can also see it fault without the motor connected in this &lt;a href=&quot;https://youtu.be/Mo6kLUyUTKg?t=940&quot;&gt;YouTube video&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;teardown&quot;&gt;Teardown&lt;/h2&gt;
&lt;p&gt;In order to get to the rolling brush motor and assembly, I had to take off the bumper, bottom cover, main PCB, and suction fan. These videos from Al&apos;s Auto and Appliance were very helpful to get an idea of what to expect:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=Mo6kLUyUTKg&quot;&gt;YouTube video about how to &lt;em&gt;Disassemble Eufy Robovac For Repair FOUR BEEPS and other faults&lt;/em&gt; from &lt;em&gt;Al&apos;s Auto and Appliance&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=kISdpUdC91g&quot;&gt;YouTube video about how to &lt;em&gt;DISASSEMBLE EUFY 11S (SLIM) FOR REPAIR OR PARTS REPLACEMENT&lt;/em&gt; from &lt;em&gt;Al&apos;s Auto and Appliance&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;img srcset=&quot;/images/blog/robot-vacuum-rolling-brush-replacement/eufy-teardown.jpg 2x&quot; alt=&quot;Robot vaccuum completely disassembled&quot;&gt;
&lt;h2 id=&quot;rolling-brush-assembly&quot;&gt;Rolling brush assembly:&lt;/h2&gt;
&lt;p&gt;It&apos;s possible to buy the whole assembly on some listings but the price is pretty high and all we really need is the motor. The gearbox on the side has a couple bearings in it.&lt;/p&gt;
&lt;p&gt;Bearing sizes for reference:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Bigger bearing: 6800RS - 19mm OD, 10mm ID, 5mm thick&lt;/li&gt;
&lt;li&gt;Smaller bearing: 11mm OD&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;em&gt;(photos from this &lt;a href=&quot;https://www.ebay.com/itm/294263688330&quot;&gt;&quot;Eufy 11S Robot Vacuum Main Brush Motor &amp;#x26; Assembly&quot; ebay listing&lt;/a&gt; but it looks the exact same as mine)&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;img srcset=&quot;/images/blog/robot-vacuum-rolling-brush-replacement/rolling-brush-assembly1.jpg 4x&quot; alt=&quot;Rolling brush assembly (profile angle)&quot;&gt; &lt;img srcset=&quot;/images/blog/robot-vacuum-rolling-brush-replacement/rolling-brush-assembly4.jpg 4x&quot; alt=&quot;Rolling brush assembly (gearbox side angle)&quot;&gt; &lt;img srcset=&quot;/images/blog/robot-vacuum-rolling-brush-replacement/rolling-brush-assembly-motor.jpg 4x&quot; alt=&quot;Rolling brush assembly motor&quot;&gt;&lt;br&gt;
&lt;img srcset=&quot;/images/blog/robot-vacuum-rolling-brush-replacement/rolling-brush-assembly3.jpg 4x&quot; alt=&quot;Rolling brush assembly (backside with hole to dust bin)&quot;&gt; &lt;img srcset=&quot;/images/blog/robot-vacuum-rolling-brush-replacement/rolling-brush-assembly5.jpg 4x&quot; alt=&quot;Rolling brush assembly (long ways angle)&quot;&gt;&lt;img srcset=&quot;/images/blog/robot-vacuum-rolling-brush-replacement/rolling-brush-assembly2.jpg 4x&quot; alt=&quot;Rolling brush assembly (backside angle)&quot;&gt;&lt;/p&gt;
&lt;h3 id=&quot;main-rolling-brush-motor&quot;&gt;Main rolling brush motor:&lt;/h3&gt;
&lt;p&gt;The motor is supplied with 9v (measured directly with a multimeter). I could observe that when it rose to 10v, it seemed to trigger the over-current brush stuck error. I would assume it actually looks at the current vs the voltage though.&lt;/p&gt;
&lt;p&gt;Motor part number:&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;Standard Motor&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;rp390-st/20143/dv&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;GMCD070717&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;img srcset=&quot;/images/blog/robot-vacuum-rolling-brush-replacement/standard-motor-engraving-close-up.jpg 2x&quot; alt=&quot;Main rolling brush motor close-up of the engraving label on the side&quot;&gt;
&lt;p&gt;Which we can find on the Standard Motor website via &lt;a href=&quot;http://www.standardmotor.net/product-category/home/home_6/?lang=en#top&quot;&gt;http://www.standardmotor.net/product-category/home/home_6/?lang=en#top&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I was able to find some listings on AliExpress that looked slightly different than mine but they have the same part number so I assumed it would be fine. These motors have a PCB on the back with a connector instead of just exposing some tabs. The listings say that these work for &lt;code&gt;Eufy Robvac 11S Max 12 15C 15C Max 25C 30 30C Max 39C Max Coredy Robot Vacuum Cleaner R3500, R3500S&lt;/code&gt;. My best luck was just searching for &lt;code&gt;Eufy 11S brush motor&lt;/code&gt;.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.aliexpress.com/item/1005003078293930.html&quot;&gt;https://www.aliexpress.com/item/1005003078293930.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.aliexpress.com/item/4001187896502.html&quot;&gt;https://www.aliexpress.com/item/4001187896502.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.aliexpress.com/item/1005001893922698.html&quot;&gt;https://www.aliexpress.com/item/1005001893922698.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.aliexpress.com/item/1005001893926920.html&quot;&gt;https://www.aliexpress.com/item/1005001893926920.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.aliexpress.com/item/1005001897452931.html&quot;&gt;https://www.aliexpress.com/item/1005001897452931.html&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;img srcset=&quot;/images/blog/robot-vacuum-rolling-brush-replacement/standard-motor-replacement.png 1.5x&quot; alt=&quot;Replacement motor listing&quot;&gt;
&lt;h2 id=&quot;replacing-the-motor&quot;&gt;Replacing the motor&lt;/h2&gt;
&lt;p&gt;I ordered one of the main rolling brush motors above. The PCB on the back of the motor interfered with the plastic on the Eufy 25c but I just cut off the connector and part of the PCB to make it fit and soldered directly to the PCB.&lt;/p&gt;
&lt;p&gt;I also replaced the bigger bearing in the brush assembly since it felt a little crunchy.&lt;/p&gt;
&lt;p&gt;The new motor is much stronger than the defective one! Eufy is once again rolling around picking everything up 🎉&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update 2023-11-10:&lt;/strong&gt; The new main rolling brush motor is still going strong but the side brush motors are failing now (not causing any &quot;stuck&quot; problems though). Will write a blog post if I ever get around to that but it&apos;s time for a new robot vacuum anyway so I&apos;m holding off. Hopefully some more new dual brush options become available now that iRobot&apos;s Roomba patent has expired.&lt;/p&gt;
&lt;h2 id=&quot;keywords&quot;&gt;Keywords&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Main rolling brush (roller brush)&lt;/li&gt;
&lt;li&gt;Side brushes&lt;/li&gt;
&lt;li&gt;Drop sensors (cliff sensors)&lt;/li&gt;
&lt;li&gt;Bumper&lt;/li&gt;
&lt;/ul&gt;</content:encoded></item><item><title>Gitter now speaks Matrix</title><link>https://ericeastwood.com/blog/gitter-now-speaks-matrix/</link><guid isPermaLink="true">https://ericeastwood.com/blog/gitter-now-speaks-matrix/</guid><description>Connecting Gitter to the Matrix network (native feeling Matrix bridging). All public Gitter rooms are available via Matrix, and all Gitter users natively exist on Matrix which means you can chat back and forth transparently between users on the Gitter side and the Matrix side. Burning down the list of impedance mismatch between each platform so edits, replies, emoji, markdown, etc all look seamless. Going over how we iteratively tackled this kind of bridging to an existing legacy system without any concept of bridging before-hand. We live in exciting times: open standards-based interoperable communication is on the rise again, and we hope Gitter’s new life in Matrix is the beginning of a new age of cross-project developer collaboration, at last</description><pubDate>Mon, 07 Dec 2020 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Connecting Gitter to the Matrix network (native feeling Matrix bridging). All public Gitter rooms are available via Matrix, and all Gitter users natively exist on Matrix which means you can chat back and forth transparently between users on the Gitter side and the Matrix side. Burning down the list of impedance mismatch between each platform so edits, replies, emoji, markdown, etc all look seamless. Going over how we iteratively tackled this kind of bridging to an existing legacy system without any concept of bridging before-hand. We live in exciting times: open standards-based interoperable communication is on the rise again, and we hope Gitter’s new life in Matrix is the beginning of a new age of cross-project developer collaboration, at last escaping the fragmentation we’ve suffered over the last few years.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://matrix.org/blog/2020/12/07/gitter-now-speaks-matrix/&quot;&gt;Read the rest on the Matrix blog&lt;/a&gt;.&lt;/p&gt;</content:encoded></item><item><title>Gitter Logo LED Sign Build Log</title><link>https://ericeastwood.com/blog/gitter-logo-led-sign-build-log/</link><guid isPermaLink="true">https://ericeastwood.com/blog/gitter-logo-led-sign-build-log/</guid><description>I wanted more lighting around the apartment and was inspired by the lines that my blinds made on the wall on a sunny day which kinda match the Gitter logo (I work at Gitter/GitLab).
Boiled down, this project is some internet of things(IoT) connected LEDs.


Lines on the wall created by the blinds that inspired the sign,

Parts (bill of materials)
Electronics

Beaglebone Black (rev. B), https://www.adafruit.com/product/1996
USB battery bank, https://www.amazon.com/gp/product/B00L88VP3Y

It&apos;s important to make sure that it can be charged and power another device at the same time because it will act as a universal power supply(UPS) for the Beaglebone Black so that it won&apos;t get corrupted if the power is cut.


400w, 1u power supply, https://www.amazon.com/gp/product/B014G2OUG2

Any reliable slim power supply, &amp;#x3C;1.5&quot; tall. I chose a 1u</description><pubDate>Sun, 08 Jul 2018 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;I wanted more lighting around the apartment and was inspired by the lines that my blinds made on the wall on a sunny day which kinda match the &lt;a href=&quot;https://gitter.im/&quot;&gt;Gitter&lt;/a&gt; logo (I work at Gitter/GitLab).&lt;/p&gt;
&lt;p&gt;Boiled down, this project is some internet of things(IoT) connected LEDs.&lt;/p&gt;
&lt;img srcset=&quot;/images/blog/gitter-logo-led-sign-build-log/eric-gitter-sign.jpg 3x&quot; alt=&quot;Eric standing in front of the Gitter sign&quot;&gt;
&lt;hr&gt;
&lt;p&gt;Lines on the wall created by the blinds that inspired the sign,&lt;/p&gt;
&lt;img srcset=&quot;/images/blog/gitter-logo-led-sign-build-log/light-through-blinds.png 2x&quot; alt=&quot;Light coming through the blinds making similar lines to how the Gitter logo looks&quot;&gt;
&lt;h1 id=&quot;parts-bill-of-materials&quot;&gt;Parts (bill of materials)&lt;/h1&gt;
&lt;h3 id=&quot;electronics&quot;&gt;Electronics&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Beaglebone Black (rev. B), &lt;a href=&quot;https://www.adafruit.com/product/1996&quot;&gt;https://www.adafruit.com/product/1996&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;USB battery bank, &lt;a href=&quot;https://www.amazon.com/gp/product/B00L88VP3Y&quot;&gt;https://www.amazon.com/gp/product/B00L88VP3Y&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;It&apos;s important to make sure that it can be charged and power another device at the same time because it will act as a universal power supply(UPS) for the Beaglebone Black so that it won&apos;t get corrupted if the power is cut.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;400w, 1u power supply, &lt;a href=&quot;https://www.amazon.com/gp/product/B014G2OUG2&quot;&gt;https://www.amazon.com/gp/product/B014G2OUG2&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;Any reliable slim power supply, &amp;#x3C;1.5&quot; tall. I chose a 1u server form-factor power supply because it is about 1.5&quot; tall.&lt;/li&gt;
&lt;li&gt;I went with a name-brand PC power supply because anything I have tried from eBay has eventually popped. Suggestions welcome!&lt;/li&gt;
&lt;li&gt;This power supply is quiet but not completely silent even without a load.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;RGBW LED strip (4 meters), &lt;a href=&quot;https://www.adafruit.com/product/2439&quot;&gt;https://www.adafruit.com/product/2439&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;My strips were not individually addressable&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;4x IRLB8721P power MOSFETs (NPN transistors), &lt;a href=&quot;https://www.adafruit.com/product/355&quot;&gt;https://www.adafruit.com/product/355&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://cdn-shop.adafruit.com/datasheets/irlb8721pbf.pdf&quot;&gt;https://cdn-shop.adafruit.com/datasheets/irlb8721pbf.pdf&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Mini fans for cooling
&lt;ul&gt;
&lt;li&gt;I used 12v fans and ran them at 7v by connecting them to a molex connector 5v(red) and 12v(yellow) pins to reduce the noise (&lt;code&gt;12 - 5 = 7&lt;/code&gt;, voltage is relative).&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Female-to-female ethernet adapter
&lt;ul&gt;
&lt;li&gt;Used so you can plug in an ethernet to the bottom of the sign and pass-through to the Beaglebone Black&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Mountable &lt;a href=&quot;/images/blog/gitter-logo-led-sign-build-log/iec320-c14-female-power-connector.png&quot;&gt;female PC power connector (IEC320 C14)&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;a href=&quot;/images/blog/gitter-logo-led-sign-build-log/iec320-c13-male-power-connector.png&quot;&gt;male power cord side is called IEC320 C13&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Momentary push button (power button for Beaglebone Black)&lt;/li&gt;
&lt;li&gt;On/off switch (for power supply)&lt;/li&gt;
&lt;li&gt;Protoboard
&lt;ul&gt;
&lt;li&gt;Used for the power MOSFET circuit.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Crimp connectors&lt;/li&gt;
&lt;li&gt;4 or 5-pin JST connectors
&lt;ul&gt;
&lt;li&gt;Used to easily connect LED strips to the power MOSFET circuit&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Various resistors&lt;/li&gt;
&lt;li&gt;Various wire&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;physicalother&quot;&gt;Physical/other&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Sheet of 1/2&quot; MDF wood&lt;/li&gt;
&lt;li&gt;Aluminum LED U-channel (&gt;3.328m), &lt;a href=&quot;https://www.amazon.com/gp/product/B00VUAYFPK&quot;&gt;https://www.amazon.com/gp/product/B00VUAYFPK&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;Used to better diffuse the light&lt;/li&gt;
&lt;li&gt;Search for &quot;LED channel&quot;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Dust filter for air intake
&lt;ul&gt;
&lt;li&gt;Search &quot;dust filter&quot; on eBay -&gt; Buy it now -&gt; &quot;Price + Shipping: lowest first&quot;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Velcro
&lt;ul&gt;
&lt;li&gt;Used to attach the LED strips to the U-channel&lt;/li&gt;
&lt;li&gt;There is a slot for the LED strip to slide into the U-channel but I wanted to leave the plastic sheath on the LED strips&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Spray Paint
&lt;ul&gt;
&lt;li&gt;I used a Krylon white base and primer layer with Krylon Mamboo Pink on top (2-3 of each)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Hanging hooks, &lt;a href=&quot;https://www.amazon.com/gp/product/B000CSN35E/&quot;&gt;https://www.amazon.com/gp/product/B000CSN35E/&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;I used two of the 30lb hooks&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id=&quot;sign-construction&quot;&gt;Sign construction&lt;/h1&gt;
&lt;p&gt;The sign is made of 1/2&quot; MDF wood and measures 1 meter x 1 meter and is 5cm deep. It&apos;s a simple 45deg corner box with an angled hanging bracket spanning across the entire width. The hanging bracket was angled just right for our hanging hooks to sit as flat and flash as possible against the wall.&lt;/p&gt;
&lt;p&gt;The Gitter logo bars are split into two because I couldn&apos;t find LED channel that was wide-enough at this big of a proportion.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/gitter-logo-led-sign-build-log/gitter-logo-dimensions.png&quot; alt=&quot;Diagram of the Gitter logo sign dimensions&quot;&gt; &lt;img srcset=&quot;/images/blog/gitter-logo-led-sign-build-log/sign-constructed-back.jpg 3x&quot; alt=&quot;Showing off the constructed back of the sign made out of MDF wood&quot;&gt; &lt;img srcset=&quot;/images/blog/gitter-logo-led-sign-build-log/aluminum-channel-layout.png 3x&quot; alt=&quot;Showing off a pencil outline of where the aluminum channel LED strips will go on the front of the sign for easy layout and to get an idea of how things will look&quot;&gt;&lt;/p&gt;
&lt;p&gt;I ended up cutting these holes bigger with a &lt;a href=&quot;/images/blog/gitter-logo-led-sign-build-log/keyhole-jab-saw.png&quot;&gt;keyhole/jab saw&lt;/a&gt; so I could feed the whole LED connector through the hole instead of soldering the connector after feeding the wires through. This makes maintenance easier because I can remove a whole strip and work on it on my desk instead of directly on the sign.&lt;/p&gt;
&lt;img srcset=&quot;/images/blog/gitter-logo-led-sign-build-log/painted-sign.png 2x&quot; alt=&quot;The Gitter sign is now painted red/pink with some holes drilled to screw the aluminum channel through and run some wires&quot;&gt;
&lt;p&gt;I used an old ladder to hang the sign while working on it.&lt;/p&gt;
&lt;img srcset=&quot;/images/blog/gitter-logo-led-sign-build-log/gitter-sign-on-ladder.png 3x&quot; alt=&quot;Showing off how I hung the sign on an old ladder to make it easier to work on before it ends up on the wall&quot;&gt;
&lt;h2 id=&quot;painting&quot;&gt;Painting&lt;/h2&gt;
&lt;p&gt;To get the signature Gitter ruby/pink, &lt;code&gt;#ed1965&lt;/code&gt;, I used a Krylon white base/primer layer with Krylon Mamboo Pink on top. I used 2-4 spray cans of each color to get full coverage on the sign.&lt;/p&gt;
&lt;p&gt;&lt;img srcset=&quot;/images/blog/gitter-logo-led-sign-build-log/paint-combinations.png 3x&quot; alt=&quot;Testing the right paint combinations, Krylon white paint/primer and Krylon Mambo Pink&quot;&gt; &lt;img srcset=&quot;/images/blog/gitter-logo-led-sign-build-log/back-of-sign-rats-nest.png 3x&quot; alt=&quot;Comparing just the pink vs a base of primer and pink on top to the Gitter Android app color on my phone&quot;&gt;&lt;/p&gt;
&lt;h2 id=&quot;electronics-1&quot;&gt;Electronics&lt;/h2&gt;
&lt;h3 id=&quot;the-brains&quot;&gt;The brains&lt;/h3&gt;
&lt;p&gt;I used a BeagleBone Black(BBB, small Linux system like a Raspberry Pi) to control everything which allows me control the sign over the network and run any necessary smart server directly on the device. If you need some help setting up your Beaglebone Black and getting started, see &lt;a href=&quot;/blog/beaglebone-black-ubuntu-getting-started&quot;&gt;my previous article&lt;/a&gt;. Currently, I just SSH into the BBB and run a Node.js script to adjust the LEDs.&lt;/p&gt;
&lt;p&gt;The BeagleBone Black plugs into the USB battery bank which acts like an uninterruptible power supply (UPS). I run an ethernet cable from the BBB to a female-to-female ethernet adapter at the bottom of the sign. This makes it easy to connect/disconnect a separate ethernet cable at the bottom of the sign that goes off to the router/switch when the sign is hung up against a wall.&lt;/p&gt;
&lt;p&gt;I also added an illuminated power button to the bottom of the sign for the BBB specifically. This is useful when you want to turn off the sign but you already put your computer to sleep and can&apos;t SSH into the sign. Or if you accidentally ran the shutdown Linux command and need to turn it back on. See the &lt;code&gt;PWR_BUT&lt;/code&gt; pin for the button and &lt;code&gt;SYS_5V&lt;/code&gt; pin for the LED.&lt;/p&gt;
&lt;p&gt;&lt;img srcset=&quot;/images/blog/gitter-logo-led-sign-build-log/grill-intake-fans.png 2x&quot; alt=&quot;A rats nest of wires on the back of the sign with a slim PC power supply connected to the USB battery bank and then to the Beaglebone Black. Ethernet connected from the Beaglebone Black to the outside with a female receptacle to have a clean look and easy hook-up on the outside.&quot;&gt; &lt;img srcset=&quot;/images/blog/gitter-logo-led-sign-build-log/intake-grill-hole-pattern.png 2x&quot; alt=&quot;Showing off the cut-outs on the bottom of the sign for the cables and controls to run in and out from. From left to right, a the wall power cable for the power supply, a power switch, the ethernet port, and a power/reset push button for the BeagleBone black&quot;&gt;&lt;/p&gt;
&lt;h4 id=&quot;ups-battery-bank-powering-off&quot;&gt;UPS Battery bank powering off&lt;/h4&gt;
&lt;p&gt;I used a USB battery bank as a universal power supply(UPS) for the Beaglebone Black so that it wouldn&apos;t get corrupted if the power was cut.&lt;/p&gt;
&lt;p&gt;The battery bank powers itself off if you don&apos;t draw enough current and you need to push the power button the battery bank to turn it back on again. Since I wouldn&apos;t have access to the power button when it is inside the sign against the wall, I ended up soldering a switch alongside to the existing momentary push button. This acts like the power button is always being pushed and keeps things rolling.&lt;/p&gt;
&lt;p&gt;To reduce the power consumption and get rid of the needless light, I desoldered the LED backlight that is otherwise always on.&lt;/p&gt;
&lt;img srcset=&quot;/images/blog/gitter-logo-led-sign-build-log/usb-battery-bank-no-backlight.png 2x&quot; alt=&quot;Disassembled USB battery bank with the backlight off while still running&quot;&gt;
&lt;p&gt;Other people on the web have pulsed some resistors/LEDs every 5 seconds to get the current threshold met but that seemed a lot more complicated.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://forum.pjrc.com/threads/28624-USB-Battery-Bank-Prevent-Shut-Down&quot;&gt;https://forum.pjrc.com/threads/28624-USB-Battery-Bank-Prevent-Shut-Down&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.instructables.com/id/USB-External-Battery-Packs-on-Arduino-turns-OFF/&quot;&gt;http://www.instructables.com/id/USB-External-Battery-Packs-on-Arduino-turns-OFF/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;leds-and-wiring&quot;&gt;LEDs and wiring&lt;/h3&gt;
&lt;p&gt;The LEDs are driven by &lt;a href=&quot;https://www.adafruit.com/product/355&quot;&gt;IRLB8721P power MOSFETs (NPN transistors)&lt;/a&gt; and powered by a &lt;a href=&quot;#power-supply-psu&quot;&gt;slim 400w server(1u) power supply&lt;/a&gt;. I wanted to control each LED strip and color independently but the Beaglebone Black doesn&apos;t have enough PWM pins so I ended up tieing all of the strips together and only have control of the color overall.&lt;/p&gt;
&lt;p&gt;I used the &lt;a href=&quot;/images/blog/gitter-logo-led-sign-build-log/led-mosfet-wiring-diagram.png&quot;&gt;same wiring setup for the MOSFETs and LEDs&lt;/a&gt; as this &lt;a href=&quot;https://learn.adafruit.com/rgb-led-strips/usage&quot;&gt;Adafruit guide for the analog LED strips&lt;/a&gt; shows. I also referenced this &lt;a href=&quot;https://electronics.stackexchange.com/a/68754/11915&quot;&gt;Electronics Stack Exchange answer about including a gate resistor&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;In order to get the LED strips to lay flat, feed through the back of the sign, and not stick out from the aluminum channels, I had to solder the connector wires on the backside of the LED strip.&lt;/p&gt;
&lt;p&gt;The LED strips are velcroed to the aluminum channel because I didn&apos;t want to remove the weatherproof sheath and it makes it easier to connect/disconnect from the sign. The adhesive backing of the velcro I used doesn&apos;t hold very well so I have to touch-up the sign whenever I notice one of the strips floating closer to the LED channel diffuser (bright spots).&lt;/p&gt;
&lt;p&gt;&lt;img srcset=&quot;/images/blog/gitter-logo-led-sign-build-log/velcro-tape.png 3x&quot; alt=&quot;Rolls of velcro tape with a sticky side to attach the LED strips to the aluminum channel&quot;&gt; &lt;img srcset=&quot;/images/blog/gitter-logo-led-sign-build-log/led-strip-velcroed-to-aluminum-channel.png 2x&quot; alt=&quot;Showing off how the velcro is used to stick the LED strips to the back of the aluminum channel to keep them flat and even&quot;&gt;&lt;/p&gt;
&lt;p&gt;I used some tape to keep wire bundles tidy and tied down to the sign.&lt;/p&gt;
&lt;h4 id=&quot;cutting-led-strips-at-a-non-segment&quot;&gt;Cutting LED strips at a non-segment&lt;/h4&gt;
&lt;p&gt;Most LED strips can only be trimmed at specific segments/intervals. In my case, it was every 3 LEDs. Because I needed to cut the LED strip in between a segment to get a custom length, I had to manually complete the circuit so the LEDs would turn on again. I couldn&apos;t find a schematic available online, so I desoldered all the components from a segment and peeled off the white solder mask to see what how the copper traces were connected (peeling worked much better than scraping it off).&lt;/p&gt;
&lt;img srcset=&quot;/images/blog/gitter-logo-led-sign-build-log/led-strip-traces-no-solder-mask.png 1x&quot; alt=&quot;A segment from the LED strip with all of the solder mask removed so you can see how the traces are connected to each other&quot;&gt;
&lt;p&gt;Because I unknowingly cut some strips at different ends, I also had to wire them up differently. Here are the two variations and as you can see the first one is easier to wire up because everything connects to positive,&lt;/p&gt;
&lt;img srcset=&quot;/images/blog/gitter-logo-led-sign-build-log/cut-led-strip-with-manual-connections.png 2x&quot; alt=&quot;A LED strip with one LED cut off the 3-LED segments with some DIY wiring and resistors to reconnect the missing connections that were chopped off to get the right length for the sign&quot;&gt;
&lt;img srcset=&quot;/images/blog/gitter-logo-led-sign-build-log/cut-led-strip-with-manual-connections2.png 2x&quot; alt=&quot;Another variation of an LED strip cut at a non specified segment and needing more DIY connections&quot;&gt;
&lt;h4 id=&quot;accidentally-connecting-mosfet-heatsinks&quot;&gt;Accidentally connecting MOSFET heatsinks&lt;/h4&gt;
&lt;p&gt;Because I spaced the MOSFETs too close to each other, some of the MOSFET heatsink tabs were connected. This meant that any time either transistor gate for the blue or green LED channel were triggered, both drained. In a future iteration, I would space them apart which would also make adding heatsinks easier (see &quot;Heating&quot; section below).&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/gitter-logo-led-sign-build-log/mosfet-diagram.png&quot; alt=&quot;MOSFET diagram showing off each part; gate, drain source&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://oscarliang.com/how-to-use-MOSFET-beginner-tutorial/&quot;&gt;&lt;em&gt;Image courtesy of Oscar Liang&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;
&lt;img srcset=&quot;/images/blog/gitter-logo-led-sign-build-log/mosfets-on-protoboard.png 3x&quot; alt=&quot;Some protoboard with some MOSFETS connected to each color channel of the LED strips and some connectors. The MOSFETS are next to each other and the heatsinks are touching&quot;&gt;
&lt;p&gt;This was easily fixed by bending them at different angles so they no longer touched,&lt;/p&gt;
&lt;img srcset=&quot;/images/blog/gitter-logo-led-sign-build-log/mosfets-bent-on-protoboard.png 3x&quot; alt=&quot;Showing how I bent the MOSFETS in different directions so they no longer touch&quot;&gt;
&lt;h3 id=&quot;power-supply-psu&quot;&gt;Power supply (PSU)&lt;/h3&gt;
&lt;p&gt;I chose a slim 1u server form-factor power supply because it is about 1.5&quot; tall. But it was still a little bit too tall so I used a chisel to carve out a little pocket in the MDF wood. I attached it via the 2 convenient screw holes on one side and some velcro on the bottom of the other side.&lt;/p&gt;
&lt;img srcset=&quot;/images/blog/gitter-logo-led-sign-build-log/slim-pc-power-supply-mounted.png 3x&quot; alt=&quot;Slim PC power supply inset in the back in a spot I chiseled so the it fits back there&quot;&gt;
&lt;p&gt;The power supply cable runs down to same &lt;a href=&quot;/images/blog/gitter-logo-led-sign-build-log/iec320-c14-female-power-connector.png&quot;&gt;female PC power connector (IEC320 C14)&lt;/a&gt; that is mounted at the bottom of the sign so I can easily connect a separate cable when the sign is hung up against a wall. I added a half of a paper cup around this wiring because I shocked myself while testing.&lt;/p&gt;
&lt;p&gt;There is also a toggle switch to turn off the PSU. The switch is connected to pin 14(green) and 15(black ground) on the 24-pin power supply connector (Google &quot;convert pc power supply into bench&quot; for more info).&lt;/p&gt;
&lt;p&gt;&lt;img srcset=&quot;/images/blog/gitter-logo-led-sign-build-log/power-supply-wiring.png 2x&quot; alt=&quot;Showing off the wiring of the power supply and connectors on the bottom&quot;&gt; &lt;img srcset=&quot;/images/blog/gitter-logo-led-sign-build-log/intake-grill-hole-pattern.png 2x&quot; alt=&quot;Showing off the cut-outs on the bottom of the sign for the cables and controls to run in and out from. From left to right, a the wall power cable for the power supply, a power switch, the ethernet port, and a power/reset push button for the BeagleBone black&quot;&gt;&lt;/p&gt;
&lt;h3 id=&quot;heating-and-airflow&quot;&gt;Heating and airflow&lt;/h3&gt;
&lt;p&gt;The MOSFETs get pretty hot so I added mini aluminum heatsinks to both sides of the metal tabs. The close spacing and different angles made this tricky.&lt;/p&gt;
&lt;p&gt;Airflow wise, I channeled the power supply fan air directly outside and pointed some mini fans towards the MOSFETs which generate the most heat overall. I also added a fan to the hanging bracket so air could more quickly rise up and out of the sign.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/MadLittleMods/airflow-fluid-simulator/&quot;&gt;&lt;em&gt;Airflow diagram created with this project&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/gitter-logo-led-sign-build-log/airflow-animation.gif&quot; alt=&quot;Airflow animation behind the sign on how things are expected to stay cool&quot;&gt;&lt;/p&gt;
&lt;p&gt;For the in-take fans on the side of the sign, I used Gaffers tape to channel the air through a removable metal dust filter cut from a cheap PC fan filter.&lt;/p&gt;
&lt;p&gt;&lt;img srcset=&quot;/images/blog/gitter-logo-led-sign-build-log/intake-fans-ducting.png 3x&quot; alt=&quot;In-take fans on the side with some DIY ducting with some tape&quot;&gt; &lt;img srcset=&quot;/images/blog/gitter-logo-led-sign-build-log/intake-fans-grill.png 2x&quot; alt=&quot;Showing the 5 hole pattern grill on the outside of the sign for the in-take to draw from&quot;&gt;&lt;/p&gt;
&lt;p&gt;I verified that things weren&apos;t getting too hot by using some helping hands to hold a thermocouple on the MOSFETs.&lt;/p&gt;
&lt;img srcset=&quot;/images/blog/gitter-logo-led-sign-build-log/temperature-probe-testing.png 2x&quot; alt=&quot;Using some helping hands to hold a temperature probe on the MOSFTs to check if they are getting too hot&quot;&gt;
&lt;h2 id=&quot;code&quot;&gt;Code&lt;/h2&gt;
&lt;p&gt;Here is the basic Node.js script that runs on the Beaglebone Black and makes a nice warm glow.&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;bone&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;require&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;bonescript&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;maxBrightness&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0.35&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #E45649&quot;&gt;bone&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;pinMode&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;P9_14&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;bone&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;OUTPUT&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #E45649&quot;&gt;bone&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;pinMode&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;P9_16&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;bone&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;OUTPUT&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #E45649&quot;&gt;bone&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;pinMode&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;P8_13&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;bone&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;OUTPUT&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #E45649&quot;&gt;bone&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;pinMode&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;P8_19&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;bone&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;OUTPUT&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;toggleBrightness&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(r,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;g,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;b,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;w)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;bone&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;analogWrite&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;P9_14&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;r,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2000&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;printStatus);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;bone&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;analogWrite&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;P9_16&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;g,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2000&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;printStatus);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;bone&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;analogWrite&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;P8_13&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;b,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2000&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;printStatus);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;bone&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;analogWrite&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;P8_19&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;w,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2000&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;printStatus);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;toggleBrightness&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(maxBrightness&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0.2&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;maxBrightness&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0.2&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;maxBrightness&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0.2&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;maxBrightness&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;printStatus&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(x)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;console&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;log&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;JSON&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;stringify&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(x));&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For testing, &lt;code&gt;rgb-cli.js&lt;/code&gt;, &lt;code&gt;node rgb-cli.js --red=0.5 --green=0 --blue=1 --warm_white=1&lt;/code&gt;&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;bone&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;require&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;bonescript&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;argv&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;require&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;yargs&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;).&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;argv&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;maxBrightness&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #E45649&quot;&gt;bone&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;pinMode&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;P9_14&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;bone&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;OUTPUT&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #E45649&quot;&gt;bone&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;pinMode&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;P9_16&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;bone&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;OUTPUT&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #E45649&quot;&gt;bone&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;pinMode&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;P8_13&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;bone&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;OUTPUT&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #E45649&quot;&gt;bone&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;pinMode&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;P8_19&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;bone&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;OUTPUT&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;toggleBrightness&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(r,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;g,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;b,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;w)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;bone&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;analogWrite&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;P9_14&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;r,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2000&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;printStatus);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;bone&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;analogWrite&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;P9_16&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;g,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2000&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;printStatus);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;bone&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;analogWrite&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;P8_13&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;b,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2000&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;printStatus);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;bone&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;analogWrite&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;P8_19&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;w,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2000&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;printStatus);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;red&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;parseFloat&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;argv&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;red&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;||&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;green&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;parseFloat&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;argv&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;green&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;||&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;blue&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;parseFloat&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;argv&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;blue&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;||&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;warmWhite&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;parseFloat&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;argv&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;warm_white&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;||&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #E45649&quot;&gt;console&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;log&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;RGBW&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;red,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;green,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;blue,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;warmWhite);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;toggleBrightness&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;red&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;maxBrightness,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;green&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;maxBrightness,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;blue&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;maxBrightness,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;warmWhite&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;maxBrightness,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;printStatus&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(x)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;console&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;log&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;JSON&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;stringify&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(x));&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Here is a script to turn the lights off, &lt;code&gt;off.js&lt;/code&gt;&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;bone&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;require&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;bonescript&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;maxBrightness&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #E45649&quot;&gt;bone&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;pinMode&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;P9_14&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;bone&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;OUTPUT&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #E45649&quot;&gt;bone&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;pinMode&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;P9_16&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;bone&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;OUTPUT&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #E45649&quot;&gt;bone&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;pinMode&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;P8_13&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;bone&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;OUTPUT&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #E45649&quot;&gt;bone&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;pinMode&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;P8_19&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;bone&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;OUTPUT&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;toggleBrightness&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(r,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;g,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;b,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;w)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;bone&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;analogWrite&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;P9_14&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;r,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2000&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;printStatus);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;bone&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;analogWrite&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;P9_16&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;g,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2000&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;printStatus);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;bone&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;analogWrite&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;P8_13&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;b,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2000&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;printStatus);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;bone&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;analogWrite&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;P8_19&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;w,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2000&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;printStatus);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;toggleBrightness&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(maxBrightness,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;maxBrightness,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;maxBrightness,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;maxBrightness);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;printStatus&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(x)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;console&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;log&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;JSON&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;stringify&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(x));&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h4 id=&quot;low-frequency--high-period-bugs&quot;&gt;Low frequency = High period bugs&lt;/h4&gt;
&lt;p&gt;When using a small frequency value&lt;br&gt;
with &lt;a href=&quot;http://beagleboard.org/support/bonescript/analogWrite&quot;&gt;&lt;code&gt;analogWrite(pinString, dutyCycle, frequencyHz, callback)&lt;/code&gt;&lt;/a&gt;,&lt;br&gt;
the following error can be thrown, see &lt;a href=&quot;https://gist.github.com/MadLittleMods/fbd0a55b3470bffa06a3759a6aa45c5e&quot;&gt;https://gist.github.com/MadLittleMods/fbd0a55b3470bffa06a3759a6aa45c5e&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;future-plans&quot;&gt;Future plans&lt;/h2&gt;
&lt;p&gt;In the future, it would be cool to hook this up to the &lt;a href=&quot;https://developer.gitter.im/docs/welcome&quot;&gt;Gitter API&lt;/a&gt; so that the color changes based on unreads(green)/mentions(orange).&lt;/p&gt;</content:encoded></item><item><title>Our journey in switching to native Unicode emoji</title><link>https://ericeastwood.com/blog/journey-in-native-unicode-emoji/</link><guid isPermaLink="true">https://ericeastwood.com/blog/journey-in-native-unicode-emoji/</guid><description>Unicode is hard. Here&apos;s a guide to getting native Unicode Emoji right.
The switch from image-based emoji to native Unicode wasn&apos;t a straightforward journey and included many intricacies to get production ready. Support varies widely on each OS, even between the browsers on the OS. We also wanted to support falling back to image-based emoji for environments that do not support everything yet, otherwise people would see black squares. As a simple example, most Linux environments do not have Unicode emoji support unless you manually install a font. I consider this blog post the survival manual I wish I had had when implementing native Unicode emoji myself.
Read the rest on the GitLab blog.</description><pubDate>Wed, 30 May 2018 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Unicode is hard. Here&apos;s a guide to getting native Unicode Emoji right.&lt;/p&gt;
&lt;p&gt;The switch from image-based emoji to native Unicode wasn&apos;t a straightforward journey and included many intricacies to get production ready. Support varies widely on each OS, even between the browsers on the OS. We also wanted to support falling back to image-based emoji for environments that do not support everything yet, otherwise people would see black squares. As a simple example, most Linux environments do not have Unicode emoji support unless you manually install a font. I consider this blog post the survival manual I wish I had had when implementing native Unicode emoji myself.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://about.gitlab.com/2018/05/30/journey-in-native-unicode-emoji/&quot;&gt;Read the rest on the GitLab blog&lt;/a&gt;.&lt;/p&gt;</content:encoded></item><item><title>Play sound and auto-reply when Google Hangouts text message received - Tasker Guide</title><link>https://ericeastwood.com/blog/play-sound-and-auto-reply-when-google-hangouts-text-message-received-tasker-guide/</link><guid isPermaLink="true">https://ericeastwood.com/blog/play-sound-and-auto-reply-when-google-hangouts-text-message-received-tasker-guide/</guid><description>This guide will go over how to play a sound/alarm/ding and auto-reply when you receive a certain SMS/text message from the Google Hangouts app. The sound will also play regardless of your do not disturb, sleep hours, silence settings.
I needed this so my family could wake me up in case of emergency or if I ever overslept when we were supposed to get together. I have been using this setup since July 2016 it has been working great. I have used this on a Moto E (Android 5) and a Google Pixel (Android 7 and 8) with Google Voice.
The phone on the right has Tasker running and the left phone sends a standard text message.

     </description><pubDate>Sun, 14 Jan 2018 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;This guide will go over how to play a sound/alarm/ding and auto-reply when you receive a certain SMS/text message from the &lt;a href=&quot;https://play.google.com/store/apps/details?id=com.google.android.talk&quot;&gt;Google Hangouts app&lt;/a&gt;. The sound will also play regardless of your do not disturb, sleep hours, silence settings.&lt;/p&gt;
&lt;p&gt;I needed this so my family could wake me up in case of emergency or if I ever overslept when we were supposed to get together. I have been using this setup since July 2016 it has been working great. I have used this on a Moto E (Android 5) and a Google Pixel (Android 7 and 8) with Google Voice.&lt;/p&gt;
&lt;p&gt;The phone on the right has Tasker running and the left phone sends a standard text message.&lt;/p&gt;
&lt;p&gt;&lt;lite-youtube videoid=&quot;zE0SdNivoLg&quot; style=&quot;background-image: url(&amp;#x27;https://i.ytimg.com/vi/zE0SdNivoLg/hqdefault.jpg&amp;#x27;);&quot;&gt;
          &lt;a href=&quot;https://youtube.com/watch?v=zE0SdNivoLg&quot; class=&quot;lty-playbtn no-collision-link&quot;&gt;
            &lt;span class=&quot;lyt-visually-hidden&quot;&gt;Play video&lt;/span&gt;
          &lt;/a&gt;
        &lt;/lite-youtube&gt;&lt;/p&gt;
&lt;h1 id=&quot;apps-to-install&quot;&gt;Apps to install&lt;/h1&gt;
&lt;p&gt;To get started, purchase and download the following apps. The total cost is $5.50 presently.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://play.google.com/store/apps/details?id=net.dinglisch.android.taskerm&quot;&gt;Tasker&lt;/a&gt; $3.00
&lt;ul&gt;
&lt;li&gt;This is the main app that lets you automate and control your device based on criteria and events. &lt;em&gt;If this then that&lt;/em&gt; type of flow.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://play.google.com/store/apps/details?id=com.joaomgcd.autonotification&quot;&gt;AutoNotification (plugin for Tasker)&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://play.google.com/store/apps/details?id=com.joaomgcd.autonotification.unlock&quot;&gt;AutoNotification Unlock Key (full version)&lt;/a&gt; $2.50&lt;/li&gt;
&lt;li&gt;You need the full version to be able to intercept notifications&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://play.google.com/store/apps/details?id=com.google.android.wearable.app&quot;&gt;Android Wear - Smartwatch&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;This adds a compatible &quot;Reply&quot; button to the notification that AutoNotification can interact with (thanks to &lt;a href=&quot;http://forum.joaoapps.com/index.php?threads/reply-action-with-hangouts.4827/&quot;&gt;this post by joaomgcd&lt;/a&gt;). Normally, there is a &quot;Reply&quot; button/action without this app but it doesn&apos;t work and I am not sure on the exact distinction between them.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id=&quot;tasker-setup&quot;&gt;Tasker Setup&lt;/h1&gt;
&lt;p&gt;Open up Tasker&lt;/p&gt;
&lt;img srcset=&quot;/images/blog/play-sound-and-auto-reply-when-google-hangouts-text-message-received-tasker-guide/tasker-fresh-screen.png 4x&quot; alt=&quot;Fresh screen when opening up Tasker&quot;&gt;
&lt;p&gt;In the top-right, click the 3-dot menu icon and go to &lt;code&gt;Preferences&lt;/code&gt; to turn off &lt;code&gt;Beginner Mode&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;img srcset=&quot;/images/blog/play-sound-and-auto-reply-when-google-hangouts-text-message-received-tasker-guide/tasker-open-preferences.png 4x&quot; alt=&quot;Tasker context menu to access preferences&quot;&gt; &lt;img srcset=&quot;/images/blog/play-sound-and-auto-reply-when-google-hangouts-text-message-received-tasker-guide/tasker-uncheck-beginner-mode.png 4x&quot; alt=&quot;In Tasker preferences to uncheck &amp;#x27;Beginner Mode&amp;#x27;&quot;&gt;&lt;/p&gt;
&lt;p&gt;Open up AutoNotification and the unlock key app to make sure everything is activated and ready&lt;/p&gt;
&lt;img srcset=&quot;/images/blog/play-sound-and-auto-reply-when-google-hangouts-text-message-received-tasker-guide/android-notification-auto-notification.png 3x&quot; alt=&quot;Android notification showing &amp;#x27;Full version unlocked!&amp;#x27; of AutoNotification&quot;&gt;
&lt;p&gt;Go back to the main screen. Press and hold the home looking icon in the bottom-left corner and click the &lt;code&gt;Add&lt;/code&gt; button to create a new project. Projects allow you to organize a set of profiles/tasks, etc into a single place (like a folder). Let&apos;s call it &lt;code&gt;Ping Pong&lt;/code&gt;. Once created, you will see a &lt;code&gt;Ping Pong&lt;/code&gt; tab at the bottom of the screen.&lt;/p&gt;
&lt;p&gt;&lt;img srcset=&quot;/images/blog/play-sound-and-auto-reply-when-google-hangouts-text-message-received-tasker-guide/add-new-task.png 4x&quot; alt=&quot;Adding a new project to Tasker&quot;&gt; &lt;img srcset=&quot;/images/blog/play-sound-and-auto-reply-when-google-hangouts-text-message-received-tasker-guide/ping-pong-project-view.png 4x&quot; alt=&quot;An empty view of your newly created &amp;#x27;Ping Pong&amp;#x27; project&quot;&gt;&lt;/p&gt;
&lt;h1 id=&quot;create-the-profile-listen-for-new-hangouts-message&quot;&gt;Create the profile (listen for new hangouts message)&lt;/h1&gt;
&lt;p&gt;While you are on the &lt;code&gt;Profiles&lt;/code&gt; tab, click the plus &lt;code&gt;+&lt;/code&gt; button to start creating a new profile -&gt; &lt;code&gt;Event&lt;/code&gt; -&gt; &lt;code&gt;Plugin&lt;/code&gt; -&gt; &lt;code&gt;AutoNotification&lt;/code&gt; -&gt; &lt;code&gt;Intercept&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;img srcset=&quot;/images/blog/play-sound-and-auto-reply-when-google-hangouts-text-message-received-tasker-guide/new-event-profile.png 4x&quot; alt=&quot;Creating a new event profile&quot;&gt; &lt;img srcset=&quot;/images/blog/play-sound-and-auto-reply-when-google-hangouts-text-message-received-tasker-guide/event-plugin-selection.png 4x&quot; alt=&quot;Selecting plugin from the event category list&quot;&gt; &lt;img srcset=&quot;/images/blog/play-sound-and-auto-reply-when-google-hangouts-text-message-received-tasker-guide/auto-notification-selection.png 4x&quot; alt=&quot;Selecting AutoNotification from the list of event plugins&quot;&gt; &lt;img srcset=&quot;/images/blog/play-sound-and-auto-reply-when-google-hangouts-text-message-received-tasker-guide/intercept-action.png 4x&quot; alt=&quot;Selecting &amp;#x27;Intercept&amp;#x27; from the sub-list&quot;&gt;&lt;/p&gt;
&lt;p&gt;Click the configuration edit pencil icon&lt;/p&gt;
&lt;img srcset=&quot;/images/blog/play-sound-and-auto-reply-when-google-hangouts-text-message-received-tasker-guide/edit-event-configuration.png 4x&quot; alt=&quot;Clicking the event configuration edit pencil icon&quot;&gt;
&lt;p&gt;On the configuration screen, do the following&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Check &lt;code&gt;Has Reply Action&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Under &lt;code&gt;Apps&lt;/code&gt;, choose &lt;code&gt;Hangouts&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Scroll down to the &lt;code&gt;Notification Text&lt;/code&gt; setting and enter &lt;code&gt;(?mi).*\bping\b.*&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;The regex here is PCRE(Java regex). Thanks to João(author or AutoNotification) for clarifying this in an email!&lt;/li&gt;
&lt;li&gt;Basic regex breakdown
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;(?mi)&lt;/code&gt; adds the &lt;code&gt;m&lt;/code&gt;ultiline and case-&lt;code&gt;i&lt;/code&gt;nsensitive flags (so people can send &lt;code&gt;PING&lt;/code&gt;, &lt;code&gt;ping&lt;/code&gt;, &lt;code&gt;PiNg&lt;/code&gt;, etc)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;.*&lt;/code&gt; on either side will ensure any text with &lt;code&gt;ping&lt;/code&gt; will be matched (perhaps you don&apos;t want this)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;\b&lt;/code&gt; on either side will only match if the &lt;code&gt;ping&lt;/code&gt; is separated by a word boundary like spaces&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Check the &lt;code&gt;Case Insensitive&lt;/code&gt; checkbox (this doesn&apos;t interact with the &lt;code&gt;Regex&lt;/code&gt; option but whatever)&lt;/li&gt;
&lt;li&gt;Check the &lt;code&gt;Regex&lt;/code&gt; checkbox&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Click the checkmark at the top to confirm and your profile config for the intercept event should looking something like the following. Press the back button to be done and Tasker will prompt you to create a new task.&lt;/p&gt;
&lt;p&gt;&lt;img srcset=&quot;/images/blog/play-sound-and-auto-reply-when-google-hangouts-text-message-received-tasker-guide/autonotification-intercept-confirm-changes.png 4x&quot; alt=&quot;Clicking the checkmark to confirm your changes&quot;&gt; &lt;img srcset=&quot;/images/blog/play-sound-and-auto-reply-when-google-hangouts-text-message-received-tasker-guide/event-edit-go-back.png 4x&quot; alt=&quot;From the event edit screen, go back&quot;&gt;&lt;/p&gt;
&lt;h2 id=&quot;create-the-task-play-sounds-and-auto-reply&quot;&gt;Create the task (play sounds and auto-reply)&lt;/h2&gt;
&lt;p&gt;The task is what will happen when you receive the &quot;ping&quot; SMS/text. In this example we will turn up the sound level, play some sounds to wake you up, and automatically reply back to the sender so they know it worked, etc.&lt;/p&gt;
&lt;p&gt;Click new task and name it &lt;code&gt;Ping me&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;img srcset=&quot;/images/blog/play-sound-and-auto-reply-when-google-hangouts-text-message-received-tasker-guide/new-task-notification-event.png 4x&quot; alt=&quot;Creating a new task whenever the notification intercept event happens&quot;&gt; &lt;img srcset=&quot;/images/blog/play-sound-and-auto-reply-when-google-hangouts-text-message-received-tasker-guide/task-name-ping-me.png 4x&quot; alt=&quot;Naming the task &amp;#x27;Ping Me&amp;#x27;&quot;&gt;&lt;/p&gt;
&lt;p&gt;On the task edit screen, press the plus &lt;code&gt;+&lt;/code&gt; button to add a new action -&gt; &lt;code&gt;Plugin&lt;/code&gt; -&gt; &lt;code&gt;AutoNotification&lt;/code&gt; -&gt; &lt;code&gt;Reply&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;img srcset=&quot;/images/blog/play-sound-and-auto-reply-when-google-hangouts-text-message-received-tasker-guide/add-new-action.png 4x&quot; alt=&quot;Clicking &amp;#x27;+&amp;#x27; on the task edit screen to add a new action&quot;&gt; &lt;img srcset=&quot;/images/blog/play-sound-and-auto-reply-when-google-hangouts-text-message-received-tasker-guide/action-plugin-selection.png 4x&quot; alt=&quot;Selecting &amp;#x27;Plugin&amp;#x27; from the action category list&quot;&gt; &lt;img srcset=&quot;/images/blog/play-sound-and-auto-reply-when-google-hangouts-text-message-received-tasker-guide/auto-notification-reply.png 4x&quot; alt=&quot;Selecting AutoNotification, then &amp;#x27;Reply&amp;#x27; from the action plugin list&quot;&gt;&lt;/p&gt;
&lt;p&gt;Click the configuration edit pencil icon&lt;/p&gt;
&lt;img srcset=&quot;/images/blog/play-sound-and-auto-reply-when-google-hangouts-text-message-received-tasker-guide/edit-action-configuration.png 4x&quot; alt=&quot;Clicking the action configuration edit pencil icon&quot;&gt;
&lt;p&gt;On the configuration screen, change the &lt;code&gt;Reply Text&lt;/code&gt; to &lt;code&gt;pong&lt;/code&gt;.&lt;br&gt;
Click the checkmark at the top to confirm.&lt;/p&gt;
&lt;p&gt;&lt;img srcset=&quot;/images/blog/play-sound-and-auto-reply-when-google-hangouts-text-message-received-tasker-guide/edit-reply-text.png 4x&quot; alt=&quot;Editing the AutoNotification reply text&quot;&gt; &lt;img srcset=&quot;/images/blog/play-sound-and-auto-reply-when-google-hangouts-text-message-received-tasker-guide/enter-pong-reply.png 4x&quot; alt=&quot;Entering in &amp;#x27;pong&amp;#x27; for the reply text&quot;&gt;&lt;/p&gt;
&lt;p&gt;Back on the task edit screen, repeat the process to create more actions, press the plus &lt;code&gt;+&lt;/code&gt; button&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;Audio&lt;/code&gt; -&gt; &lt;code&gt;Notification Volume&lt;/code&gt;. Change the &lt;code&gt;Level&lt;/code&gt; to &lt;code&gt;7&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Audio&lt;/code&gt; -&gt; &lt;code&gt;Media Volume&lt;/code&gt;. Change the &lt;code&gt;Level&lt;/code&gt; to &lt;code&gt;15&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Alert&lt;/code&gt; -&gt; &lt;code&gt;Notify Sound&lt;/code&gt;. Change the &lt;code&gt;Title&lt;/code&gt; to &lt;code&gt;Ping&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Alert&lt;/code&gt; -&gt; &lt;code&gt;Beep&lt;/code&gt;. The defaults are fine (and annoying)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Task&lt;/code&gt; -&gt; &lt;code&gt;Wait&lt;/code&gt;. Change the &lt;code&gt;Seconds&lt;/code&gt; to &lt;code&gt;2&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Alert&lt;/code&gt; -&gt; &lt;code&gt;Morse&lt;/code&gt;. Change the text to &lt;code&gt;SOS&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;That should be enough to wake you up (warning &lt;strong&gt;LOUD&lt;/strong&gt; if you are testing). Now when someone texts you &quot;ping&quot;, your phone will blare some sound and auto reply with &quot;pong&quot;.&lt;/p&gt;
&lt;img srcset=&quot;/images/blog/play-sound-and-auto-reply-when-google-hangouts-text-message-received-tasker-guide/task-actions-list.png 4x&quot; alt=&quot;A full list of the actions we just added to the task including replying with &amp;#x27;pong&amp;#x27; and playing a bunch of noises and vibrations&quot;&gt;
&lt;h1 id=&quot;testing&quot;&gt;Testing&lt;/h1&gt;
&lt;p&gt;To test, you can try texting yourself from another device or from the Google Voice interface on your computer.&lt;/p&gt;
&lt;p&gt;You may want to cover up your speaker with your finger or adjust the sound level of the actions while you are testing as it is very loud.&lt;/p&gt;
&lt;h1 id=&quot;resources&quot;&gt;Resources&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;AutoNotification video tutorials and guides, &lt;a href=&quot;https://joaoapps.com/autonotification/&quot;&gt;https://joaoapps.com/autonotification/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Tasker docs, &lt;a href=&quot;http://tasker.dinglisch.net/&quot;&gt;http://tasker.dinglisch.net/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content:encoded></item><item><title>Now with HTTPS everywhere</title><link>https://ericeastwood.com/blog/now-with-https-everywhere/</link><guid isPermaLink="true">https://ericeastwood.com/blog/now-with-https-everywhere/</guid><description>A little late to the party but https://ericeastwood.com/ now has HTTPS everywhere!
I used mod_md for Apache which makes it painlessly easy to add LetsEncrypt SSL certs and automatically manage expiration.
apache.conf
MDomain ericeastwood.com
MDCertificateAgreement https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf
Resources

https://css-tricks.com/moving-to-https-on-wordpress/
https://github.com/icing/mod_md (Thanks @icing for the quick segmentation fault fix)
</description><pubDate>Thu, 21 Dec 2017 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;A little late to the party but &lt;a href=&quot;https://ericeastwood.com/&quot;&gt;https://ericeastwood.com/&lt;/a&gt; now has HTTPS everywhere!&lt;/p&gt;
&lt;p&gt;I used &lt;a href=&quot;https://github.com/icing/mod_md&quot;&gt;&lt;code&gt;mod_md&lt;/code&gt;&lt;/a&gt; for Apache which makes it painlessly easy to add &lt;a href=&quot;https://letsencrypt.org/&quot;&gt;LetsEncrypt&lt;/a&gt; SSL certs and automatically manage expiration.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;apache.conf&lt;/code&gt;&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;MDomain ericeastwood.com&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;MDCertificateAgreement https://letsencrypt.org/documents/LE-SA-v1.&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;-November-&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;15&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2017&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.pdf&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Resources&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://css-tricks.com/moving-to-https-on-wordpress/&quot;&gt;https://css-tricks.com/moving-to-https-on-wordpress/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/icing/mod_md&quot;&gt;https://github.com/icing/mod_md&lt;/a&gt; (Thanks &lt;a href=&quot;https://github.com/icing&quot;&gt;@icing&lt;/a&gt; for the &lt;a href=&quot;https://github.com/icing/mod_md/issues/68&quot;&gt;quick segmentation fault fix&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;</content:encoded></item><item><title>Journey to running `gitter-webapp` on Windows with Docker</title><link>https://ericeastwood.com/blog/journey-to-running-gitter-webapp-on-windows-with-docker/</link><guid isPermaLink="true">https://ericeastwood.com/blog/journey-to-running-gitter-webapp-on-windows-with-docker/</guid><description>NB: This was my experience around September, 2016 and I would consider myself a bit of a Docker noob at the time. Things may have changed and improved since then to make life easier. This just documents the troubles I ran into and shouldn&apos;t be considered setup guide worthy.
TLDR;

Use Docker Toolbox with the VirtualBox driver (Docker for Windows isn&apos;t ready)
Watch out for CRLF line endings that can get introduced from things like checking stuff out with git.


gitter-webapp is the project/repo that is home to the backend and frontend code for Gitter webapp. The team is pretty much exclusively macOS based but I prefer Windows.
For a while, I used ShareMouse so that I could use my macOS machine as just another</description><pubDate>Wed, 22 Feb 2017 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;strong&gt;NB:&lt;/strong&gt; This was my experience around September, 2016 and I would consider myself a bit of a Docker noob at the time. Things may have changed and improved since then to make life easier. This just documents the troubles I ran into and shouldn&apos;t be considered setup guide worthy.&lt;/p&gt;
&lt;p&gt;TLDR;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Use Docker Toolbox with the VirtualBox driver (Docker for Windows isn&apos;t ready)&lt;/li&gt;
&lt;li&gt;Watch out for &lt;code&gt;CRLF&lt;/code&gt; line endings that can get introduced from things like checking stuff out with git.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;p&gt;&lt;code&gt;gitter-webapp&lt;/code&gt; is the project/repo that is home to the backend and frontend code for Gitter webapp. The team is pretty much exclusively macOS based but I prefer Windows.&lt;/p&gt;
&lt;p&gt;For a while, I used ShareMouse so that I could use my macOS machine as just another external monitor to my Windows machine.&lt;/p&gt;
&lt;p&gt;We use Docker for local dev and CI testing to run services like Mongo, redis, and elasticsearch.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;#the-working-recipe&quot;&gt;Skip to the working recipe&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&quot;initial-attempt&quot;&gt;Initial Attempt&lt;/h2&gt;
&lt;p&gt;My very initial attempt(August, 2015) assisted by &lt;a href=&quot;https://github.com/malditogeek&quot;&gt;@malditogeek&lt;/a&gt; was with &lt;a href=&quot;https://www.vagrantup.com/&quot;&gt;Vagrant&lt;/a&gt; which failed because of the following issues better described in other articles.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;This article describes a lot of the troubles, &lt;a href=&quot;http://blog.prolificinteractive.com/2015/01/21/getting-vagrant-nodejs-windows-play-well-together/&quot;&gt;http://blog.prolificinteractive.com/2015/01/21/getting-vagrant-nodejs-windows-play-well-together/&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;Windows 256 character limit on file paths for the shared volume&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Some native Node modules that simply wouldn&apos;t compile on Windows(&lt;code&gt;heapdump&lt;/code&gt;, &lt;code&gt;protobuf&lt;/code&gt;, &lt;code&gt;cld&lt;/code&gt;, &lt;code&gt;buffertools&lt;/code&gt;)&lt;a href=&quot;https://gitter.im/malditogeek?at=55df2fae5ecf5f300ff1cb58&quot;&gt;.&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Just recently(September 2016), I got an itch to try to get something going again.&lt;/p&gt;
&lt;h2 id=&quot;the-docker-for-windows-hyper-v-trap&quot;&gt;The Docker for Windows Hyper-V trap&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;https://docs.docker.com/docker-for-windows/&quot;&gt;Docker for Windows&lt;/a&gt; uses Hyper-V is a native hypervisor on Windows for virtualizing things and is supposed to be a lot faster than VirtualBox setup. I couldn&apos;t get the app working with Docker for Windows but here is some references to the trouble I ran into.&lt;/p&gt;
&lt;p&gt;Hyper-V driven machines aren&apos;t ready in my opinion.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;No &lt;code&gt;Inotify&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;See &lt;a href=&quot;https://docs.docker.com/docker-for-windows/faqs/#/why-doesn-t-nodemon-pick-up-file-changes-in-a-container-mounted-on-a-shared-drive&quot;&gt;https://docs.docker.com/docker-for-windows/faqs/#/why-doesn-t-nodemon-pick-up-file-changes-in-a-container-mounted-on-a-shared-drive&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;See &lt;a href=&quot;https://docs.docker.com/docker-for-windows/troubleshoot/#/inotify-on-shared-drives-does-not-work&quot;&gt;https://docs.docker.com/docker-for-windows/troubleshoot/#/inotify-on-shared-drives-does-not-work&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;As a note, this is also a problem with new Bash on Windows 10 (WSL), &lt;a href=&quot;https://github.com/Microsoft/BashOnWindows/issues/216&quot;&gt;https://github.com/Microsoft/BashOnWindows/issues/216&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;No support for mounting volumes from my understanding and usage
&lt;ul&gt;
&lt;li&gt;The &quot;Shared Drives&quot; feature also wasn&apos;t working, &lt;a href=&quot;https://github.com/docker/for-win/issues/78&quot;&gt;https://github.com/docker/for-win/issues/78&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;For more info on the inner workings of this feature, &lt;a href=&quot;http://docker-saigon.github.io/post/Docker-Beta/#mounting-volumes:ebf9573d6838c40027746e9d7482622a&quot;&gt;http://docker-saigon.github.io/post/Docker-Beta/#mounting-volumes:ebf9573d6838c40027746e9d7482622a&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://forums.docker.com/t/volume-mounts-in-windows-does-not-work/10693&quot;&gt;https://forums.docker.com/t/volume-mounts-in-windows-does-not-work/10693&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/docker/docker/issues/22981#issuecomment-221637488&quot;&gt;https://github.com/docker/docker/issues/22981#issuecomment-221637488&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/docker/for-win/issues/77&quot;&gt;https://github.com/docker/for-win/issues/77&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/docker/docker/issues/21535&quot;&gt;https://github.com/docker/docker/issues/21535&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/docker/docker/issues/23005&quot;&gt;https://github.com/docker/docker/issues/23005&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/docker/docker/issues/21909#issuecomment-221698245&quot;&gt;https://github.com/docker/docker/issues/21909#issuecomment-221698245&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you are running into something not laid out here, perhaps you can find something useful here, See &lt;a href=&quot;https://github.com/docker/kitematic/wiki/Common-Issues-and-Fixes&quot;&gt;https://github.com/docker/kitematic/wiki/Common-Issues-and-Fixes&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;It is only available on Windows Pro and needs to be enabled(restart required): &lt;strong&gt;Control Panel&lt;/strong&gt; -&gt; &lt;strong&gt;Programs&lt;/strong&gt; -&gt; &lt;strong&gt;Turn Windows features on or off&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/journey-to-running-gitter-webapp-on-windows-with-docker/windows-features.png&quot; alt=&quot;Turning windows features on and off&quot;&gt;&lt;/p&gt;
&lt;p&gt;Most likely, the following command will fail to create the machine because it is &quot;Waiting for ssh to be available…&quot;, move on to the next step to get around it.&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;docker-machine&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;create&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;--driver&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;hyperv&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;default&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Create a virtual switch via the &lt;strong&gt;Hyper-V Manager&lt;/strong&gt; -&gt; &lt;strong&gt;Action&lt;/strong&gt; -&gt; &lt;strong&gt;Virtual Switch Manager...&lt;/strong&gt;. I called mine &lt;code&gt;external-switch&lt;/code&gt;:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/journey-to-running-gitter-webapp-on-windows-with-docker/hyper-v-virtual-switch.png&quot; alt=&quot;Creating a Virtual Switch in Hyper-V&quot;&gt; &lt;img src=&quot;/images/blog/journey-to-running-gitter-webapp-on-windows-with-docker/switch-external-switch.png&quot; alt=&quot;Naming the switch &amp;#x27;external-switch&amp;#x27;&quot;&gt;&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;docker-machine&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;create&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;--driver&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;hyperv&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;--hyperv-virtual-switch&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;external-switch&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;default&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;em&gt;Tip courtesy of &lt;a href=&quot;https://forums.docker.com/t/docker-machine-stuck-on-waiting-for-ssh-to-be-available/18702/3&quot;&gt;https://forums.docker.com/t/docker-machine-stuck-on-waiting-for-ssh-to-be-available/18702/3&lt;/a&gt; -&gt; &lt;a href=&quot;https://forums.docker.com/t/using-docker-for-windows-docker-machine-create/8032/2&quot;&gt;https://forums.docker.com/t/using-docker-for-windows-docker-machine-create/8032/2&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;The lack of volume mounting support means that the &lt;code&gt;entrypoint&lt;/code&gt;&apos;s defined in &lt;code&gt;docker-compose.yml&lt;/code&gt; aren&apos;t found&lt;/p&gt;
&lt;p&gt;&lt;code&gt;docker-compose.yml&lt;/code&gt;&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #E45649&quot;&gt;mongosetup&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;image&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;mongo:3.2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;volumes&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    - &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;${WORKSPACE}:/src&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;working_dir&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;/src&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;entrypoint&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;: [&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;/src/mongo-setup.sh&apos;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;]&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But the entrypoint can&apos;t be found. Perhaps this is &lt;a href=&quot;#line-ending-crlf-trap&quot;&gt;just a line-ending issue&lt;/a&gt; but I wasn&apos;t aware of this problem at the time and was fed up and didn&apos;t want to go back after I got things working with Docker Toolbox.&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;docker-compose&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;up&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;-d&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;--no-recreate&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;ERROR:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;mongosetup&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;Cannot&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;start&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;service&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;mongosetup:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;oci&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;runtime&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;error:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;exec:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;/src/mongo-setup.sh&quot;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;stat&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;/src/mongo-setup.sh:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;no&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;such&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;file&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;or&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;directory&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;docker&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;inspect&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;mongosetup_1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;&quot;Mounts&quot;&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; [&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;&quot;Source&quot;&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;/c/Users/MLM/Documents/GitHub/something&quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;&quot;Destination&quot;&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;/src&quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;&quot;Mode&quot;&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;rw&quot;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;&quot;RW&quot;&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;true&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;&quot;Propagation&quot;&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;rprivate&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    },&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;...&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;kitematic&quot;&gt;Kitematic&lt;/h3&gt;
&lt;p&gt;I wish Kitematic could just skip the machine creation process and you could just choose an existing machine to inspect. I already have a machine running called &lt;code&gt;default&lt;/code&gt; that I want it to pick up. Perhaps this possible with the &lt;a href=&quot;https://github.com/docker/kitematic/issues/231#issuecomment-143769843&quot;&gt;barely documented&lt;/a&gt; &lt;a href=&quot;https://github.com/docker/kitematic/pull/992&quot;&gt;&lt;code&gt;.kitematicfg&lt;/code&gt;&lt;/a&gt; but I don&apos;t see an option that quite fits.&lt;/p&gt;
&lt;p&gt;It &lt;a href=&quot;https://github.com/docker/toolbox/issues/548&quot;&gt;fails first because it looks for Docker for Windows machines&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/journey-to-running-gitter-webapp-on-windows-with-docker/docker-setup-error-kitematic-pipe.png&quot; alt=&quot;Docker setup error, unexpected error with Kitematic: &amp;#x27;Error: connect ENONENT //./pipe/docker_engine&amp;#x27;&quot;&gt;&lt;/p&gt;
&lt;p&gt;This is fine, just a pain point and you need to click &quot;Use Virtualbox&quot;. But unfortunately it can also fails to create the &lt;code&gt;default&lt;/code&gt; machine:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/journey-to-running-gitter-webapp-on-windows-with-docker/docker-setup-error-kitematic-command.png&quot; alt=&quot;Docker setup error, unexpected error with Kitematic: &amp;#x27;Command failed: C:\Program Files\Docker Toolbox\docker-machine.exe -D start default, Docker Machine Version: 0.8.0, build b85aac1, ...&amp;#x27;&quot;&gt;&lt;/p&gt;
&lt;p&gt;You might have slightly better luck with the latest Kitematic separate from the Docker Toolbox:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/docker/kitematic/releases&quot;&gt;https://github.com/docker/kitematic/releases&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://download.docker.com/kitematic/Kitematic-Windows.zip&quot;&gt;https://download.docker.com/kitematic/Kitematic-Windows.zip&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Further reading:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/docker/kitematic/wiki/Common-Issues-and-Fixes&quot;&gt;https://github.com/docker/kitematic/wiki/Common-Issues-and-Fixes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://agup.tech/2015/08/14/hacking-at-kitematic-with-hyper-v-on-windows-10/&quot;&gt;http://agup.tech/2015/08/14/hacking-at-kitematic-with-hyper-v-on-windows-10/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;the-working-recipe&quot;&gt;The working recipe&lt;/h2&gt;
&lt;h4 id=&quot;prerequisites&quot;&gt;Prerequisites&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Install &lt;a href=&quot;https://www.docker.com/products/docker-toolbox&quot;&gt;Docker Toolbox&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Disable Hyper-V if you previously enabled it: &lt;strong&gt;Control Panel&lt;/strong&gt; -&gt; &lt;strong&gt;Programs&lt;/strong&gt; -&gt; &lt;strong&gt;Turn Windows features on or off&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Start the Docker machine backed by VirtualBox&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;docker-machine&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;create&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;--driver&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;virtualbox&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;default&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Setup environment variables for the particular machine. You will need to run the last line of the output from that command to actually evaluate and apply the variables which looks like: &lt;code&gt;@FOR /f &quot;tokens=*&quot; %i IN (&apos;docker-machine env default&apos;) DO @%i&lt;/code&gt;&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;docker-machine&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;env&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;default&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Your &lt;code&gt;docker-compose.yml&lt;/code&gt; might also have some host environment variables you need to define which would look like &lt;code&gt;${FOO}&lt;/code&gt; in &lt;code&gt;docker-compose.yml&lt;/code&gt;. In the case of &lt;code&gt;gitter-webapp&lt;/code&gt;, I need to supply &lt;code&gt;DOCKER_HOST_IP&lt;/code&gt; and &lt;code&gt;WORKSPACE&lt;/code&gt; which can be populated with the following commands. That weird &lt;code&gt;for&lt;/code&gt; command snippet is just &lt;a href=&quot;https://stackoverflow.com/q/889518/796832&quot;&gt;Batch recipe&lt;/a&gt; used to put output of the &lt;code&gt;pwd&lt;/code&gt; command in the &lt;code&gt;WORKSPACE&lt;/code&gt; env variable on Windows.&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;f &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;delims=&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;%&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;a &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;in&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; (&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;docker-machine ip default&apos;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;) &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;do&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;@set&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; DOCKER_HOST_IP&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=%&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;a&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;f &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;delims=&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;%&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;a &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;in&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; (&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;pwd&apos;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;) &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;do&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;@set&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; WORKSPACE&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=%&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;a&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you are not sure whether you need to set any environment variables, the &lt;code&gt;docker-compose up&lt;/code&gt; command you run later, in order to start the containers will complain like this:&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;WARNING: The DOCKER_HOST_IP variable is not set. Defaulting to a blank string.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;WARNING: The WORKSPACE variable is not set. Defaulting to a blank string.&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;line-ending-crlf-trap&quot;&gt;Line ending &lt;code&gt;CRLF&lt;/code&gt; trap&lt;/h3&gt;
&lt;p&gt;A trap I fell into was line endings(&lt;code&gt;CRLF&lt;/code&gt;, &lt;code&gt;LF&lt;/code&gt;) causing some containers to not work correctly.&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;docker&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;logs&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;gitterwebapp_mongosetup_1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;standard_init_linux.go:175:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;exec&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;user&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;process&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;caused&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;no such file or directory&quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Which would make it seem like docker couldn&apos;t find the log file but actually that is the contents of the log file and is just a esoteric error for &lt;code&gt;CRLF&lt;/code&gt; line endings causing things to go sour.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://docs.docker.com/docker-for-windows/troubleshoot/#/avoid-unexpected-syntax-errors-use-unix-style-line-endings-for-files-in-containers&quot;&gt;https://docs.docker.com/docker-for-windows/troubleshoot/#/avoid-unexpected-syntax-errors-use-unix-style-line-endings-for-files-in-containers&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/docker/toolbox/issues/126&quot;&gt;https://github.com/docker/toolbox/issues/126&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/deviantony/docker-elk/issues/36&quot;&gt;https://github.com/deviantony/docker-elk/issues/36&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://forums.docker.com/t/standard-init-linux-go-175-exec-user-process-caused-no-such-file/20025&quot;&gt;https://forums.docker.com/t/standard-init-linux-go-175-exec-user-process-caused-no-such-file/20025&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://willi.am/blog/2016/08/11/docker-for-windows-dealing-with-windows-line-endings/&quot;&gt;http://willi.am/blog/2016/08/11/docker-for-windows-dealing-with-windows-line-endings/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Even if your project was checked into the repo with &lt;code&gt;LF&lt;/code&gt;, Git could be converting them back to Windows style line endings on checkout. You can use the following commands to kick Git into shape.&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;git&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;config&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;--global&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;core.autocrlf&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;input&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;git&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;config&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;--global&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;core.eol&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;lf&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;Check&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;the&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;value&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;in&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;the&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;current&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;context&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;git&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;config&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;core.autocrlf&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you want to make robust docker setup, consider running things through a utility like &lt;code&gt;dos2unix&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Now you can re-checkout the project or run through the steps here to refresh the project with the correct &lt;code&gt;LF&lt;/code&gt; line-endings: &lt;a href=&quot;https://help.github.com/articles/dealing-with-line-endings/#refreshing-a-repository-after-changing-line-endings&quot;&gt;https://help.github.com/articles/dealing-with-line-endings/#refreshing-a-repository-after-changing-line-endings&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;As a small note if you are using the &lt;a href=&quot;https://atom.io/&quot;&gt;Atom editor&lt;/a&gt;, you can open a project file and check the line-endings in the bottom-right corner:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/journey-to-running-gitter-webapp-on-windows-with-docker/atom-line-endings.png&quot; alt=&quot;Switching the line endings in the Atom text editor&quot;&gt;&lt;/p&gt;
&lt;h3 id=&quot;start-the-containers&quot;&gt;Start the containers&lt;/h3&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;docker-compose&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;up&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;-d&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;--no-recreate&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If something goes wrong, you can reset and delete the containers with the following commands&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;docker-compose&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;stop&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;docker-compose&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;rm&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;-f&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;get-the-app-running&quot;&gt;Get the app running&lt;/h3&gt;
&lt;p&gt;With &lt;code&gt;gitter-webapp&lt;/code&gt;, the script hooks defined &lt;code&gt;package.json&lt;/code&gt; like &lt;code&gt;preinstall&lt;/code&gt; use some bash which won&apos;t run on Windows batch shells.&lt;/p&gt;
&lt;p&gt;In order to install the app properly, we need to use the undocumented &lt;code&gt;--ignore-scripts&lt;/code&gt; flag which will skip any script hooks.&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;npm&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;install&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;--ignore-scripts&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Because we used &lt;code&gt;--ignore-scripts&lt;/code&gt; to skip things, we need to manually fix up some native module builds. With &lt;code&gt;gitter-webapp&lt;/code&gt;, I needed to run the following. May be a bit tricky with npm 3.&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;f &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;delims=&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;%&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;a &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;in&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; (&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;cd&apos;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;) &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;do&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; (rmdir &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;%&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;a\node_modules\cld &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;S &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;Q) &amp;#x26;&amp;#x26; npm i cld&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;f &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;delims=&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;%&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;a &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;in&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; (&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;cd&apos;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;) &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;do&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; (rmdir &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;%&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;a\node_modules\slug &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;S &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;Q) &amp;#x26;&amp;#x26; npm i slug&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;Start&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;the&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;app&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;npm&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;run&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;dev&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Done, Rejoice, You can now develop on Windows :D&lt;/p&gt;
&lt;h1 id=&quot;command-quick-reference&quot;&gt;Command Quick Reference&lt;/h1&gt;
&lt;p&gt;&lt;code&gt;default&lt;/code&gt; is just a machine name and can be whatever you want.&lt;/p&gt;













































&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Command&lt;/th&gt;&lt;th&gt;description&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;https://docs.docker.com/machine/reference/ls/&quot;&gt;&lt;code&gt;docker-machine ls&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;&lt;td&gt;List all the Docker machines and check state&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;https://docs.docker.com/machine/reference/create/&quot;&gt;&lt;code&gt;docker-machine create --driver virtualbox default&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;&lt;td&gt;Create and start the &lt;code&gt;default&lt;/code&gt; machine&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;https://docs.docker.com/machine/reference/rm/&quot;&gt;&lt;code&gt;docker-machine rm -f default&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;&lt;td&gt;Remove the &lt;code&gt;default&lt;/code&gt; machine&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;https://docs.docker.com/machine/reference/start/&quot;&gt;&lt;code&gt;docker-machine start default&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;&lt;td&gt;Start an existing &lt;code&gt;default&lt;/code&gt; machine&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;https://docs.docker.com/machine/reference/env/&quot;&gt;&lt;code&gt;docker-machine env default&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;&lt;td&gt;Setup the environment variables pertaining to the machine (copy paste the last line in the output for it to actually apply)&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;https://docs.docker.com/engine/reference/commandline/ps/&quot;&gt;&lt;code&gt;docker ps --all&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;&lt;td&gt;List all containers&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;https://docs.docker.com/engine/reference/commandline/logs/&quot;&gt;&lt;code&gt;docker logs container&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;&lt;td&gt;Show logs for container. Useful for finding out why something errored out, etc&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;https://docs.docker.com/compose/reference/up/&quot;&gt;&lt;code&gt;docker-compose up -d --no-recreate&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;&lt;td&gt;Create/Start all containers defined in &lt;code&gt;docker-compose.yml&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;https://docs.docker.com/compose/reference/stop/&quot;&gt;&lt;code&gt;docker-compose stop &amp;#x26;&amp;#x26; docker-compose rm -f&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;&lt;td&gt;Stop all the containers and remove them. Useful for resetting after a &lt;code&gt;docker-compose up ...&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;</content:encoded></item><item><title>Curves and Arcs: Quadratic, Cubic, Elliptical (SVG implementations)</title><link>https://ericeastwood.com/blog/curves-and-arcs-quadratic-cubic-elliptical-svg-implementations/</link><guid isPermaLink="true">https://ericeastwood.com/blog/curves-and-arcs-quadratic-cubic-elliptical-svg-implementations/</guid><description>I&apos;ve been playing around with Bezier curves and elliptical arcs for my on-going CNC plotter project. Instead of just using g-code commands which are standard on most CNC machines, I decided to support SVG path commands. This means supporting the linear moveTo(M, m) and lineTo(L, l) as well as curve(C, c, S, s -- Q, q, T, t)/arc(A, a) commands.
Here are a few articles to get you up to speed if you&apos;re unfamiliar with the SVG path commands:

SVG Basics—Creating Paths With Line Commands by Steven Bradley
SVG Basics—Creating Paths With Curve Commands by Steven Bradley

tl;dr, I just need a library
The JavaScript and C++ implementations are available on GitHub: SVG Curve Library.
I implemented the SVG path commands in JavaScript and ported it</description><pubDate>Mon, 20 Apr 2015 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;I&apos;ve been playing around with Bezier curves and elliptical arcs for my on-going CNC plotter project. Instead of just using g-code commands which are standard on most CNC machines, I decided to support SVG path commands. This means supporting the linear &lt;code&gt;moveTo&lt;/code&gt;(M, m) and &lt;code&gt;lineTo&lt;/code&gt;(L, l) as well as &lt;code&gt;curve&lt;/code&gt;(C, c, S, s -- Q, q, T, t)/&lt;code&gt;arc&lt;/code&gt;(A, a) commands.&lt;/p&gt;
&lt;p&gt;Here are a few articles to get you up to speed if you&apos;re unfamiliar with the SVG path commands:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.vanseodesign.com/web-design/svg-paths-line-commands/&quot;&gt;SVG Basics—Creating Paths With Line Commands&lt;/a&gt; by Steven Bradley&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.vanseodesign.com/web-design/svg-paths-curve-commands/&quot;&gt;SVG Basics—Creating Paths With Curve Commands&lt;/a&gt; by Steven Bradley&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;tldr-i-just-need-a-library&quot;&gt;tl;dr, I just need a &lt;a href=&quot;https://github.com/MadLittleMods/svg-curve-lib&quot;&gt;library&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The JavaScript and C++ implementations are &lt;a href=&quot;https://github.com/MadLittleMods/svg-curve-lib&quot;&gt;available on GitHub: SVG Curve Library&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I implemented the SVG path commands in JavaScript and ported it over to C++11 in order to run on the Teensy 3.0/3.1 (Arduino-like) microcontroller.&lt;/p&gt;
&lt;h1 id=&quot;bezier-curves&quot;&gt;Bezier Curves&lt;/h1&gt;
&lt;p&gt;Bezier curves are a made up of a set of control points, and a start/end point which are sometimes categorized along with the control points. The controls points influence where the curve should go. A Bezier curve can have &lt;code&gt;n&lt;/code&gt; number of control points but we will only go over the quadratic(1) and cubic(2) varieties. The math for Bezier curves is a simple parametric equation.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A quadratic Bezier curve, has only a single control (1)point/handle.&lt;/li&gt;
&lt;li&gt;A cubic Bezier curve, has two control (2)points/handles.&lt;/li&gt;
&lt;/ul&gt;
&lt;iframe style=&quot;width: 100%; height: 500px&quot; src=&quot;//madlittlemods.github.io/svg-curve-lib/demos/js/interactive-bezier-curve-demo/&quot; allowfullscreen frameborder=&quot;0&quot;&gt;&lt;/iframe&gt;
&lt;h2 id=&quot;quadratic-bezier-mathcode&quot;&gt;Quadratic Bezier Math/Code:&lt;/h2&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/curves-and-arcs-quadratic-cubic-elliptical-svg-implementations/quadratic-bezier-formula.png&quot; alt=&quot;Quadratic Bezier math formula: B(t) = (1-t)^2P_0 + 2t(1-t)P_1 + t^2P_2, t \in [0, 1]&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;code-embed&quot; style=&quot;counter-set: line-number 53;&quot;&gt;
            &lt;header class=&quot;code-embed-header&quot;&gt;
              &lt;div&gt;
                &lt;a href=&quot;https://github.com/MadLittleMods/svg-curve-lib/blob/50b7761814384ba2497bb63cfa5417cb6cd85a5f/src/js/svg-curve-lib.js#L53-L64&quot; class=&quot;code-embed-header-filename&quot;&gt;src/js/svg-curve-lib.js&lt;/a&gt;
                &lt;span class=&quot;code-embed-header-subtext&quot;&gt;(snippet)&lt;/span&gt;
              &lt;/div&gt;
              &lt;div&gt;&lt;a href=&quot;https://github.com/MadLittleMods/svg-curve-lib/blob/50b7761814384ba2497bb63cfa5417cb6cd85a5f/src/js/svg-curve-lib.js#L53-L64&quot;&gt;Source on GitHub&lt;/a&gt;&lt;/div&gt;
            &lt;/header&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		pointOnQuadraticBezierCurve: &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(p0,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;p1,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;p2,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;t)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;calculateQuadraticBezierParameter&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(x0,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;x1,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;x2,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;t)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;				&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;result&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;Math&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;pow&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;t,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;x0&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;t&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;t)&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;x1&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;Math&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;pow&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(t,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;x2;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;				&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;				&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;result;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;				x&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;calculateQuadraticBezierParameter&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;p0&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;x&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;p1&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;x&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;p2&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;x&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;t),&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;				y&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;calculateQuadraticBezierParameter&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;p0&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;y&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;p1&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;y&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;p2&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;y&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;t)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;};&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;},&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;p&gt;&lt;/p&gt;
&lt;h2 id=&quot;cubic-bezier-mathcode&quot;&gt;Cubic Bezier Math/Code&lt;/h2&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/curves-and-arcs-quadratic-cubic-elliptical-svg-implementations/cubic-bezier-formula.png&quot; alt=&quot;Cubic Bezier math formula: B(t) = (1-t)^3P_0 + 3t(1-t)^2P_1 + 3t^2(1-t)P_2 + t^3P_3, t \in [0, 1]&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;code-embed&quot; style=&quot;counter-set: line-number 66;&quot;&gt;
            &lt;header class=&quot;code-embed-header&quot;&gt;
              &lt;div&gt;
                &lt;a href=&quot;https://github.com/MadLittleMods/svg-curve-lib/blob/50b7761814384ba2497bb63cfa5417cb6cd85a5f/src/js/svg-curve-lib.js#L66-L77&quot; class=&quot;code-embed-header-filename&quot;&gt;src/js/svg-curve-lib.js&lt;/a&gt;
                &lt;span class=&quot;code-embed-header-subtext&quot;&gt;(snippet)&lt;/span&gt;
              &lt;/div&gt;
              &lt;div&gt;&lt;a href=&quot;https://github.com/MadLittleMods/svg-curve-lib/blob/50b7761814384ba2497bb63cfa5417cb6cd85a5f/src/js/svg-curve-lib.js#L66-L77&quot;&gt;Source on GitHub&lt;/a&gt;&lt;/div&gt;
            &lt;/header&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		pointOnCubicBezierCurve: &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(p0,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;p1,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;p2,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;p3,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;t)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;calculateCubicBezierParameter&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(x0,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;x1,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;x2,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;x3,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;t)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;				&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;result&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;Math&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;pow&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;t,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;x0&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;t&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;Math&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;pow&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;t,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;x1&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;t)&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;Math&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;pow&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(t,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;x2&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;Math&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;pow&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(t,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;x3;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;				&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;				&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;result;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;				x&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;calculateCubicBezierParameter&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;p0&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;x&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;p1&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;x&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;p2&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;x&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;p3&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;x&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;t),&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;				y&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;calculateCubicBezierParameter&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;p0&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;y&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;p1&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;y&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;p2&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;y&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;p3&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;y&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;t)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;};&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;},&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;p&gt;&lt;/p&gt;
&lt;h2 id=&quot;other-bezier-curve-linksresources&quot;&gt;Other Bezier Curve Links/Resources:&lt;/h2&gt;
&lt;p&gt;A small collection of links that helped me.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/B%C3%A9zier_curve&quot;&gt;Bézier curve on Wikipedia&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://pomax.github.io/bezierinfo/#tracing&quot;&gt;Tracing a curve at fixed distance intervals&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://gamedev.stackexchange.com/a/5427/16587&quot;&gt;Moving ships between two planets along a bezier, missing some equations for acceleration&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.malczak.linuxpl.com/blog/quadratic-bezier-curve-length/&quot;&gt;Quadratic Bezier curve length&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://math.stackexchange.com/q/12186/60008&quot;&gt;Arc Length of Bézier Curves&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.particleincell.com/2013/cubic-line-intersection/&quot;&gt;Computing Intersections Between a Cubic Bezier Curve and a Line&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id=&quot;elliptical-arcs&quot;&gt;Elliptical Arcs&lt;/h1&gt;
&lt;p&gt;These were harder to implement for me, solely because of the amount of other information out there is very slim. I found the &lt;a href=&quot;https://svgwg.org/svg2-draft/implnote.html&quot;&gt;Implementation Notes page from the SVGWG&lt;/a&gt; to be most helpful.&lt;/p&gt;
&lt;p&gt;Elliptical arcs are simply sub-sections(arcs) of an ellipse(oval).&lt;/p&gt;
&lt;iframe style=&quot;width: 100%; height: 300px&quot; src=&quot;//madlittlemods.github.io/svg-curve-lib/demos/js/interactive-elliptical-arc-demo/&quot; allowfullscreen frameborder=&quot;0&quot;&gt;&lt;/iframe&gt;
&lt;h2 id=&quot;elliptical-arc-mathcode&quot;&gt;Elliptical Arc Math/Code&lt;/h2&gt;
&lt;p&gt;Elliptical arcs a bit more complicated to work out because the point on elliptical arc equation is not in a nice endpoint parameterization format. We will need to convert this center parameterized equation to a endpoint parameterization. If you want to do this conversion on your own, there are some &lt;a href=&quot;https://www.w3.org/TR/SVG/implnote.html#ArcConversionEndpointToCenter&quot;&gt;great instructions from SVGWG&lt;/a&gt;.&lt;/p&gt;
&lt;!-- prettier-ignore --&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/curves-and-arcs-quadratic-cubic-elliptical-svg-implementations/elliptic-curve-formula.png&quot; alt=&quot;Elliptical arc  math formula: \begin{pmatrix}
x \
y
\end{pmatrix} =
\begin{pmatrix}
cos\theta &amp;#x26; -sin\theta \
sin\theta &amp;#x26; cos\theta
\end{pmatrix} \cdot
\begin{pmatrix}
r_xcos\theta \
r_ycos\theta
\end{pmatrix} +
\begin{pmatrix}
c_x \
c_y
\end{pmatrix}&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Beware: Matrix math, make sure to expand this expression correctly&lt;/em&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;cx&lt;/code&gt;, &lt;code&gt;cy&lt;/code&gt; are the coordinates of the center of the ellipse&lt;/li&gt;
&lt;li&gt;&lt;code&gt;rx&lt;/code&gt;, &lt;code&gt;ry&lt;/code&gt; are the radii of the ellipse (also known as its semi-major and semi-minor axes).&lt;/li&gt;
&lt;li&gt;&lt;code&gt;phi&lt;/code&gt; (φ) is the rotation of the ellipse from the x-axis&lt;/li&gt;
&lt;li&gt;&lt;code&gt;theta&lt;/code&gt; (θ) angle. The &quot;actual&quot; variable in the equation that determines where the point on the arc is.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;code-embed&quot; style=&quot;counter-set: line-number 79;&quot;&gt;
            &lt;header class=&quot;code-embed-header&quot;&gt;
              &lt;div&gt;
                &lt;a href=&quot;https://github.com/MadLittleMods/svg-curve-lib/blob/50b7761814384ba2497bb63cfa5417cb6cd85a5f/src/js/svg-curve-lib.js#L79-L187&quot; class=&quot;code-embed-header-filename&quot;&gt;src/js/svg-curve-lib.js&lt;/a&gt;
                &lt;span class=&quot;code-embed-header-subtext&quot;&gt;(snippet)&lt;/span&gt;
              &lt;/div&gt;
              &lt;div&gt;&lt;a href=&quot;https://github.com/MadLittleMods/svg-curve-lib/blob/50b7761814384ba2497bb63cfa5417cb6cd85a5f/src/js/svg-curve-lib.js#L79-L187&quot;&gt;Source on GitHub&lt;/a&gt;&lt;/div&gt;
            &lt;/header&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// http://www.w3.org/TR/SVG/implnote.html#ArcSyntax&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// To double check our implementation against another source, you can use: &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;//      https://java.net/projects/svgsalamander/sources/svn/content/trunk/svg-core/src/main/java/com/kitfox/svg/pathcmd/Arc.java&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;//      http://fridrich.blogspot.com/2011/06/bounding-box-of-svg-elliptical-arc.html&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// t: [0, 1]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		pointOnEllipticalArc: &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(p0,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;rx,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;ry,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;xAxisRotation,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;largeArcFlag,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;sweepFlag,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;p1,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;t)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// In accordance to: http://www.w3.org/TR/SVG/implnote.html#ArcOutOfRangeParameters&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;rx&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;Math&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;abs&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(rx);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;ry&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;Math&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;abs&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(ry);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;xAxisRotation&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;mod&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(xAxisRotation,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;360&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;xAxisRotationRadians&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;toRadians&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(xAxisRotation);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// If the endpoints are identical, then this is equivalent to omitting the elliptical arc segment entirely.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;p0&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;x&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;===&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;p1&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;x&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;&amp;#x26;&amp;#x26;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;p0&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;y&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;===&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;p1&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;y&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;				&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;p0;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// If rx = 0 or ry = 0 then this arc is treated as a straight line segment joining the endpoints.    &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(rx&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;===&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;||&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;ry&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;===&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;				&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;pointOnLine&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(p0,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;p1,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;t);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Following &quot;Conversion from endpoint to center parameterization&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// http://www.w3.org/TR/SVG/implnote.html#ArcConversionEndpointToCenter&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Step #1: Compute transformedPoint&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;dx&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;p0&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;x&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;p1&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;x&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;dy&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;p0&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;y&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;p1&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;y&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;transformedPoint&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;				x&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;Math&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;cos&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(xAxisRotationRadians)&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;dx&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;Math&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;sin&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(xAxisRotationRadians)&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;dy,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;				y&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;Math&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;sin&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(xAxisRotationRadians)&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;dx&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;Math&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;cos&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(xAxisRotationRadians)&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;dy&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;};&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Ensure radii are large enough&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;radiiCheck&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;Math&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;pow&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;transformedPoint&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;x&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;Math&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;pow&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(rx,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;Math&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;pow&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;transformedPoint&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;y&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;Math&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;pow&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(ry,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(radiiCheck&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;&gt;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;				&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;rx&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;Math&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;sqrt&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(radiiCheck)&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;rx;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;				&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;ry&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;Math&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;sqrt&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(radiiCheck)&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;ry;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Step #2: Compute transformedCenter&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;cSquareNumerator&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;Math&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;pow&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(rx,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;Math&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;pow&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(ry,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;Math&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;pow&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(rx,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;Math&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;pow&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;transformedPoint&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;y&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;Math&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;pow&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(ry,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;Math&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;pow&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;transformedPoint&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;x&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;cSquareRootDenom&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;Math&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;pow&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(rx,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;Math&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;pow&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;transformedPoint&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;y&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;Math&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;pow&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(ry,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;Math&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;pow&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;transformedPoint&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;x&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;cRadicand&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;cSquareNumerator&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;cSquareRootDenom;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Make sure this never drops below zero because of precision&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;cRadicand&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;cRadicand&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;?&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;cRadicand;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;cCoef&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(largeArcFlag&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;!==&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;sweepFlag&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;?&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;Math&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;sqrt&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(cRadicand);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;transformedCenter&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;				x&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;cCoef&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;((rx&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;transformedPoint&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;y&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;ry),&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;				y&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;cCoef&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(ry&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;transformedPoint&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;x&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;rx)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;};&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Step #3: Compute center&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;center&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;				x&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;Math&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;cos&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(xAxisRotationRadians)&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;transformedCenter&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;x&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;Math&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;sin&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(xAxisRotationRadians)&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;transformedCenter&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;y&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;((&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;p0&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;x&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;p1&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;x&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;),&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;				y&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;Math&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;sin&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(xAxisRotationRadians)&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;transformedCenter&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;x&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;Math&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;cos&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(xAxisRotationRadians)&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;transformedCenter&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;y&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;((&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;p0&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;y&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;p1&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;y&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;};&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Step #4: Compute start/sweep angles&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Start angle of the elliptical arc prior to the stretch and rotate operations.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Difference between the start and end angles&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;startVector&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;				x&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;transformedPoint&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;x&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;transformedCenter&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;x&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;rx,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;				y&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;transformedPoint&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;y&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;transformedCenter&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;y&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;ry&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;};&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;startAngle&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;angleBetween&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;({&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;				x&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;				y&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;},&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;startVector);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;endVector&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;				x&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;transformedPoint&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;x&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;transformedCenter&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;x&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;rx,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;				y&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;transformedPoint&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;y&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;transformedCenter&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;y&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;ry&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;};&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;sweepAngle&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;angleBetween&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(startVector,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;endVector);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;sweepFlag&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;&amp;#x26;&amp;#x26;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;sweepAngle&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;&gt;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;				&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;sweepAngle&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;-=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;Math&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;PI&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;else&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(sweepFlag&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;&amp;#x26;&amp;#x26;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;sweepAngle&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;				&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;sweepAngle&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;+=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;Math&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;PI&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// We use % instead of `mod(..)` because we want it to be -360deg to 360deg(but actually in radians)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;sweepAngle&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;%=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;Math&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;PI&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// From http://www.w3.org/TR/SVG/implnote.html#ArcParameterizationAlternatives&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;angle&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;startAngle&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(sweepAngle&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;t);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;ellipseComponentX&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;rx&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;Math&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;cos&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(angle);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;ellipseComponentY&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;ry&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;Math&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;sin&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(angle);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;point&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;				x&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;Math&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;cos&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(xAxisRotationRadians)&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;ellipseComponentX&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;Math&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;sin&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(xAxisRotationRadians)&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;ellipseComponentY&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;center&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;x&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;				y&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;Math&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;sin&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(xAxisRotationRadians)&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;ellipseComponentX&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;Math&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;cos&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(xAxisRotationRadians)&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;ellipseComponentY&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;center&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;y&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;};&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Attach some extra info to use&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;point&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;ellipticalArcStartAngle&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;startAngle;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;point&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;ellipticalArcEndAngle&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;startAngle&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;sweepAngle;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;point&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;ellipticalArcAngle&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;angle;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;point&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;ellipticalArcCenter&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;center;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;point&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;resultantRx&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;rx;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;point&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;resultantRy&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;ry;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;point;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;},&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;p&gt;&lt;/p&gt;
&lt;h2 id=&quot;other-elliptical-arc-linksresources&quot;&gt;Other Elliptical Arc Links/Resources:&lt;/h2&gt;
&lt;p&gt;A small collection of links that helped me.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.w3.org/TR/SVG/implnote.html&quot;&gt;SVGWG Implementation Requirements&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://fridrich.blogspot.com/2011/06/bounding-box-of-svg-elliptical-arc.html&quot;&gt;Bounding Box of an SVG Elliptical Arc&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://java.net/projects/svgsalamander/sources/svn/content/trunk/svg-core/src/main/java/com/kitfox/svg/pathcmd/Arc.java&quot;&gt;svgsalamander Arc.java source&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://svn.apache.org/repos/asf/xmlgraphics/batik/branches/svg11/sources/org/apache/batik/ext/awt/geom/ExtendedGeneralPath.java&quot;&gt;Apache xmlgraphics ExtendedGeneralPath.java source&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id=&quot;arccurve-length-distance&quot;&gt;Arc/Curve Length (Distance)&lt;/h1&gt;
&lt;p&gt;Calculate the arc length/total distance of a curve/arc. It also returns some other useful/debug information that we use in &lt;code&gt;generateLinearCurve(...)&lt;/code&gt;(see below).&lt;/p&gt;
&lt;p&gt;Usage:&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Resolution is the number of segments we use to approximate&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;resolution&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;25&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;quadBezierArcLengthResult&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;approximateArcLengthOfCurve&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(resolution,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(t)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;pointOnQuadraticBezierCurve&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(startPoint,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;controlPoint1,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;endPoint,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;t);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;});&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;ellipticalArcArcLengthResult&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;approximateArcLengthOfCurve&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(resolution,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(t)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;pointOnEllipticalArc&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;startPoint,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;rx,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;ry,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;xAxisRotation,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;largeArcFlag,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;sweepFlag,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;endPoint,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;t,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;});&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #E45649&quot;&gt;console&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;log&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;Quad. Bezier arc length:&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;quadBezierArcLengthResult&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;arcLength&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #E45649&quot;&gt;console&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;log&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;Elliptical arc, arc length:&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;ellipticalArcArcLengthResult&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;arcLength&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;code-embed&quot; style=&quot;counter-set: line-number 263;&quot;&gt;
            &lt;header class=&quot;code-embed-header&quot;&gt;
              &lt;div&gt;
                &lt;a href=&quot;https://github.com/MadLittleMods/svg-curve-lib/blob/50b7761814384ba2497bb63cfa5417cb6cd85a5f/src/js/svg-curve-lib.js#L263-L300&quot; class=&quot;code-embed-header-filename&quot;&gt;src/js/svg-curve-lib.js&lt;/a&gt;
                &lt;span class=&quot;code-embed-header-subtext&quot;&gt;(snippet)&lt;/span&gt;
              &lt;/div&gt;
              &lt;div&gt;&lt;a href=&quot;https://github.com/MadLittleMods/svg-curve-lib/blob/50b7761814384ba2497bb63cfa5417cb6cd85a5f/src/js/svg-curve-lib.js#L263-L300&quot;&gt;Source on GitHub&lt;/a&gt;&lt;/div&gt;
            &lt;/header&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		approximateArcLengthOfCurve: &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(resolution,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;pointOnCurveFunc)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Resolution is the number of segments we use&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;resolution&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;resolution&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;?&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;resolution&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;500&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;resultantArcLength&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;arcLengthMap&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;[];&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;approximationLines&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;[];&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;prevPoint&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;pointOnCurveFunc&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;nextPoint;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;i&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;i&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;resolution;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;i&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;++&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;				&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;t&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;clamp&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(i&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;resolution),&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;				&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;nextPoint&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;pointOnCurveFunc&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(t);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;				&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;resultantArcLength&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;+=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;distance&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(prevPoint,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;nextPoint);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;				&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;approximationLines&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;push&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;([prevPoint,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;nextPoint]);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;				&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;arcLengthMap&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;push&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;({&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;					t&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;t,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;					arcLength&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;resultantArcLength&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;				&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;});&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;				&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;				&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;prevPoint&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;nextPoint;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Last stretch to the endpoint&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;nextPoint&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;pointOnCurveFunc&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;approximationLines&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;push&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;([prevPoint,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;nextPoint]);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;resultantArcLength&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;+=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;distance&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(prevPoint,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;nextPoint);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;arcLengthMap&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;push&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;({&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;				t&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;				arcLength&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;resultantArcLength&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;});&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;				arcLength&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;resultantArcLength,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;				arcLengthMap&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;arcLengthMap,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;				approximationLines&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;approximationLines&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;};&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;},&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;p&gt;&lt;/p&gt;
&lt;h1 id=&quot;linear-curvearc&quot;&gt;Linear Curve/Arc&lt;/h1&gt;
&lt;p&gt;A challenge I faced, was dealing with &lt;code&gt;t&lt;/code&gt; not being linear or having an even-distribution. This means that if you just sample &lt;code&gt;t&lt;/code&gt; at a constant interval, you will have more samples bunched up in the curvier parts.&lt;/p&gt;
&lt;p&gt;This at first seems good because you need the most detail in corners in order to accurately represent the curve, but it also leaves you with an unknown precision/error. So I decided to implement a linear curve function in order to get a known degree of accuracy. &lt;em&gt;I am not sure if this is actually better or worse for accuracy/precision.&lt;/em&gt; The linear curve function is also useful in games or animations where you want the object to travel along a curve at a constant rate. This will work for any &lt;code&gt;pointOnThing&lt;/code&gt; function.&lt;/p&gt;
&lt;p&gt;See also: &lt;a href=&quot;https://pomax.github.io/bezierinfo/#tracing&quot;&gt;Section 20. Tracing a curve at fixed distance intervals from A Primer on Bézier Curves&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;generateLinearCurve(...)&lt;/code&gt; will return a new function where you can pass in a &lt;code&gt;t&lt;/code&gt; [0, 1] and get a point on the curve back. Since &lt;code&gt;t&lt;/code&gt; will be linear with this, 0.5 is halfway along the curve, distance wise.&lt;/p&gt;
&lt;p&gt;Usage:&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Resolution is the number of segments we use to approximate&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;resolution&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;25&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;linearQuadBezier&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;generateLinearCurve&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(resolution,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(t)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;pointOnQuadraticBezierCurve&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(startPoint,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;controlPoint1,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;endPoint,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;t);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;});&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;linearEllipticalArc&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;generateLinearCurve&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(resolution,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(t)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;pointOnEllipticalArc&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;startPoint,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;rx,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;ry,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;xAxisRotation,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;largeArcFlag,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;sweepFlag,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;endPoint,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;t,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;});&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Pass in t [0, 1]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Returns a point along the curve&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;pt1&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;linearQuadBezier&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0.5&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;pt2&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;linearEllipticalArc&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0.5&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;code-embed&quot; style=&quot;counter-set: line-number 304;&quot;&gt;
            &lt;header class=&quot;code-embed-header&quot;&gt;
              &lt;div&gt;
                &lt;a href=&quot;https://github.com/MadLittleMods/svg-curve-lib/blob/50b7761814384ba2497bb63cfa5417cb6cd85a5f/src/js/svg-curve-lib.js#L304-L354&quot; class=&quot;code-embed-header-filename&quot;&gt;src/js/svg-curve-lib.js&lt;/a&gt;
                &lt;span class=&quot;code-embed-header-subtext&quot;&gt;(snippet)&lt;/span&gt;
              &lt;/div&gt;
              &lt;div&gt;&lt;a href=&quot;https://github.com/MadLittleMods/svg-curve-lib/blob/50b7761814384ba2497bb63cfa5417cb6cd85a5f/src/js/svg-curve-lib.js#L304-L354&quot;&gt;Source on GitHub&lt;/a&gt;&lt;/div&gt;
            &lt;/header&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Returns a function that will linearly interpolate along the curve u: [0, 1]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Inspired by: http://gamedev.stackexchange.com/a/5427/16587&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		generateLinearCurve: &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(resolution,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;pointOnCurveFunc)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Resolution is the number of segments we use to approximate&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;resolution&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;resolution&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;?&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;resolution&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;500&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;result&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;approximateArcLengthOfCurve&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(resolution,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;pointOnCurveFunc);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;arcLength&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;result&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;arcLength&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;arcLengthMap&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;result&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;arcLengthMap&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Transforms `u`[0-1] into a corresponding point along the curve. `u * arcLength`&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;transformer&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(u)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;				&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;u&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;clamp&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(u,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;				&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;targetDistanceFromStartingPoint&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;u&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;arcLength;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;				&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;resultantT&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;				&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;prevArcLength&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;				&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;prevT&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;				&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;arcLengthMap&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;every&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(entry)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;					&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;t&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;entry&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;t&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;					&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;arcLength&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;entry&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;arcLength&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;					&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Once we go a past our target&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;					&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Lets interpolate from a previous to current&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;					&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(arcLength&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;targetDistanceFromStartingPoint)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;						&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;endDiff&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;arcLength&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;targetDistanceFromStartingPoint;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;						&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;startDiff&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;targetDistanceFromStartingPoint&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;prevArcLength;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;						&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;linearFactor&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(startDiff&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(endDiff&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;startDiff))&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;||&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;						&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;resultantT&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;prevT&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(t&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;prevT)&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;linearFactor;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;						&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Break&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;						&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;false&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;					&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;					&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;prevArcLength&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;arcLength;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;					&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;prevT&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;t;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;					&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;true&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;				&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;});&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;				&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;pointOnCurveFunc&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(resultantT);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;};&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;transformer&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;arcLength&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;arcLength;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;transformer;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	}&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;p&gt;&lt;/p&gt;</content:encoded></item><item><title>Using libuv with Windows and Visual Studio: Getting Started</title><link>https://ericeastwood.com/blog/using-libuv-with-windows-and-visual-studio-getting-started/</link><guid isPermaLink="true">https://ericeastwood.com/blog/using-libuv-with-windows-and-visual-studio-getting-started/</guid><description>
libuv is a multi-platform support library with a focus on asynchronous I/O. It was primarily developed for use by Node.js, but it&apos;s also used by Luvit, Julia, pyuv, and others.


tldr: cross-platform console/terminal niceties
I was interested in this library because it has support for ANSI escape code controlled TTY which Windows doesn&apos;t really support on its own. This means cross-platform colored text. libuv is what Node.js uses for all of the CMD/console/terminal/shell niceness across platforms.
I found this library confusing and hard to get started with so I decided to consolidate various resources down to this simple tutorial.


Guide to Colored Text with libuv
This guide will go over getting started and setting up a project to work with libuv. By the end, you</description><pubDate>Wed, 01 Apr 2015 00:00:00 GMT</pubDate><content:encoded>&lt;blockquote&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/libuv/libuv&quot;&gt;libuv&lt;/a&gt; is a multi-platform support library with a focus on asynchronous I/O. It was primarily developed for use by &lt;a href=&quot;https://nodejs.org&quot;&gt;Node.js&lt;/a&gt;, but it&apos;s also used by &lt;a href=&quot;https://luvit.io/&quot;&gt;Luvit&lt;/a&gt;, &lt;a href=&quot;https://julialang.org/&quot;&gt;Julia&lt;/a&gt;, &lt;a href=&quot;https://github.com/saghul/pyuv&quot;&gt;pyuv&lt;/a&gt;, and &lt;a href=&quot;https://github.com/libuv/libuv/wiki/Projects-that-use-libuv&quot;&gt;others&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/libuv/libuv&quot;&gt;&lt;img src=&quot;/images/blog/using-libuv-with-windows-and-visual-studio-getting-started/libuv-logo.png&quot; alt=&quot;The libuv logo: a mean, green T-rex with a unicorn horn&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;tldr: cross-platform console/terminal niceties&lt;/p&gt;
&lt;p&gt;I was interested in this library because it has support for &lt;code&gt;ANSI escape code controlled TTY&lt;/code&gt; which Windows doesn&apos;t really support on its own. This means cross-platform colored text. &lt;a href=&quot;https://github.com/libuv/libuv&quot;&gt;&lt;code&gt;libuv&lt;/code&gt;&lt;/a&gt; is what &lt;a href=&quot;https://nodejs.org/&quot;&gt;Node.js&lt;/a&gt; uses for all of the CMD/console/terminal/shell niceness across platforms.&lt;/p&gt;
&lt;p&gt;I found this library confusing and hard to get started with so I decided to consolidate various resources down to this simple tutorial.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/using-libuv-with-windows-and-visual-studio-getting-started/ansi-color-codes.png&quot; alt=&quot;Many different colored text examples with their ANSI color code below&quot;&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h1 id=&quot;guide-to-colored-text-with-libuv&quot;&gt;Guide to Colored Text with &lt;code&gt;libuv&lt;/code&gt;&lt;/h1&gt;
&lt;p&gt;This guide will go over getting started and setting up a project to work with libuv. By the end, you will be outputting colored text in a console window.&lt;/p&gt;
&lt;h2 id=&quot;download-libuv&quot;&gt;Download &lt;code&gt;libuv&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;Download or clone &lt;a href=&quot;https://github.com/libuv/libuv&quot;&gt;libuv from the GitHub Repo&lt;/a&gt;. I used the &quot;Download zip&quot; button.&lt;/p&gt;
&lt;p&gt;You will need &lt;a href=&quot;https://www.python.org/&quot;&gt;Python 2.7&lt;/a&gt; and Visual Studio(I am using Visual Studio Community 2013) installed.&lt;/p&gt;
&lt;h2 id=&quot;build-libuv&quot;&gt;Build &lt;code&gt;libuv&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;Navigate to where you extracted libuv. Launch CMD prompt or PowerShell and run:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;vcbuild.bat&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;This call will generate &lt;code&gt;Debug/lib/libuv.lib&lt;/code&gt;.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;[It also] will checkout the GYP code into build/gyp and generate uv.sln as well as related project files.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;For more information, see the &lt;a href=&quot;https://github.com/libuv/libuv#windows&quot;&gt;build instructions in the repo README&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;create-an-empty-vs-project&quot;&gt;Create an Empty VS Project&lt;/h2&gt;
&lt;p&gt;Make a new Visual Studio Console application. Under &lt;strong&gt;Installed&lt;/strong&gt; -&gt; &lt;strong&gt;Visual C++&lt;/strong&gt; -&gt; &lt;strong&gt;Win32&lt;/strong&gt; -&gt; Select &lt;strong&gt;Win32 Console Application (Visual C++)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/using-libuv-with-windows-and-visual-studio-getting-started/vs-new-project.png&quot; alt=&quot;Visual Studio &amp;#x27;New Project&amp;#x27; dialog&quot;&gt;&lt;/p&gt;
&lt;p&gt;Press &quot;Next&quot; on the following screen, then check the &quot;Empty Project&quot; checkbox in the Win32 Application Wizard.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/using-libuv-with-windows-and-visual-studio-getting-started/win32-app-wizard-empty-project-checkbox.png&quot; alt=&quot;Pointing out the &amp;#x27;Empty Project&amp;#x27; checkbox in the Win32 Application Wizard&quot;&gt;&lt;/p&gt;
&lt;p&gt;Copy over the libuv &lt;code&gt;include&lt;/code&gt; folder and &lt;code&gt;Debug/lib/libuv.lib&lt;/code&gt; that were generated from the build into your VS project directory.&lt;/p&gt;
&lt;p&gt;Go to: &lt;strong&gt;Project Properties&lt;/strong&gt; -&gt; &lt;strong&gt;C/C++&lt;/strong&gt; -&gt; &lt;strong&gt;Additional Include Directories&lt;/strong&gt;. Then add an entry for the &lt;code&gt;include&lt;/code&gt; folder we just copied over.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/using-libuv-with-windows-and-visual-studio-getting-started/property-pages-include-directories-option.png&quot; alt=&quot;Property Pages dialog pointing out the &amp;#x27;Additional Include Directories&amp;#x27; option&quot;&gt;&lt;/p&gt;
&lt;p&gt;Right click on the project and go to &lt;code&gt;Add -&gt; Existing Item&lt;/code&gt;. Select the &lt;code&gt;lib/libuv.lib&lt;/code&gt; that was also copied over in a previous step.&lt;/p&gt;
&lt;p&gt;At this point, if you try to build, you will probably get a bunch &quot;already defined&quot; errors.&lt;/p&gt;
&lt;p&gt;Go to: &lt;strong&gt;Project Properties&lt;/strong&gt; -&gt; &lt;strong&gt;Linker&lt;/strong&gt; -&gt; &lt;strong&gt;Input&lt;/strong&gt; -&gt; &lt;strong&gt;Ignore Specific Default Libraries&lt;/strong&gt; and add &lt;code&gt;LIBCMTD.lib&lt;/code&gt;. &lt;em&gt;Thanks to &lt;a href=&quot;https://stackoverflow.com/a/19845109/796832&quot;&gt;AnT&apos;s answer on Stack Overflow&lt;/a&gt; for that tidbit.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/using-libuv-with-windows-and-visual-studio-getting-started/property-pages-ignore-default-libraries.png&quot; alt=&quot;Property Pages dialog pointing out the &amp;#x27;Ignore Specific Default Libraries&amp;#x27; option&quot;&gt;&lt;/p&gt;
&lt;h1 id=&quot;create-a-new-file-for-the-main-part-of-the-program&quot;&gt;Create a new file for the main part of the program&lt;/h1&gt;
&lt;p&gt;Make a new project source file: Right click on the &quot;Source Files&quot; folder in the Solutions Explorer and click &lt;strong&gt;Add&lt;/strong&gt; -&gt; &lt;strong&gt;New Item&lt;/strong&gt;. Name it &lt;code&gt;main.cpp&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Once you have the code below pasted in and saved, build the project. You can use &lt;code&gt;Ctrl+F5&lt;/code&gt; to make the console stay open.&lt;/p&gt;
&lt;h3 id=&quot;maincpp&quot;&gt;&lt;code&gt;main.cpp&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;The code is based on the simple example from the &lt;a href=&quot;https://nikhilm.github.io/uvbook/utilities.html#tty&quot;&gt;TTY section in the Utilities chapter of &lt;em&gt;An Introduction to libuv&lt;/em&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;It should spit out some cyan text on a blue background:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/using-libuv-with-windows-and-visual-studio-getting-started/hello-tty-cyan-text.png&quot; alt=&quot;&amp;#x27;Hello TTY&amp;#x27; cyan text with a blue background&quot;&gt;&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;#pragma&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;comment&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; (&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;lib&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;libuv.lib&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;#pragma&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;comment&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; (&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;lib&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;ws2_32.lib&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;#pragma&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;comment&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;lib&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;psapi.lib&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;#pragma&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;comment&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;lib&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;Iphlpapi.lib&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;#include&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&amp;#x3C;iostream&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;//#include &amp;#x3C;stdio.h&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;#include&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&amp;#x3C;string.h&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;//#include &amp;#x3C;unistd.h&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;//#include &amp;#x3C;io.h&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;#include&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&amp;#x3C;uv.h&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;uv_loop_t&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;loop;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;uv_tty_t&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; tty;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;main&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;() {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	loop &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;uv_default_loop&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;();&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;uv_tty_init&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(loop, &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;&amp;#x26;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;tty, &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;uv_tty_set_mode&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;&amp;#x26;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;tty, UV_TTY_MODE_NORMAL);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;	// Set as cyan text on blue background&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;uv_guess_handle&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;) &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; UV_TTY) {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;uv_write_t&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; req;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;uv_buf_t&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; buf;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;		//buf.base = &quot;\033[41;37m&quot;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;buf&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;base&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;\033&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;[44;36m&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;buf&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;len&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;strlen&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;buf&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;base&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;uv_write&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;&amp;#x26;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;req, (&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;uv_stream_t&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;&amp;#x26;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;tty, &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;&amp;#x26;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;buf, &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;NULL&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;	// Spit out the text&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;uv_write_t&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; req;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;uv_buf_t&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; buf;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;buf&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;base&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;Hello TTY&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;buf&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;len&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;strlen&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;buf&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;base&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;uv_write&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;&amp;#x26;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;req, (&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;uv_stream_t&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;&amp;#x26;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;tty, &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;&amp;#x26;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;buf, &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;NULL&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;	// Reset any ANSI styles from above&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; (&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;uv_guess_handle&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;) &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; UV_TTY) {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;uv_write_t&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; req;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;uv_buf_t&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; buf;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;buf&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;base&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;\033&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;[0m&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;buf&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;len&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;strlen&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;buf&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;base&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;uv_write&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;&amp;#x26;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;req, (&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;uv_stream_t&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;&amp;#x26;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;tty, &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;&amp;#x26;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;buf, &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;NULL&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;uv_tty_reset_mode&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;();&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;uv_run&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(loop, UV_RUN_DEFAULT);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h1 id=&quot;going-further&quot;&gt;Going further&lt;/h1&gt;
&lt;p&gt;Instead of having to write this 5-line monstrosity(below) every time you want to output something, I created a nice helper function, &lt;code&gt;ccout&lt;/code&gt; which is &quot;color cout&quot;.&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;uv_write_t&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; req;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;uv_buf_t&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; buf;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #E45649&quot;&gt;buf&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;base&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;Hello TTY&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #E45649&quot;&gt;buf&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;len&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;strlen&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;buf&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;base&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;uv_write&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;&amp;#x26;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;req, (&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;uv_stream_t&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;&amp;#x26;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;tty, &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;&amp;#x26;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;buf, &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;NULL&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;usage&quot;&gt;Usage:&lt;/h3&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;ccout&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;asdf&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;&amp;#x26;&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;uv_write_t&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(), (&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;uv_stream_t&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;&amp;#x26;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;tty);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Some ANSI colors&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;ccout&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;\033&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;[41;37mHello TTY&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;\n\033&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;[0m&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;&amp;#x26;&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;uv_write_t&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(), (&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;uv_stream_t&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;&amp;#x26;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;tty);&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;cccout-code&quot;&gt;&lt;code&gt;cccout&lt;/code&gt; Code&lt;/h3&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;#include&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&amp;#x3C;string.h&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;#include&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&amp;#x3C;regex&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;std::&lt;/span&gt;&lt;span style=&quot;color: #C18401&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;stripAnsiEscapeCodes&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(std::&lt;/span&gt;&lt;span style=&quot;color: #C18401&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;input&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;) {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;	// from: https://github.com/sindresorhus/ansi-regex/blob/47fb974630af70998157b30fad6eb5e5bd7c7cd6/index.js&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	std::regex &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;reg&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;(?:(?:&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;\033\\&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;[)|&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;\233&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;)(?:(?:[0-9]{1,3})?(?:(?:;[0-9]{0,3})*)?[A-M|f-m])|&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;\033&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;[A-M]&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	std::string output &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; std::&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;regex_replace&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(input, reg, &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; output;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;ccout&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(std::&lt;/span&gt;&lt;span style=&quot;color: #C18401&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;message&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;uv_write_t&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;req&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;uv_stream_t&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;handle&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;) {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;	// If the terminal doesn&apos;t support ANSI, strip it for clarity&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; (&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;uv_guess_handle&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;) &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;!=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; UV_TTY) {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		message &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;stripAnsiEscapeCodes&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(message);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;uv_buf_t&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; buf;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;buf&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;base&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; (&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;char*&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;message&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;c_str&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;();&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;buf&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;len&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;strlen&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;buf&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;base&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;uv_write&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(req, handle, &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;&amp;#x26;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;buf, &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;NULL&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;};&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h1 id=&quot;ansi-escape-codes&quot;&gt;ANSI Escape codes&lt;/h1&gt;
&lt;p&gt;The &lt;a href=&quot;https://en.wikipedia.org/wiki/ANSI_escape_code&quot;&gt;ANSI escape code Wikipedia page&lt;/a&gt; covers all of the nitty gritty details. Below are some of the basics you will probably want to use.&lt;/p&gt;
&lt;h2 id=&quot;resetdefault&quot;&gt;Reset/Default&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;\033[0m&lt;/code&gt;: Reset all attributes. It is good practice to put this at the end so that you don&apos;t step on anyone&apos;s toes.&lt;/p&gt;
&lt;p&gt;Here is a breakdown of this escape sequence:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;\033[&lt;/code&gt;: &lt;a href=&quot;https://en.wikipedia.org/wiki/ANSI_escape_code#Sequence_elements&quot;&gt;Control Sequence Introducer&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;\033&lt;/code&gt; is the ESC character.
&lt;ul&gt;
&lt;li&gt;decimal: &lt;code&gt;27&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;hexadecimal: &lt;code&gt;\x1B&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;octal: &lt;code&gt;\033&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;[&lt;/code&gt;: left bracket&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;0&lt;/code&gt;: SGR parameter code for Reset/Normal or &quot;all attributes off&quot;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;m&lt;/code&gt;: Select Graphic Rendition(SGR). Sets SGR parameters, including text color.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;color&quot;&gt;Color&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;30-37&lt;/code&gt;: Text/foreground color
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;90-97&lt;/code&gt;(not standard) for high intensity&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;40–47&lt;/code&gt;: Background color
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;100-107&lt;/code&gt;(not standard) for high intensity&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;High intensity can also be achieved in a more standard way by using a normal color alongside the bold(1) code. ex &lt;code&gt;\033[31;1mHeya. RedBold\033[0m&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/using-libuv-with-windows-and-visual-studio-getting-started/ansi-color-codes.png&quot; alt=&quot;Showing off all the colors possible along with their ANSI escape codes (also in the table below)&quot;&gt;&lt;/p&gt;


















































&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Color &lt;em&gt;(SGR)&lt;/em&gt;&lt;/th&gt;&lt;th&gt;Text/Foreground Code&lt;/th&gt;&lt;th&gt;Background Code&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;Black&lt;/td&gt;&lt;td&gt;30&lt;/td&gt;&lt;td&gt;40&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Red&lt;/td&gt;&lt;td&gt;31&lt;/td&gt;&lt;td&gt;41&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Green&lt;/td&gt;&lt;td&gt;32&lt;/td&gt;&lt;td&gt;42&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Yellow&lt;/td&gt;&lt;td&gt;33&lt;/td&gt;&lt;td&gt;43&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Blue&lt;/td&gt;&lt;td&gt;34&lt;/td&gt;&lt;td&gt;44&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Magenta&lt;/td&gt;&lt;td&gt;35&lt;/td&gt;&lt;td&gt;45&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Cyan&lt;/td&gt;&lt;td&gt;36&lt;/td&gt;&lt;td&gt;46&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;White&lt;/td&gt;&lt;td&gt;37&lt;/td&gt;&lt;td&gt;47&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;Here is the code I used to generate the image above:&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;std::string colorStringNormal &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;std::string colorStringCodeIndexNormal &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;std::string colorStringBold &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;std::string colorStringCodeIndexBold &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;std::string colorStringHighIntensity &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;std::string colorStringCodeIndexHighIntensity &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; (&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; i &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;; i &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;8&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;; i&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;++&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;) {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	colorStringNormal &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;+=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;\033&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;[&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; std::&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;to_string&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;30&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; i) &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;mHeya&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;\t\033&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;[0m&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	colorStringCodeIndexNormal &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;+=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; std::&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;to_string&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;30&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; i) &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	colorStringBold &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;+=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;\033&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;[&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; std::&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;to_string&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;30&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; i) &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;;1mHeya&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;\t\033&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;[0m&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	colorStringCodeIndexBold &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;+=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; std::&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;to_string&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;30&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; i) &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;;1&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	colorStringHighIntensity &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;+=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;\033&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;[&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; std::&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;to_string&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;90&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; i) &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;mHeya&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;\t\033&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;[0m&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	colorStringCodeIndexHighIntensity &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;+=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; std::&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;to_string&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;90&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; i) &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;\t&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;ccout&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(colorStringNormal &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;&amp;#x26;&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;uv_write_t&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(), (&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;uv_stream_t&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;&amp;#x26;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;tty);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;ccout&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(colorStringCodeIndexNormal &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;&amp;#x26;&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;uv_write_t&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(), (&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;uv_stream_t&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;&amp;#x26;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;tty);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;ccout&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(colorStringBold &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;&amp;#x26;&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;uv_write_t&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(), (&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;uv_stream_t&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;&amp;#x26;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;tty);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;ccout&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(colorStringCodeIndexBold &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;&amp;#x26;&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;uv_write_t&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(), (&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;uv_stream_t&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;&amp;#x26;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;tty);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;ccout&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(colorStringHighIntensity &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;&amp;#x26;&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;uv_write_t&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(), (&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;uv_stream_t&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;&amp;#x26;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;tty);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;ccout&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(colorStringCodeIndexHighIntensity &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;&amp;#x26;&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;uv_write_t&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(), (&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;uv_stream_t&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;&amp;#x26;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;tty);&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h1 id=&quot;learn-more-about-libuv&quot;&gt;Learn more about libuv&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://docs.libuv.org/en/v1.x/&quot;&gt;libuv API docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://nikhilm.github.io/uvbook/&quot;&gt;An Introduction to libuv (uvbook)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/thlorenz/learnuv&quot;&gt;learnuv by Thorsten Lorenz&lt;/a&gt;. I have not used this one, but it seems comprehensive.&lt;/li&gt;
&lt;/ul&gt;</content:encoded></item><item><title>Traces: Game Jam Post Mortem</title><link>https://ericeastwood.com/blog/traces-game-jam-post-mortem/</link><guid isPermaLink="true">https://ericeastwood.com/blog/traces-game-jam-post-mortem/</guid><description>I competed in the 2014 GD.SE Anniversary Game Jam and created Traces, a top-down pseudo-3D shooter.
In Traces, the goal is to power each building with a laser beam in sequential order all while killing or avoiding the enemy blobs. Activate the first building in sight and find the next building at the end of laser beam. Eat meat to restore your health.
Play Now (online)

I decided to make a web canvas game this time because I had a huge barrier to entry problem in my last game jam game, Super Bounce (you had to download the executable and then register the UI system I was using).
For this game, I used CraftyJS, a JavaScript canvas game engine library which worked great. I</description><pubDate>Mon, 10 Nov 2014 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;I competed in the &lt;a href=&quot;https://meta.gamedev.stackexchange.com/questions/1794/anniversary-game-jam-2014&quot;&gt;2014 GD.SE Anniversary Game Jam&lt;/a&gt; and created &lt;a href=&quot;https://madlittlemods.github.io/Traces/dist/&quot;&gt;Traces&lt;/a&gt;, a top-down pseudo-3D shooter.&lt;/p&gt;
&lt;p&gt;In Traces, the goal is to power each building with a laser beam in sequential order all while killing or avoiding the enemy blobs. Activate the first building in sight and find the next building at the end of laser beam. Eat meat to restore your health.&lt;/p&gt;
&lt;h1 id=&quot;play-now-online&quot;&gt;&lt;a href=&quot;https://madlittlemods.github.io/Traces/dist/&quot;&gt;Play Now &lt;em&gt;(online)&lt;/em&gt;&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/traces-game-jam-post-mortem/traces-action.gif&quot; alt=&quot;A screenshot of the Traces character shooting at some spiky blobs and activating the connection between buildings. Some food is on the floor and the building is blinking&quot;&gt;&lt;/p&gt;
&lt;p&gt;I decided to make a web canvas game this time because I had a huge barrier to entry problem in &lt;a href=&quot;/blog/21/super-bounce-a-game-jam-project&quot;&gt;my last game jam game, Super Bounce&lt;/a&gt; &lt;em&gt;(you had to download the executable and then register the UI system I was using)&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;For this game, I used &lt;a href=&quot;http://craftyjs.com/&quot;&gt;CraftyJS&lt;/a&gt;, a JavaScript canvas game engine library which worked great. I found it very easy to work with because of its mix and match entity and component system with scenes(similar to Unity). I also liked that it doesn&apos;t lock anything down to a particular method. I was even able to do custom canvas drawing with the normal canvas/context draw API.&lt;/p&gt;
&lt;h2 id=&quot;open-source&quot;&gt;&lt;a href=&quot;https://github.com/MadLittleMods/Traces&quot;&gt;Open Source&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;You can check out the &lt;a href=&quot;https://github.com/MadLittleMods/Traces&quot;&gt;full source on GitHub&lt;/a&gt;.&lt;/p&gt;
&lt;hr&gt;
&lt;h1 id=&quot;challenges&quot;&gt;Challenges:&lt;/h1&gt;
&lt;p&gt;Some pitfalls I found with Crafty was positioning the viewport &lt;em&gt;(see the &lt;a href=&quot;https://github.com/MadLittleMods/Traces/blob/master/src/js/components.js#L127&quot;&gt;&lt;code&gt;LerpCamera&lt;/code&gt; component for reference&lt;/a&gt;)&lt;/em&gt;, translating a mouse click into the game space, and working with a rotated entity. You can find a &lt;a href=&quot;https://github.com/MadLittleMods/Traces/blob/master/src/js/components.js#L407&quot;&gt;snippet on how to translate a click into game space in the source&lt;/a&gt;. I had to make a &lt;a href=&quot;https://github.com/MadLittleMods/Traces/blob/master/src/js/components.js#L42&quot;&gt;&lt;code&gt;2DExtended&lt;/code&gt; component&lt;/a&gt; which solved the rotated entity problem and added a few utility methods such as &lt;code&gt;getActualPosition&lt;/code&gt; that would get the actual (&lt;code&gt;x&lt;/code&gt;, &lt;code&gt;y&lt;/code&gt;) coordinate of the rotated entity. I suggest using this &lt;a href=&quot;https://github.com/towbi/CraftyEntityBoxOverlays&quot;&gt;BoxOverlays debug component&lt;/a&gt; &lt;em&gt;(pictured below)&lt;/em&gt; to make sense of how Crafty&apos;s 2D component works.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/traces-game-jam-post-mortem/bounding-boxes-animation.gif&quot; alt=&quot;An animation of the different bounding boxes that you have to think about as the character is rotated&quot;&gt;&lt;/p&gt;
&lt;p&gt;Another issue I ran into was using SVG&apos;s and resizing sprites. The &lt;a href=&quot;http://craftyjs.com/api/Crafty-sprite.html&quot;&gt;built-in sprite component&lt;/a&gt; was missing features for what I needed, even for my simple use case. But since Crafty is not constraining, I just used canvas &lt;code&gt;context.drawImage(...)&lt;/code&gt; with a scratch canvas. You can checkout the &lt;a href=&quot;https://github.com/MadLittleMods/Traces/blob/master/src/js/components.js#L597&quot;&gt;&lt;code&gt;Meat&lt;/code&gt; component&lt;/a&gt; to see a simple example. One note when working with the raw canvas context: make sure you are setting the &lt;code&gt;x&lt;/code&gt;, &lt;code&gt;y&lt;/code&gt;, &lt;code&gt;w&lt;/code&gt;, &lt;code&gt;h&lt;/code&gt; on the &lt;code&gt;2D&lt;/code&gt; component properly. This allows Crafty&apos;s draw manager to know when to redraw the entity appropriately. Also, use &lt;code&gt;context.translate(e.pos._x, e.pos._y);&lt;/code&gt; at the beginning of the draw call &lt;em&gt;(see source for examples)&lt;/em&gt; and then draw from reference (0, 0). This is the proper way to draw something at the appropriate position and rotation will be funky if you do not do this.&lt;/p&gt;
&lt;p&gt;I referenced the Crafty source code many times to see what happens behind the scenes. The online documentation looks like it is generated from the source&apos;s comments which makes the source very easy to follow and great for offline reference.&lt;/p&gt;
&lt;p&gt;Another thing to be aware of is event binding and making sure to clean up binds completely when changing scenes or removing an entity/component. To make all of this easy, I made an &lt;a href=&quot;https://github.com/MadLittleMods/Traces/blob/master/src/js/components.js#L13&quot;&gt;&lt;code&gt;EventManager&lt;/code&gt; component&lt;/a&gt; which turned binding into a fire and forget type experience. All you have to do is add the &lt;code&gt;EventManager&lt;/code&gt; component to the entity and make a &lt;code&gt;cleanBind&lt;/code&gt; call.&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Add the `EventManager` component&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Params:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;//	Event name&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;//	Callback when the event fires&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;//	Entity/Component name of parent Entity/Component. This is optional but necessary if you are removing components from entities.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #E45649&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;cleanBind&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;damaged&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;_onDamaged&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;PlayerCharacter&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;An aspect missing in Crafty is built-in graphical gizmos for debugging. I made a very simple &lt;a href=&quot;https://github.com/MadLittleMods/Traces/blob/master/src/js/components.js#L192&quot;&gt;colored square entity called &lt;code&gt;DebugMarker&lt;/code&gt;&lt;/a&gt; which I used heavily to find out where things were spawning, etc. A text gizmo would be another helpful addition.&lt;/p&gt;</content:encoded></item><item><title>Render Components and Modular UI: Getting Started (RequireJS)</title><link>https://ericeastwood.com/blog/render-components-and-modular-ui-getting-started-requirejs/</link><guid isPermaLink="true">https://ericeastwood.com/blog/render-components-and-modular-ui-getting-started-requirejs/</guid><description>
I discovered Render Components from Guy Bedford in an email exchange where he laid out some basic code for the concept. Bedford has a small writeup on the ZestJS site, but this guide will cover all the same points. Because there is no written spec for Render Components, this guide covers one way of implementing this concept/idea. Details like naming conventions might not be the exact same as someone else.

This guide will go over building a pseudo-YouTube video site and workflow setup to start using Render Components.
Render components are applicable in many situations, including game UI. Game UI is just like a single page web app. I used render components in Unity with Coherent UI for my games, Radius and</description><pubDate>Sat, 20 Sep 2014 00:00:00 GMT</pubDate><content:encoded>&lt;blockquote&gt;
&lt;p&gt;I discovered &lt;code&gt;Render Components&lt;/code&gt; from &lt;a href=&quot;https://github.com/guybedford&quot;&gt;Guy Bedford&lt;/a&gt; in an email exchange where he laid out some basic code for the concept. Bedford has a small writeup on the &lt;a href=&quot;http://zestjs.org/&quot;&gt;ZestJS site&lt;/a&gt;, but this guide will cover all the same points. Because there is no written spec for &lt;code&gt;Render Components&lt;/code&gt;, this guide covers one way of implementing this concept/idea. Details like naming conventions might not be the exact same as someone else.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;This guide will go over building a pseudo-YouTube video site and workflow setup to start using &lt;code&gt;Render Components&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Render components are applicable in many situations, including game UI. Game UI is just like a single page web app. I used render components in Unity with Coherent UI for my games, &lt;a href=&quot;https://github.com/MadLittleMods/Radius&quot;&gt;Radius&lt;/a&gt; and &lt;a href=&quot;https://github.com/MadLittleMods/Super-Bounce&quot;&gt;Super Bounce&lt;/a&gt;. You can check them out on &lt;a href=&quot;https://github.com/MadLittleMods/Radius&quot;&gt;GitHub&lt;/a&gt;.&lt;/p&gt;
&lt;h1 id=&quot;about-render-components&quot;&gt;About Render Components&lt;/h1&gt;
&lt;p&gt;Benefits of &lt;code&gt;Render Components&lt;/code&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Modular:&lt;/strong&gt; Code organization&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;No hassle Module Dependencies:&lt;/strong&gt; Dependencies flow with the module; No need to worry about injecting them yourself. A neat little bundle of code.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Reusable, Shareable code:&lt;/strong&gt; Reuse modules throughout and even between apps&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Easy to follow file/folder structure:&lt;/strong&gt; Although you don&apos;t have to conform to the folder structure in this guide, it makes it easy to find any module or sub-module.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Seamless binding:&lt;/strong&gt; Elements can be bound to your JavaScript without any hassle.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;A &lt;code&gt;Render Component&lt;/code&gt; is simply a JavaScript object with two functions, &lt;code&gt;template&lt;/code&gt; and &lt;code&gt;attach&lt;/code&gt;.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;template&lt;/code&gt;: Returns a template string. This will most likely be a Handlebars template but any template system is supported by currying.
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;context&lt;/code&gt;: A JavaScript object(key-value store) which holds contextual data to display in the module&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;attach&lt;/code&gt;: A callback after the template string is rendered in the DOM.
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;options&lt;/code&gt;: A JavaScript object(key-value store) which holds any special attachment options passed in by &lt;code&gt;render.*&lt;/code&gt; calls.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;elements&lt;/code&gt;: An array of jQuery DOM elements from the rendered template. You can use this to restrict your binding to only the elements added by the template.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;renderComponent&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;template&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(context)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;&amp;#x3C;h1&gt;Hello&amp;#x3C;/h1&gt;&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;},&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;attach&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(options,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;elements)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Do some Binding&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// $.filterFind is not a native jQuery function&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(restrictTo).&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;filterFind&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;h1&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;).&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;css&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;color&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;red&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;},&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;};&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you want to see a barebones project using &lt;code&gt;Render Components&lt;/code&gt;, I have a &lt;a href=&quot;https://github.com/MadLittleMods/render-components-demo/tree/master/barebones-demo&quot;&gt;project on GitHub&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;In order to get the style, script, and other module dependencies to flow with each &lt;code&gt;Render Component&lt;/code&gt;, we will be using &lt;a href=&quot;http://requirejs.org/&quot;&gt;RequireJS&lt;/a&gt;, a dependency loader and manager. I first thought of RequireJS as a backend on the frontend because I was used to assembling the whole page in PHP/Python on the server and sending it out to the client. As I started getting into RequireJS, it became clear that it is much more and thrives as a way to serve all of the different pages/content in a single page web application.&lt;/p&gt;
&lt;h1 id=&quot;things-to-know-before-getting-started&quot;&gt;Things to know before getting started&lt;/h1&gt;
&lt;h2 id=&quot;demo&quot;&gt;&lt;a href=&quot;https://madlittlemods.github.io/render-components-demo/video-site-demo/&quot;&gt;Demo&lt;/a&gt;&lt;/h2&gt;
&lt;h2 id=&quot;source-code-finished&quot;&gt;&lt;a href=&quot;https://github.com/MadLittleMods/render-components-demo/tree/master/video-site-demo&quot;&gt;Source Code (finished)&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;A &lt;a href=&quot;https://madlittlemods.github.io/render-components-demo/video-site-demo/&quot;&gt;fully functional demo&lt;/a&gt; of what will be created using this guide is available on the &lt;a href=&quot;https://madlittlemods.github.io/render-components-demo/video-site-demo/&quot;&gt;GitHub project pages&lt;/a&gt; for the repo.&lt;/p&gt;
&lt;p&gt;You can also find the &lt;a href=&quot;https://github.com/MadLittleMods/render-components-demo/tree/master/video-site-demo&quot;&gt;source code for the finished project on GitHub&lt;/a&gt; so you can reference it at any time.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/render-components-and-modular-ui-getting-started-requirejs/app-diagram-color-block-version.png&quot; alt=&quot;Side-by-side screenshot of the final app and a color-blocked version of the app where each color represents a module/component we will be building&quot;&gt;&lt;/p&gt;
&lt;p&gt;This guide looks long(because it is not paginated) but it can be accomplished in 30 minutes.&lt;/p&gt;
&lt;p&gt;To actually utilize the &lt;code&gt;Render Components&lt;/code&gt;, we will be using &lt;a href=&quot;https://gist.github.com/MadLittleMods/c23bceb37836daa24398&quot;&gt;&lt;code&gt;renderer.js&lt;/code&gt;&lt;/a&gt; and &lt;code&gt;renderer.helper.js&lt;/code&gt; (included in the getting started package) which is &lt;a href=&quot;https://gist.github.com/MadLittleMods/c23bceb37836daa24398&quot;&gt;available on GitHub&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;If you do not want to deal with the Sass, download the CSS files instead. You can use your own favorite Sass compiler but in this guide, I will be using &lt;a href=&quot;https://gulpjs.com/&quot;&gt;Gulp&lt;/a&gt; to compile the Sass(&lt;code&gt;.scss&lt;/code&gt;) files into CSS. There is already a &lt;code&gt;gulpfile.js&lt;/code&gt; so just navigate to the project directory and run &lt;code&gt;npm install&lt;/code&gt; once to install the dependencies and then the &lt;code&gt;gulp&lt;/code&gt; command whenever you want to recompile. &lt;strong&gt;I realize this is a burden because you need Node.js, so I have linked the complete and compiled CSS wherever I am using Sass;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;You will find that each module follows the same pattern.&lt;/p&gt;
&lt;h1 id=&quot;getting-started-hello-world&quot;&gt;Getting Started: Hello World&lt;/h1&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/MadLittleMods/render-components-demo/raw/master/video-site-getting-started.zip&quot;&gt;Download the Getting Started Video Site package on GitHub&lt;/a&gt;. This is a nice starting point because it includes all of the necessary scripts, basic styles, and assets.&lt;/p&gt;
&lt;p&gt;Next we need to configure RequireJS. We are going to start with a &quot;Hello World&quot; type goal so you understand the basics of RequireJS and make sure things work at a basic level.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In &lt;code&gt;js/require.conf.js&lt;/code&gt;:&lt;/strong&gt;&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// The following code is wrapped in this immediately invoking function&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Because the jsHint linter does not like the &quot;use strict&quot; tag dangling&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// in the outer scope in case we concatenate a bunch of JavaScript together&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// that is non-strict&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;()&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;use strict&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Our RequireJS Configuration&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;require&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;config&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;({&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    paths&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Make sure to leave off the extension `.js`&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// module-name: path-to-script&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;      jquery&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;lib/jquery-1.11.1&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;},&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;});&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Do some Hello World&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;require&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;([&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;jquery&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;],&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;($)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(document).&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;ready&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;()&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;body&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;).&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;append&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;&amp;#x3C;h1&gt;Hello World&amp;#x3C;/h1&gt;&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;});&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;});&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;})();&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In the &lt;code&gt;index.html&lt;/code&gt;, add in the following script tag to the bottom of the &lt;code&gt;&amp;#x3C;body&gt;&lt;/code&gt;. This loads up our RequireJS configuration and includes the RequireJS library into the page. &lt;em&gt;Note the trailing extension is omitted in the path to our configuration in the &lt;code&gt;data-main&lt;/code&gt; attribute.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In &lt;code&gt;index.html&lt;/code&gt;, add:&lt;/strong&gt;&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;text/JavaScript&quot;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;data-main&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;js/require.conf&quot;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;src&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;js/lib/require.js&quot;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You should now see a big &quot;Hello World&quot; when you visit &lt;code&gt;index.html&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/render-components-and-modular-ui-getting-started-requirejs/hello-world-html.png&quot; alt=&quot;Basic &amp;#x27;Hello World&amp;#x27; text on a HTML page&quot;&gt;&lt;/p&gt;
&lt;h1 id=&quot;your-first-render-component&quot;&gt;Your first Render Component&lt;/h1&gt;
&lt;p&gt;First we need to update our RequireJS configuration to add some more libraries and plugins.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In &lt;code&gt;js/require.conf.js&lt;/code&gt;, update to:&lt;/strong&gt;&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// The following code is wrapped in this immediately invoking function&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Because the jsHint linter does not like the &quot;use strict&quot; tag dangling&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// in the outer scope in case we concatenate a bunch of JavaScript together&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// that is non-strict&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;()&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;use strict&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;require&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;config&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;({&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    paths&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;      jquery&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;lib/jquery-1.11.1&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;jquery-ui&apos;&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;lib/jquery-ui-1.11.1&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;jquery-utility&apos;&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;jquery.utility&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;      handlebars&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;lib/handlebars-v1.3.0&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;handlebars-runtime&apos;&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;lib/handlebars.runtime-v1.3.0&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;amd-loader&apos;&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;lib/amd-loader&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;      hbs&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;lib/require-hbs&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;      css&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;lib/require-css&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;      renderer&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;renderer&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;},&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    shim&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;jquery-ui&apos;&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;        deps&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;jquery&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;],&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;},&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;jquery-utility&apos;&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;        deps&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;jquery&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;],&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;},&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;      handlebars&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;        exports&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;Handlebars&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;},&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;handlebars-runtime&apos;&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;        exports&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;Handlebars&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;},&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;},&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;});&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Your Hello World code here...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// It can stay for now&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;})();&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Next: Create a folder called &lt;code&gt;pages&lt;/code&gt; at the root of the project and then create a file called &lt;code&gt;video.page.js&lt;/code&gt; in that folder.&lt;/p&gt;
&lt;p&gt;We are using &lt;a href=&quot;https://github.com/guybedford&quot;&gt;Guy Bedford&lt;/a&gt;&apos;s awesome RequireJS plugins, &lt;a href=&quot;https://github.com/guybedford/hbs&quot;&gt;&lt;code&gt;require-hbs&lt;/code&gt;&lt;/a&gt; and &lt;a href=&quot;https://github.com/guybedford/require-css&quot;&gt;&lt;code&gt;require-css&lt;/code&gt;&lt;/a&gt;, in the following snippet. Don&apos;t worry, the plugins are already included in the Getting Started package.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In &lt;code&gt;pages/video.page.js&lt;/code&gt;:&lt;/strong&gt;&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;define&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;([&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;hbs!./video/video&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;css!./video/video&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;./video/video.bits&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;],&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;tmpl,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;videocss,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;videoScriptBits,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    template&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;tmpl,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;attach&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(options,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;elements)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// You can do stuff here&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// even return some methods&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Bind some stuff&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;videoScriptBits&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;bind&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(elements);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;},&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;};&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;});&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;In &lt;code&gt;pages/video/video.hbs&lt;/code&gt;:&lt;/strong&gt;&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;player-area&quot;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;player-wrapper&quot;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;video&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;video&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;player-wrapper-resize-handle ui-resizable-handle ui-resizable-s&quot;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;svg&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;icon&quot;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;use&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;xlink:href&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;#shape-resize-vertical-handle&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;/&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;svg&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;bottom-area&quot;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;info-wrapper&quot;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;info-box&quot;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;h2&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;Info&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;h2&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;comments&quot;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;h2&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;Comments&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;h2&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;aside&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;suggestion-sidebar&quot;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;h2&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;Suggestions&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;h2&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;aside&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;a href=&quot;https://raw.githubusercontent.com/MadLittleMods/render-components-demo/master/video-site-demo/pages/video/video.scss&quot;&gt;Download the styles for this page module&lt;/a&gt; and save it as &lt;strong&gt;&lt;code&gt;pages/video/video.scss&lt;/code&gt;&lt;/strong&gt;. &lt;em&gt;&lt;a href=&quot;https://raw.githubusercontent.com/MadLittleMods/render-components-demo/master/video-site-demo/pages/video/video.css&quot;&gt;Here is the CSS file&lt;/a&gt; if you don&apos;t want to deal with Sass.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://raw.githubusercontent.com/MadLittleMods/render-components-demo/master/video-site-demo/pages/video/video.bits.js&quot;&gt;Download the JavaScript for the page module&lt;/a&gt; and save it as &lt;strong&gt;&lt;code&gt;pages/video/video.bits.js&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;To render the page module, Add the following &lt;code&gt;pages&lt;/code&gt; module to the bottom of the &lt;code&gt;paths&lt;/code&gt; object in the RequireJS configuration. &lt;em&gt;Don&apos;t forget the trailing comma on the line above&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In &lt;code&gt;js/require.conf.js&lt;/code&gt;:&lt;/strong&gt;&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;pages&apos;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;../pages&apos;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Also, change the &quot;Hello World&quot; block from before, at the bottom of our config, to the following&lt;br&gt;
&lt;strong&gt;In &lt;code&gt;js/require.conf.js&lt;/code&gt;:&lt;/strong&gt;&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Load up the video page&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// This is sort of like an initialization of the application&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;require&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;([&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;require&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;jquery&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;renderer&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;],&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(require,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;$,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;renderer)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;renderer&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;append&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;pages/video.page&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;/*context*/&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;},&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;/*attachOptions*/&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;},&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;body&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;),&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(attachReturn)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// ...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;},&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;require,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;});&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Compile the Sass files if necessary, and refresh the &lt;code&gt;index.html&lt;/code&gt; page. You should see a wireframe-like structure of our video site.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/render-components-and-modular-ui-getting-started-requirejs/basic-structure-styles.png&quot; alt=&quot;Wireframe-like structure of our video site with a bit of styles now&quot;&gt;&lt;/p&gt;
&lt;p&gt;To give you a sense of all the modules and how they fit in, here is a nice diagram:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/render-components-and-modular-ui-getting-started-requirejs/modules-breakdown.png&quot; alt=&quot;Color blocked diagram differentiating the modules we will be building and putting on the page, &amp;#x27;video-player&amp;#x27;, &amp;#x27;video-info&amp;#x27;, &amp;#x27;comments&amp;#x27;, &amp;#x27;comment&amp;#x27;, &amp;#x27;video-suggestion&amp;#x27;&quot;&gt;&lt;/p&gt;
&lt;h1 id=&quot;adding-the-player-module&quot;&gt;Adding the player module&lt;/h1&gt;
&lt;p&gt;As you will see, the modules of the page are set up the same way the over arching page is. There is no special styling or scripts for this module because the &lt;code&gt;&amp;#x3C;video&gt;&lt;/code&gt; element takes care of it all. All we have to do is give it the src path to the video in the Handlebars template. Create a &lt;code&gt;modules&lt;/code&gt; folder in the root of the project.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In &lt;code&gt;modules/video-player.module.js&lt;/code&gt;:&lt;/strong&gt;&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;define&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;([&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;hbs!./video-player/video-player&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;],&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(tmpl)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    template&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;tmpl,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;attach&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(options,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;elements)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{},&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;};&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;});&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;In &lt;code&gt;modules/video-player/video-player.hbs&lt;/code&gt;:&lt;/strong&gt;&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;video&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;src&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;{{video-src}}&quot;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;controls&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;video&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Add the following &lt;code&gt;modules&lt;/code&gt; module to the bottom of the &lt;code&gt;paths&lt;/code&gt; object in the RequireJS configuration.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In &lt;code&gt;js/require.conf.js&lt;/code&gt;:&lt;/strong&gt;&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;modules&apos;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;../modules&apos;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;We need to add some context to fill in the &lt;code&gt;{{video-src}}&lt;/code&gt; Handlebars expression above in the template.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In &lt;code&gt;js/require.conf.js&lt;/code&gt;:&lt;/strong&gt;&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// ...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// The variables we are going to pass into our template&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;context&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;video-src&apos;&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;video/big_buck_bunny.webm&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;};&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #E45649&quot;&gt;renderer&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;append&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;pages/video.page&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;context,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{},&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;body&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;),&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(attachReturn)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// ...&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Next, we need to update our video page to actually use this module.&lt;/p&gt;
&lt;p&gt;The following makes use of our &lt;code&gt;js/helpers/renderer.helper.js&lt;/code&gt; Handlebars helper, which makes it easy to inline &lt;code&gt;Render Components&lt;/code&gt; in our Handlebars templates. &lt;em&gt;Keep in mind that this helper relies &lt;a href=&quot;https://gist.github.com/MadLittleMods/c23bceb37836daa24398&quot;&gt;&lt;code&gt;js/renderer.js&lt;/code&gt;&lt;/a&gt; which you can use to render &lt;code&gt;Render Components&lt;/code&gt; on the fly in your own scripts.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In &lt;code&gt;pages/video/video.hbs&lt;/code&gt;, update:&lt;/strong&gt;&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;player-area&quot;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;player-wrapper&quot;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    {{@helpers/renderer.helper module=&quot;modules/video-player.module&quot; }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You should now have a playable video on the page.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/render-components-and-modular-ui-getting-started-requirejs/app-with-playable-video.png&quot; alt=&quot;App with a playable video and the different sections with headings&quot;&gt;&lt;/p&gt;
&lt;h1 id=&quot;adding-the-video-info-module&quot;&gt;Adding the video info module&lt;/h1&gt;
&lt;p&gt;&lt;strong&gt;In &lt;code&gt;modules/video-info.module.js&lt;/code&gt;:&lt;/strong&gt;&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;define&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;([&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;hbs!./video-info/video-info&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;],&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(tmpl)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    template&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;tmpl,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;attach&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(options,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;elements)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{},&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;};&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;});&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;In &lt;code&gt;modules/video-info/video-info.hbs&lt;/code&gt;:&lt;/strong&gt;&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;h2&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;video-info-title&quot;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;{{video-title}}&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;h2&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;video-info-description&quot;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;{{video-description}}&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Add more information to the page context.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In &lt;code&gt;js/require.conf.js&lt;/code&gt;:&lt;/strong&gt;&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// ...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;context&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;video-title&apos;&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;Big Buck Bunny&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;video-description&apos;&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;Big Buck Bunny (code-named Peach) is a short computer animated comedy film by the Blender Institute, part of the Blender Foundation. Like the foundation&apos;s previous film Elephants Dream, the film was made using Blender, a free software application for animation made by the same foundation. It was released as an Open Source film under Creative Commons License Attribution 3.0. - Wikipedia&quot;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;video-src&apos;&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;video/big_buck_bunny.webm&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;};&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// ...&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;In &lt;code&gt;pages/video/video.hbs&lt;/code&gt;, update:&lt;/strong&gt;&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;// ...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;bottom-area&quot;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;info-wrapper&quot;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;info-box&quot;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;{{@helpers/renderer.helper module=&quot;modules/video-info.module&quot; }}&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/render-components-and-modular-ui-getting-started-requirejs/app-with-video-info.png&quot; alt=&quot;Adding in the video info to the page&quot;&gt;&lt;/p&gt;
&lt;h1 id=&quot;adding-the-commenting-system&quot;&gt;Adding the Commenting System&lt;/h1&gt;
&lt;p&gt;The Commenting System module is the most complex for this project because it has sub-modules, script binding, and styles.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In &lt;code&gt;modules/comments.module.js&lt;/code&gt;:&lt;/strong&gt;&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;define&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;([&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;hbs!./comments/comments&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;css!./comments/comments&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;./comments/comments.bits&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;],&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(tmpl,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;commentscss,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;commentsScriptBits)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    template&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;tmpl,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;attach&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(options,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;elements)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;commentsScriptBits&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;bind&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(elements);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;},&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;};&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;});&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;In &lt;code&gt;modules/comments/comments.hbs&lt;/code&gt;:&lt;/strong&gt;&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;h2&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;Comments&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;h2&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;form&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;comment-form&quot;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;input&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;text&quot;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;comment-form-name-input js-name-input&quot;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;placeholder&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;Your Name&quot;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;br&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;comment-form-message-input&quot;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;textarea&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;js-message-input&quot;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;placeholder&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;Say something...&quot;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;textarea&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;br&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;input&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;submit&quot;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;value&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;Post&quot;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;form&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;ul&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;comment-list&quot;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;li&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;Sample comment&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;li&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;li&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;Don&apos;t worry, we will replace these soon&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;li&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;ul&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;a href=&quot;https://raw.githubusercontent.com/MadLittleMods/render-components-demo/master/video-site-demo/modules/comments/comments.css&quot;&gt;Download the styles for this page module&lt;/a&gt; and save it as &lt;strong&gt;&lt;code&gt;modules/comments/comments.css&lt;/code&gt;&lt;/strong&gt;. No Sass in this one.&lt;/p&gt;
&lt;p&gt;We will come back to this script after we have the &lt;code&gt;comment&lt;/code&gt; sub-module complete:&lt;br&gt;
&lt;strong&gt;In &lt;code&gt;modules/comments/comments.bits.js&lt;/code&gt;:&lt;/strong&gt;&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;define&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;([&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;module&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// we can use `module.id` for binding or something...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;jquery&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;jquery-utility&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;renderer&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;require&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;],&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(module,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;$,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;$utility,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;renderer,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;require)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;use strict&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;bind&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(restrictTo)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Set restricTo default&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;restrictTo&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;typeof&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;restrictTo&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;!==&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;undefined&apos;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;?&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;restrictTo&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(document);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(document).&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;ready&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;()&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(restrictTo)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;          &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;filterFind&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;.comment-form&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;          &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;on&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;submit&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(e)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;            &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;e&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;preventDefault&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;();&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;            &lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// We will fix this up later using the actually `comment` module&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;            &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(restrictTo).&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;filterFind&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;.comment-list&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;).&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;append&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;&amp;#x3C;li&gt;Heya, I loved this video&amp;#x3C;/li&gt;&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;          &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;});&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;});&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;},&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;};&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;});&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;In &lt;code&gt;pages/video/video.hbs&lt;/code&gt;, update:&lt;/strong&gt;&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;// ...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;bottom-area&quot;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;info-wrapper&quot;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    // ...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;comments&quot;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;{{@helpers/renderer.helper module=&quot;modules/comments.module&quot; }}&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/render-components-and-modular-ui-getting-started-requirejs/app-with-comment-form.png&quot; alt=&quot;Adding in the comment form so people can write new comments&quot;&gt;&lt;/p&gt;
&lt;h2 id=&quot;adding-the-comment-sub-module&quot;&gt;Adding the Comment sub-module&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;In &lt;code&gt;modules/comments/modules/comment.module.js&lt;/code&gt;:&lt;/strong&gt;&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;define&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;([&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;require&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;hbs!./comment/comment&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;css!./comment/comment&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;],&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;require,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;tmpl,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;commentcss,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    template&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;tmpl,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;attach&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(options,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;elements)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{},&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;};&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;});&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;In &lt;code&gt;modules/comments/modules/comment/comment.hbs&lt;/code&gt;:&lt;/strong&gt;&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;li&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;comment&quot;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;img&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;src&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;{{avatar-src}}&quot;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;comment-avatar&quot;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;comment-body&quot;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;h4&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;comment-name&quot;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;{{name}}&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;h4&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;comment-message&quot;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;{{message}}&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;li&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;a href=&quot;https://raw.githubusercontent.com/MadLittleMods/render-components-demo/master/video-site-demo/modules/comments/modules/comment/comment.scss&quot;&gt;Download the styles for this page module&lt;/a&gt; and save it as &lt;strong&gt;&lt;code&gt;modules/comments/modules/comment/comment.scss&lt;/code&gt;&lt;/strong&gt;. &lt;em&gt;&lt;a href=&quot;https://raw.githubusercontent.com/MadLittleMods/render-components-demo/master/video-site-demo/modules/comments/modules/comment/comment.css&quot;&gt;Here is the CSS file&lt;/a&gt; if you don&apos;t want to deal with Sass.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Compile the Sass.&lt;/p&gt;
&lt;p&gt;Update the context to add in some comments to display.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In &lt;code&gt;js/require.conf.js&lt;/code&gt;:&lt;/strong&gt;&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;context&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// ...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;comment-list&apos;&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;[&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;      name&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;Eric&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;      message&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;Lorem ipsum dolor sit amet, consectetuer adipiscing elit.&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;avatar-src&apos;&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;https://secure.gravatar.com/avatar/ac5413?s=64&amp;#x26;d=identicon&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;},&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;      name&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;MLM&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;      message&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;Aenean commodo ligula eget dolor. Aenean massa.&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;avatar-src&apos;&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;https://secure.gravatar.com/avatar/ab1234?s=64&amp;#x26;d=identicon&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;},&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;],&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;};&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;In &lt;code&gt;modules/comments/comments.hbs&lt;/code&gt;, update:&lt;/strong&gt;&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;// ...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;ul&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;comment-list&quot;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  {{#each comment-list}} {{@helpers/renderer.helper module=&quot;modules/comments/modules/comment.module&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  }} {{/each}}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;ul&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/render-components-and-modular-ui-getting-started-requirejs/app-with-individual-comments.png&quot; alt=&quot;Individual comments on the page, standard layout with an avatar on the left wit the author and comment on the right&quot;&gt;&lt;/p&gt;
&lt;h1 id=&quot;add-in-video-suggestions-finishing-it-off&quot;&gt;Add in video suggestions, finishing it off&lt;/h1&gt;
&lt;p&gt;Lastly, we need to add in the video suggestion in the sidebar. By now you probably have the hang of &lt;code&gt;Render Components&lt;/code&gt; and could probably try doing this last module on your own before reading on. Use the context below as a guide on how you would set up the template.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In &lt;code&gt;js/require.conf.js&lt;/code&gt;:&lt;/strong&gt;&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;context&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// ...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;video-suggestion-list&apos;&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;[&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;video-title&apos;&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;Lorem Ipsum&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;thumbnail-src&apos;&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;https://secure.gravatar.com/avatar/e1e1e1?s=64&amp;#x26;d=identicon&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;channel-name&apos;&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;Dummy&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;view-count&apos;&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;23921685&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;},&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;video-title&apos;&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;Aenean massa&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;thumbnail-src&apos;&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;https://secure.gravatar.com/avatar/aeeaaa?s=64&amp;#x26;d=identicon&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;channel-name&apos;&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;Dummy2&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;view-count&apos;&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2364&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;},&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;],&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;};&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;In &lt;code&gt;modules/video-suggestion.module.js&lt;/code&gt;:&lt;/strong&gt;&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;define&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;([&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;hbs!./video-suggestion/video-suggestion&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;css!./video-suggestion/video-suggestion&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;],&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(tmpl,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;css)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    template&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;tmpl,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;attach&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(options,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;elements)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{},&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;};&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;});&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;In &lt;code&gt;modules/video-suggestion/video-suggestion.hbs&lt;/code&gt;:&lt;/strong&gt;&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;video-suggestion&quot;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;img&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;src&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;{{thumbnail-src}}&quot;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;video-suggestion-thumbnail&quot;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;video-suggestion-body&quot;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;h3&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;video-suggestion-title&quot;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;{{video-title}}&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;h2&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;video-suggestion-channel-name&quot;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			{{channel-name}}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;video-suggestion-view-count&quot;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			{{@helpers/toCommaSepNum.helper view-count}} views&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;a href=&quot;https://raw.githubusercontent.com/MadLittleMods/render-components-demo/master/video-site-demo/modules/video-suggestion/video-suggestion.scss&quot;&gt;Download the styles for this page module&lt;/a&gt; and save it as &lt;strong&gt;&lt;code&gt;modules/video-suggestion/video-suggestion.scss&lt;/code&gt;&lt;/strong&gt;. &lt;em&gt;&lt;a href=&quot;https://raw.githubusercontent.com/MadLittleMods/render-components-demo/master/video-site-demo/modules/video-suggestion/video-suggestion.css&quot;&gt;Here is the CSS file&lt;/a&gt; if you don&apos;t want to deal with Sass.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In &lt;code&gt;pages/video/video.hbs&lt;/code&gt;, update:&lt;/strong&gt;&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;// ...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;bottom-area&quot;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  // ...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;aside&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;suggestion-sidebar&quot;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;h2&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;Suggestions&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;h2&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    {{#each video-suggestion-list}} {{@helpers/renderer.helper&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    module=&quot;modules/video-suggestion.module&quot; }} {{/each}}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;aside&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;hr&gt;
&lt;p&gt;You should now have a complete pseudo-YouTube video site made with Render Components:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/render-components-and-modular-ui-getting-started-requirejs/app-with-video-suggestions.png&quot; alt=&quot;Video suggestions in the sidebar below the video&quot;&gt;&lt;br&gt;
&lt;img src=&quot;/images/blog/render-components-and-modular-ui-getting-started-requirejs/modules-breakdown.png&quot; alt=&quot;A breakdown of of the modules again&quot;&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h1 id=&quot;looking-for-more-examples&quot;&gt;Looking for more examples?&lt;/h1&gt;
&lt;p&gt;Check out my two open source Unity games &lt;a href=&quot;https://github.com/MadLittleMods/Radius&quot;&gt;on GitHub&lt;/a&gt; (&lt;a href=&quot;https://github.com/MadLittleMods/Radius&quot;&gt;Radius&lt;/a&gt; and &lt;a href=&quot;https://github.com/MadLittleMods/Super-Bounce&quot;&gt;Super Bounce&lt;/a&gt;). These projects are from before I figured out all the best practices for this article but the core idea is the same.&lt;/p&gt;</content:encoded></item><item><title>Super Bounce: a Game Jam Project</title><link>https://ericeastwood.com/blog/super-bounce-a-game-jam-project/</link><guid isPermaLink="true">https://ericeastwood.com/blog/super-bounce-a-game-jam-project/</guid><description>I recently participated in the 3 day 2014 GDSE Game Jam and created a fairly solid result: Super Bounce. You can download it for Windows and Mac at superbouncegame.com . Also, as per the open source guideline of the game jam, the game&apos;s source code is available on GitHub.
Play Now

The journey
Super Bounce is based on the super bouncing physics bug from Halo 2. To do a super bounce: just land on a mesh edge with a &quot;crouch&quot; and a relatively high velocity to soar to the sky. I did a lot of super bouncing back in the Halo 2, original Xbox days and even had my own bouncing clan. You can find a lot of super bouncing montages on YouTube</description><pubDate>Mon, 14 Jul 2014 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;I recently participated in the 3 day &lt;a href=&quot;https://meta.gamedev.stackexchange.com/q/1637/16587&quot;&gt;2014 GDSE Game Jam&lt;/a&gt; and created a fairly solid result: &lt;strong&gt;&lt;a href=&quot;http://superbouncegame.com&quot;&gt;Super Bounce&lt;/a&gt;&lt;/strong&gt;. You can download it for Windows and Mac at &lt;a href=&quot;http://superbouncegame.com&quot;&gt;superbouncegame.com&lt;/a&gt; . Also, as per the open source guideline of the game jam, the game&apos;s &lt;a href=&quot;https://github.com/MadLittleMods/Super-Bounce&quot;&gt;source code is available on GitHub&lt;/a&gt;.&lt;/p&gt;
&lt;h1 id=&quot;play-now&quot;&gt;&lt;a href=&quot;http://superbouncegame.com&quot;&gt;Play Now&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/super-bounce-a-game-jam-project/super-bounce-game-tower.png&quot; alt=&quot;Screenshot of the Super Bounce game looking up at a massive tower and some players up on buildings&quot;&gt;&lt;/p&gt;
&lt;h1 id=&quot;the-journey&quot;&gt;The journey&lt;/h1&gt;
&lt;p&gt;&lt;a href=&quot;http://superbouncegame.com&quot;&gt;Super Bounce&lt;/a&gt; is based on the &lt;a href=&quot;http://halo.wikia.com/wiki/Super_bouncing&quot;&gt;super bouncing physics bug from Halo 2&lt;/a&gt;. To do a super bounce: just land on a mesh edge with a &quot;crouch&quot; and a relatively high velocity to soar to the sky. I did a lot of super bouncing back in the Halo 2, original Xbox days and even had my own bouncing clan. You can find a lot of super bouncing montages on YouTube if you want to see the original mechanic in action.&lt;/p&gt;
&lt;p&gt;This was my first time participating in a game jam, and everything went smooth without many snags. I was able to start off with a nice base because I used another open source project I created, &lt;a href=&quot;https://github.com/MadLittleMods/Radius&quot;&gt;Radius, an open source Unity project reference&lt;/a&gt; that covered most aspects needed like multiplayer, UI, etc.&lt;/p&gt;
&lt;p&gt;The biggest hurdle of this game was figuring out if you are landing on an edge. There are a lot of scripts out there will give you the closest vertex on a mesh but that was not good enough for this game. You can see what I am doing in the &lt;a href=&quot;https://github.com/MadLittleMods/Super-Bounce/blob/master/SuperBounceGame/Assets/Scripts/EdgeDetection.cs&quot;&gt;source code&lt;/a&gt; but the gist of it is that I loop through the mesh and find the closest vertex. Then, I find all connecting points to that vertex from the triangles array to form the lines and see if the player is close enough to be considered colliding with them. The current implementation is still not bullet proof but it does detect edge collision very well.&lt;/p&gt;
&lt;p&gt;Another point of conflict was the character controller. I had a script from an earlier project that used &lt;a href=&quot;https://docs.unity3d.com/ScriptReference/Rigidbody.SweepTestAll.html&quot;&gt;SweepTestAll&lt;/a&gt; and the complex collider capability of a rigidbody. This worked well but you could easily walk/clip through walls. The second iteration still used a rigidbody but set the velocity attribute directly. This solved the walking through walls issue but messed with the bouncing mechanic. The player would sometimes bounce/slide off the edge and fall into/through corners. The latest version, 0.5, uses the standard capsule character controller in Unity because it works well for a humanoid and the other scripts were just something I made for complex shapes.&lt;/p&gt;
&lt;h1 id=&quot;gameplay&quot;&gt;Gameplay&lt;/h1&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/super-bounce-a-game-jam-project/super-bounce-action.gif&quot; alt=&quot;Action shot showing off the controls and actually going for your first super bounce&quot;&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Jump off a building and land on a mesh edge while holding &lt;strong&gt;&lt;code&gt;Shift&lt;/code&gt;&lt;/strong&gt; to super bounce&lt;/li&gt;
&lt;li&gt;When landing on an edge, you need have a velocity that is greater than a normal jump. Jumping off of a building is usually necessary for the initial bounce.&lt;/li&gt;
&lt;li&gt;Land on multiple edges, for example on a corner, to bounce higher.&lt;/li&gt;
&lt;li&gt;Chain bounces together by continuing to land on edges to get to taller buildings.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;em&gt;Note: I have not implemented the literal &quot;crouch&quot; as it was known in Halo 2. Instead, you just have to hold &lt;strong&gt;&lt;code&gt;Shift&lt;/code&gt;&lt;/strong&gt; while landing on the edge.&lt;/em&gt;&lt;/p&gt;</content:encoded></item><item><title>Texture Tiling based on object Size/Scale in Unity</title><link>https://ericeastwood.com/blog/texture-tiling-based-on-object-sizescale-in-unity/</link><guid isPermaLink="true">https://ericeastwood.com/blog/texture-tiling-based-on-object-sizescale-in-unity/</guid><description>Say you want to create a ground plane that can be scaled to any size and maintain the same texture size on the surface without having to change the material tiling every time. Since this is not default functionality or some setting you can turn on, how can this be accomplished? I had this exact same question about a year ago when messing with Unity. DaveA answered a bit vaguely and re-reading his answer now, I implemented exactly what he suggested. You can see how to create both ideas he suggested in this article.

There are two methods to achieve texture tiling based on size. The first way is adjusting actual texture tiling property whenever a change is detected in scale.</description><pubDate>Sun, 25 May 2014 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Say you want to create a ground plane that can be scaled to any size and maintain the same texture size on the surface without having to change the material tiling every time. Since this is not default functionality or some setting you can turn on, how can this be accomplished? I had this exact same &lt;a href=&quot;https://answers.unity3d.com/questions/517555/texture-tiling-based-on-object-sizescale.html&quot;&gt;question&lt;/a&gt; about a year ago when messing with Unity. DaveA answered a bit vaguely and re-reading his answer now, I implemented exactly what he suggested. You can see how to create both ideas he suggested in this article.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/texture-tiling-based-on-object-sizescale-in-unity/unity-plane-surfaces-showing-texture-scaling.png&quot; alt=&quot;Various plane surfaces in Unity at different sizes but the same texture scale&quot;&gt;&lt;/p&gt;
&lt;p&gt;There are two methods to achieve texture tiling based on size. The first way is adjusting actual texture tiling property whenever a change is detected in scale. The second option is to procedurally generate a plane mesh with many segments all with overlapping UVs.&lt;/p&gt;
&lt;h1 id=&quot;method-1-texture-tiling&quot;&gt;Method #1: Texture Tiling&lt;/h1&gt;
&lt;p&gt;I recommend this approach because it doesn&apos;t waste memory and resources on a bunch of vertices like method #2 requires.&lt;/p&gt;
&lt;p&gt;We will be monitoring &lt;a href=&quot;https://docs.unity3d.com/Documentation/ScriptReference/Transform-lossyScale.html&quot;&gt;Transform.lossyScale&lt;/a&gt; for changes because it is the world scale, and we only care about the plane&apos;s actual size which includes any parents scaling. Once we detect a change, update &lt;a href=&quot;https://docs.unity3d.com/Documentation/ScriptReference/Material-mainTextureScale.html&quot;&gt;Material.mainTextureScale&lt;/a&gt; to the appropriate tiling for that new size.&lt;/p&gt;
&lt;p&gt;Another point of interest is the &lt;code&gt;[ExecuteInEditMode]&lt;/code&gt; attribute which will make the script run in the editor even without playing.&lt;/p&gt;
&lt;p&gt;Note: Unity&apos;s default &lt;code&gt;Plane&lt;/code&gt; primitive seems to have its UVs upside down. You can model your own 10mx10m, 10x10 segment plane in a 3D program(Blender, C4D, 3ds max). Or you can use &lt;a href=&quot;https://github.com/MadLittleMods/Radius/blob/master/Radius/Assets/Scripts/ProceduralMeshes/ProceduralPlane.cs&quot;&gt;this procedural plane script&lt;/a&gt; which is available in my project &lt;a href=&quot;https://github.com/MadLittleMods/Radius&quot;&gt;Radius, on GitHub&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/texture-tiling-based-on-object-sizescale-in-unity/unity-texture-uvs-upside-down.png&quot; alt=&quot;Showing how the actual texture appears upside down in Unity because the UVs are upside down in relation to the Z axis&quot;&gt;&lt;/p&gt;
&lt;h2 id=&quot;setup-and-usage&quot;&gt;Setup and Usage:&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Drag &lt;code&gt;TextureTilingController.cs&lt;/code&gt; onto a Plane Primitive
&lt;ul&gt;
&lt;li&gt;Adjust the &quot;Texture to Mesh Z&quot; option to set the texture scale in the game world&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Now you can adjust the plane size however big or small you want (use &lt;code&gt;Transform&lt;/code&gt; scale properties for &lt;code&gt;x&lt;/code&gt; and &lt;code&gt;z&lt;/code&gt;).
&lt;ul&gt;
&lt;li&gt;Whenever the object changes size, it will adjust the texture tiling automatically.&lt;/li&gt;
&lt;li&gt;You can also manually update the tiling using the &quot;Update Tiling&quot; option in the context menu.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/texture-tiling-based-on-object-sizescale-in-unity/texture-tiling-controller.png&quot; alt=&quot;Showing off the TextureTilingController script component on a plane.&quot;&gt;&lt;/p&gt;
&lt;h3 id=&quot;texturetilingcontrollercs&quot;&gt;&lt;a href=&quot;https://github.com/MadLittleMods/Radius/blob/master/Radius/Assets/Scripts/TextureTilingController.cs&quot;&gt;&lt;code&gt;TextureTilingController.cs&lt;/code&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #C18401&quot;&gt;UnityEngine&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #C18401&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #C18401&quot;&gt;Collections&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #C18401&quot;&gt;ExecuteInEditMode&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #C18401&quot;&gt;TextureTilingController&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; : &lt;/span&gt;&lt;span style=&quot;color: #C18401&quot;&gt;MonoBehaviour&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Give us the texture so that we can scale proportionally the width according to the height variable below&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// We will grab it from the meshRenderer&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #C18401&quot;&gt;Texture&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;texture&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;textureToMeshZ&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2f&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;; &lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Use this to constrain texture to a certain size&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #C18401&quot;&gt;Vector3&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;prevScale&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;Vector3&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;one&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;prevTextureToMeshZ&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;1f&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Use this for initialization&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;Start&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; () {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;prevScale&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;gameObject&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;transform&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;lossyScale&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;prevTextureToMeshZ&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;textureToMeshZ&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;UpdateTiling&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;();&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Update is called once per frame&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;Update&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; () {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// If something has changed&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;gameObject&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;transform&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;lossyScale&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;!=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;prevScale&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;||&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;!Mathf&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;Approximately&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;textureToMeshZ&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;prevTextureToMeshZ&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;UpdateTiling&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;();&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Maintain previous state variables&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;prevScale&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;gameObject&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;transform&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;lossyScale&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;prevTextureToMeshZ&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;textureToMeshZ&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	[&lt;/span&gt;&lt;span style=&quot;color: #C18401&quot;&gt;ContextMenu&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;UpdateTiling&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;)]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;UpdateTiling&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;()&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// A Unity plane is 10 units x 10 units&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; planeSizeX &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;10f&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; planeSizeZ &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;10f&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Figure out texture-to-mesh width based on user set texture-to-mesh height&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; textureToMeshX &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; ((&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;texture&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;width/&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;texture&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;height&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;textureToMeshZ&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;gameObject&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;renderer&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;material&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;mainTextureScale&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #C18401&quot;&gt;Vector2&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;planeSizeX*gameObject&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;transform&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;lossyScale&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;x/textureToMeshX&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;planeSizeZ*gameObject&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;transform&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;lossyScale&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;z/textureToMeshZ&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h1 id=&quot;method-2-overlapping-uvs-method&quot;&gt;Method #2: Overlapping UVs Method&lt;/h1&gt;
&lt;p&gt;In order to have your texture tile seamlessly across the plane using the overlapping UV technique, there are two things to take into account:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Make a procedural plane mesh that adapts the number segments depending on the proportion of the texture&lt;/li&gt;
&lt;li&gt;Make each pair of triangles that make up one rectangle overlap in the UV map.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This means you will have 6 vertices for every iteration of the tiling. I do not recommend this for large ground planes.&lt;br&gt;
Note: Unity has a 65k(&lt;a href=&quot;https://answers.unity3d.com/questions/255405/vertex-limit.html#answer-container-255477&quot;&gt;65,534&lt;/a&gt;) vertex limit for a single mesh.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/texture-tiling-based-on-object-sizescale-in-unity/overlapping-vs-non-overlapping-uvs.png&quot; alt=&quot;Showing off the the difference between overlapping UVs vs non-overlapping UVs. The bottom-left corning is (0, 0) and the top-right corner is (1, 1)&quot;&gt;&lt;/p&gt;
&lt;p&gt;I use this same technique for making any sized territory in &lt;a href=&quot;https://github.com/MadLittleMods/Radius&quot;&gt;Radius&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/texture-tiling-based-on-object-sizescale-in-unity/transparent-circle-territories.png&quot; alt=&quot;Screenshot from Radius of the transparent circle territories useful for king of hill or land grab type game types&quot;&gt;&lt;/p&gt;
&lt;h2 id=&quot;setup-and-usage-1&quot;&gt;Setup and Usage:&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Drag &lt;code&gt;ProceduralPlane.cs&lt;/code&gt; and &lt;code&gt;GroundController.cs&lt;/code&gt; onto an empty gameobject.&lt;/li&gt;
&lt;li&gt;To adjust the plane size, edit the &lt;code&gt;Width&lt;/code&gt; and &lt;code&gt;Height&lt;/code&gt; properties of &lt;code&gt;GroundController.cs&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Fill in the references for &lt;code&gt;Procedural Plane&lt;/code&gt; and &lt;code&gt;Texture&lt;/code&gt;. Drag the object with script in the hierarchy tab onto the &lt;code&gt;Procedural Plane&lt;/code&gt; field. Drag the texture you are going to tile from the &lt;code&gt;Project&lt;/code&gt; tab onto the &lt;code&gt;Texture&lt;/code&gt; field.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/texture-tiling-based-on-object-sizescale-in-unity/procedural-plane-script.png&quot; alt=&quot;Showing off the ProceduralPlane script component on an empty gameobject&quot;&gt;&lt;/p&gt;
&lt;h3 id=&quot;proceduralplanecs&quot;&gt;&lt;a href=&quot;https://github.com/MadLittleMods/Radius/blob/master/Radius/Assets/Scripts/ProceduralMeshes/ProceduralPlane.cs&quot;&gt;&lt;code&gt;ProceduralPlane.cs&lt;/code&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;You can get the &lt;a href=&quot;https://github.com/MadLittleMods/Radius/blob/master/Radius/Assets/Scripts/ProceduralMeshes/ProceduralPlane.cs&quot;&gt;procedural plane script&lt;/a&gt; in my project &lt;a href=&quot;https://github.com/MadLittleMods/Radius&quot;&gt;Radius, on GitHub&lt;/a&gt;.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Requires: &lt;a href=&quot;https://github.com/MadLittleMods/Radius/blob/master/Radius/Assets/Scripts/ProceduralMeshes/MeshUtils.cs&quot;&gt;&lt;code&gt;MeshUtils.cs&lt;/code&gt;&lt;/a&gt; also available in &lt;a href=&quot;https://github.com/MadLittleMods/Radius&quot;&gt;Radius&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;groundcontrollercs&quot;&gt;&lt;code&gt;GroundController.cs&lt;/code&gt;&lt;/h3&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #C18401&quot;&gt;UnityEngine&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #C18401&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #C18401&quot;&gt;Collections&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #C18401&quot;&gt;ExecuteInEditMode&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #C18401&quot;&gt;GroundController&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; : &lt;/span&gt;&lt;span style=&quot;color: #C18401&quot;&gt;MonoBehaviour&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #C18401&quot;&gt;ProceduralPlane&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;proceduralPlane&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;Width&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;10f&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;Height&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;10f&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Give us the texture so that we can scale proportionally the width according to the height variable below&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// We will grab it from the meshRenderer&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #C18401&quot;&gt;Texture&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;texture&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;textureToMeshZ&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2f&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;; &lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Use this to constrain texture to a certain size&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;prevWidth&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;10f&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;prevHeight&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;10f&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;prevTextureToMeshZ&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2f&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Use this for initialization&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;Start&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; () {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;prevWidth&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;Width&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;prevHeight&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;Height&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;prevTextureToMeshZ&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;textureToMeshZ&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Do calculations and Generate the mesh&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;UpdatePlaneSize&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;();&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Update is called once per frame&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;Update&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; () {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// If something has changed&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;Width&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;!=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;prevWidth&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;||&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;Height&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;!=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;prevHeight&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;||&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;textureToMeshZ&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;!=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;prevTextureToMeshZ&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;UpdatePlaneSize&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;();&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Maintain previous state variables&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;prevWidth&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;Width&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;prevHeight&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;Height&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;prevTextureToMeshZ&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;textureToMeshZ&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	[&lt;/span&gt;&lt;span style=&quot;color: #C18401&quot;&gt;ContextMenu&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;UpdatePlaneSize&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;)]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;UpdatePlaneSize&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;()&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;//Debug.Log(&quot;updating ground plane&quot;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// We will pack as many height segments in collider height&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;proceduralPlane&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;SegmentsZ&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; (&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;Mathf&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;Floor&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;((&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;Height/&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;textureToMeshZ&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Multiply amount of height segments by the texture-to-mesh height&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// This will not be the same as the collider height.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;proceduralPlane&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;Height&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;proceduralPlane&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;SegmentsZ&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;textureToMeshZ&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Figure out texture-to-mesh width based on user set texture-to-mesh height&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; textureToMeshX &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; ((&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;texture&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;width/&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;texture&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;height&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;textureToMeshZ&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Proportionally pack in the width segments&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;proceduralPlane&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;SegmentsX&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; (&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;Mathf&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;Floor&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;((&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;Width/textureToMeshX&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Multiply amount of width segments by the texture-to-mesh width&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;proceduralPlane&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;Width&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;proceduralPlane&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;SegmentsX&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;textureToMeshX&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Generate mesh&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;proceduralPlane&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;RecalculateMesh&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;();&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content:encoded></item><item><title>BeagleBone Black: Ubuntu Getting Started</title><link>https://ericeastwood.com/blog/beaglebone-black-ubuntu-getting-started/</link><guid isPermaLink="true">https://ericeastwood.com/blog/beaglebone-black-ubuntu-getting-started/</guid><description>I was really intrigued by the BeagleBone Black&apos;s (BBB) low cost, great performance, and IO all on the familiar Ubuntu OS. I am still quite new to the BeagleBone Black and hope to create some great projects with it in the future.
This is a quick guide to get you up and running with Ubuntu on your BeagleBone Black. I created this guide because many of the guides and instructions are scattered across many places and I wanted a concise place to reference.
Flashing/Installing Ubuntu on your BeagleBone Black
Download the latest Ubuntu image. Pick the latest .img.xz file (on the bottom) from the rcn-ee site
ex.
http://rcn-ee.net/deb/flasher/saucy/BBB-eMMC-flasher-ubuntu-13.10-2014-03-27-2gb.img.xz
Extract the .img.xz download to get the .img file. You can use 7zip to extract it. If you</description><pubDate>Sat, 24 May 2014 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;I was really intrigued by the BeagleBone Black&apos;s (BBB) low cost, great performance, and IO all on the familiar Ubuntu OS. I am still quite new to the BeagleBone Black and hope to create some great projects with it in the future.&lt;/p&gt;
&lt;p&gt;This is a quick guide to get you up and running with Ubuntu on your BeagleBone Black. I created this guide because many of the guides and instructions are scattered across many places and I wanted a concise place to reference.&lt;/p&gt;
&lt;h1 id=&quot;flashinginstalling-ubuntu-on-your-beaglebone-black&quot;&gt;Flashing/Installing Ubuntu on your BeagleBone Black&lt;/h1&gt;
&lt;p&gt;Download the latest Ubuntu image. Pick the latest &lt;code&gt;.img.xz&lt;/code&gt; file (on the bottom) from the &lt;a href=&quot;http://rcn-ee.net/deb/flasher/saucy/&quot;&gt;rcn-ee site&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;ex.&lt;br&gt;
&lt;code&gt;http://rcn-ee.net/deb/flasher/saucy/BBB-eMMC-flasher-ubuntu-13.10-2014-03-27-2gb.img.xz&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Extract the &lt;code&gt;.img.xz&lt;/code&gt; download to get the &lt;code&gt;.img&lt;/code&gt; file. You can use &lt;a href=&quot;http://www.7-zip.org/&quot;&gt;7zip&lt;/a&gt; to extract it. If you didn&apos;t add the extension when installing 7zip: &lt;strong&gt;Open With&lt;/strong&gt; -&gt; &lt;strong&gt;7zip&lt;/strong&gt; -&gt; &lt;strong&gt;7zFM.exe&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Download and install &lt;a href=&quot;https://sourceforge.net/projects/win32diskimager/&quot;&gt;Win32 Disk Imager&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Plug in your microSD card that is at least 8gb. You can use any adapter or USB card reader. Look at the file explorer to find the drive letter.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/beaglebone-black-ubuntu-getting-started/sd-card-usb-adapter.png&quot; alt=&quot;SD Card USB Adapter&quot;&gt;&lt;/p&gt;
&lt;p&gt;Start Win32 Disk Imager and browse for the &lt;code&gt;.img&lt;/code&gt; file. Select the &lt;strong&gt;correct&lt;/strong&gt; drive letter from the drop down.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;This process will rewrite all data on the microSD card so make sure you backup anything you might want on it.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Press the Write button. The process will take a bit of time and will come up with write complete dialog when done.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/beaglebone-black-ubuntu-getting-started/write-to-micro-sd-with-win32-disk-imager.png&quot; alt=&quot;Write to microSD with Win32 Disk Imager&quot;&gt;&lt;/p&gt;
&lt;p&gt;Safely Remove the microSD from your computer. Make sure your BeagleBone Black is shutdown and not powered. Also unplug the ethernet because it consumes a bit of power.&lt;/p&gt;
&lt;p&gt;Plug in the microSD into the BBB. While you hold the User Boot (S2) button down, plug in power to the board via USB or 5v adapter. The 4 lights should light up then change away. After that you can release User Boot button.&lt;/p&gt;
&lt;p&gt;The flashing process should take about 25-45 minutes. There is not a good way to tell if it actually flashing. When I did it the &lt;code&gt;D2&lt;/code&gt;(0) and &lt;code&gt;D4&lt;/code&gt;(3) LEDs were blinking a lot. When the process is done, the blinking should completely stop and ALL 4 LEDs will be lit up.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/beaglebone-black-ubuntu-getting-started/bbb-leds-flashing-done.png&quot; alt=&quot;4 LEDs - Flashing done&quot;&gt;&lt;/p&gt;
&lt;p&gt;Note: &lt;em&gt;If after 45 minutes, the LEDs are still not solid, power off the board (hold the power button down for ~8 seconds, until all the LEDs turn off) and try again.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Power off the board (power button, 8 seconds). Remove the microSD card.&lt;/p&gt;
&lt;p&gt;Power the board back on and you should be able to play with Ubuntu now!&lt;/p&gt;
&lt;p&gt;Keep in mind that this is not Ubuntu Desktop; If you plug in the micro-hdmi, you will see the same stuff as you do when you SSH into your board with PuTTY.&lt;/p&gt;
&lt;h1 id=&quot;more-getting-started&quot;&gt;More? Getting Started&lt;/h1&gt;
&lt;h2 id=&quot;ssh-into-your-board&quot;&gt;SSH into your board&lt;/h2&gt;
&lt;p&gt;When your plug in your board via USB, it should show up as a flash drive (mass storage). Make sure you go through the &lt;code&gt;Start.htm&lt;/code&gt; and install all of the necessary drivers including the USB to virtual Ethernet driver. &lt;em&gt;If you are running Windows 8, use &lt;a href=&quot;https://beagleboard.org/Community/Forums?place=msg%2Fbeagleboard%2F_y-fIgg-J7I%2FkwINwKI9WvAJ&quot;&gt;these instructions&lt;/a&gt; on how to install unsigned drivers.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;If you&apos;re used to SSHing into things, here is the command you can run:&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;ssh ubuntu@192.168.7.2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;# password is &quot;temppwd&quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Otherwise, here is a GUI program on how to accomplish the same thing:&lt;/p&gt;
&lt;!-- prettier-ignore --&gt;
&lt;ol&gt;
&lt;li&gt;Visit the BBB IP (will probably be &lt;code&gt;192.168.7.2&lt;/code&gt;). You can find it in the &lt;code&gt;Start.htm&lt;/code&gt; (under step #3) but you can just open &lt;code&gt;BASIC_START.htm&lt;/code&gt; and it will redirect you to it.&lt;/li&gt;
&lt;li&gt;Open your favorite SSH program of choice. We&apos;re going to be using &lt;a href=&quot;https://www.chiark.greenend.org.uk/~sgtatham/putty/download.html&quot;&gt;PuTTY&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;In the &lt;code&gt;Host Name (or IP Address)&lt;/code&gt; field, enter your BBB IP.&lt;/li&gt;
&lt;li&gt;Change the connection type to &lt;code&gt;SSH&lt;/code&gt; and make sure the &lt;code&gt;Port&lt;/code&gt; field is 22.&lt;br&gt;
&lt;img src=&quot;/images/blog/beaglebone-black-ubuntu-getting-started/bbb-putty-configuration.png&quot; alt=&quot;BeagleBone Black PuTTy configuration&quot;&gt;&lt;/li&gt;
&lt;li&gt;Click the &lt;code&gt;Open&lt;/code&gt; button at the bottom to start your session. It will ask about SSH key stuff if you are accessing for the first time, just click accept/yes/save.&lt;/li&gt;
&lt;li&gt;For the &lt;code&gt;login as&lt;/code&gt; prompt, Enter &lt;code&gt;ubuntu&lt;/code&gt; and press enter.&lt;/li&gt;
&lt;li&gt;For the password, enter &lt;code&gt;temppwd&lt;/code&gt; because this is the default.&lt;/li&gt;
&lt;li&gt;Change the default password so others can not login: &lt;code&gt;passwd&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;Enter in the current in the current password &lt;code&gt;temppwd&lt;/code&gt;. Then your new password twice.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&quot;create-your-own-root-user&quot;&gt;Create your own root user&lt;/h2&gt;
&lt;!-- prettier-ignore --&gt;
&lt;ol&gt;
&lt;li&gt;SSH into your BBB (see instructions above)&lt;/li&gt;
&lt;li&gt;Add a user: &lt;code&gt;sudo adduser yourownusernamehere&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Edit the sudo configuration: &lt;code&gt;sudo visudo&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Use the arrow keys and find the section that looks like this:
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;# User privilege specification&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;root	ALL=(ALL:ALL) ALL&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Add root privileges to your new user. Under that section add the following line: &lt;code&gt;yourownusernamehere ALL=(ALL:ALL) ALL&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Ctrl+x&lt;/code&gt; to exit. Type &lt;code&gt;y&lt;/code&gt;, enter. And finally press &lt;code&gt;Enter&lt;/code&gt; to complete the save.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&quot;updateupgrade&quot;&gt;Update/Upgrade&lt;/h2&gt;
&lt;p&gt;Get all of your current programs/packages up to date.&lt;/p&gt;
&lt;p&gt;Plug in an ethernet cable to your BBB and connect it to something internet access(router, switch). Alternatively you can share your PC/laptop internet connection via USB to your BBB (see section below on how to do this).&lt;/p&gt;
&lt;p&gt;Test internet connection by running these commands:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ping 8.8.8.8&lt;/code&gt; Try to connect to Google directly via IP&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ping google.com&lt;/code&gt; Try to connect to Google via DNS nameservers&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Ctrl+z&lt;/code&gt; to stop pinging&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Run the following commands. You may need to type &lt;code&gt;y&lt;/code&gt; and enter along the process to confirm some actions.&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;sudo&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;apt-get&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;update&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;sudo&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;apt-get&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;upgrade&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;share-internet-over-usb&quot;&gt;Share internet over USB&lt;/h2&gt;
&lt;p&gt;In Windows, goto &lt;strong&gt;Control Panel&lt;/strong&gt; -&gt; &lt;strong&gt;Network and Internet&lt;/strong&gt; -&gt; &lt;strong&gt;Network and Sharing Center&lt;/strong&gt; -&gt; &lt;strong&gt;Change Adapter Settings (on the left)&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Right-click on your connection with internet(wired or wireless) and click &lt;code&gt;Properties&lt;/code&gt;. Go to the &lt;code&gt;Sharing&lt;/code&gt; tab and check &lt;code&gt;Allow other network users to connect through this computer&apos;s Internet connection&lt;/code&gt;. In the selection box choose the BBB virtual local area connection. Press &lt;code&gt;OK&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/beaglebone-black-ubuntu-getting-started/internet-connection-sharing.png&quot; alt=&quot;Internet Connection Sharing&quot;&gt;&lt;/p&gt;
&lt;p&gt;For some reason Windows will assign a static IP to the virtual local area connection. So right-click your BBB local area connection and click properties. In the list, select &lt;code&gt;Internet Protocol Version 4 (TCP/IPv4)&lt;/code&gt;, and click the &lt;code&gt;Properties&lt;/code&gt; button. In the &lt;code&gt;General&lt;/code&gt; tag, change both the IP and DNS to &lt;code&gt;Obtain automatically&lt;/code&gt;. Press &lt;code&gt;OK&lt;/code&gt;, &lt;code&gt;Close&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/beaglebone-black-ubuntu-getting-started/bbb-virtual-connection.png&quot; alt=&quot;Setting Automatic for BBB virtual Connection&quot;&gt;&lt;/p&gt;
&lt;p&gt;Then on the BBB side:&lt;/p&gt;
&lt;!-- prettier-ignore --&gt;
&lt;ol&gt;
&lt;li&gt;On your BBB, run this command to temporarily set your BBB&apos;s default gateway:&lt;br&gt;
&lt;code&gt;sudo route add default gw 192.168.7.1&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Add a nameserver so we can reach domains: &lt;code&gt;sudo nano /etc/resolv.conf&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Add &lt;code&gt;nameserver 192.168.7.1&lt;/code&gt; to the bottom of the list.
&lt;ul&gt;
&lt;li&gt;&lt;em&gt;&lt;code&gt;192.168.7.1&lt;/code&gt; is the IP the BBB sees as the computer it is connected to.&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Test internet connection by running these commands:
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ping 8.8.8.8&lt;/code&gt; Try to connect to Google directly via IP&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ping google.com&lt;/code&gt; Try to connect to Google via DNS nameservers&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Ctrl+z&lt;/code&gt; to stop pinging&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;I had some trouble trying to get the BBB to ping when I first set this up. I thought it was a firewall(or Norton&apos;s(anti-virus) firewall) blocking ICMP echo request packets but I added some traffic rules and it didn&apos;t change anything. Plus, I can ping on my Windows 8 PC that I am sharing the connection with. I fixed this issue by changing the &lt;code&gt;TCP/IPv4&lt;/code&gt; settings of the connection with Internet and that we are sharing to something manual, saving, then switching back to automatic. I am not sure why this fixes it.&lt;/p&gt;
&lt;h2 id=&quot;command-cheat-sheet&quot;&gt;Command cheat sheet&lt;/h2&gt;

















&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Command&lt;/th&gt;&lt;th&gt;Description&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;su newusername&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Switch users&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;sudo shutdown -h now&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Shutdown the BBB&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;h2 id=&quot;extra-links&quot;&gt;Extra Links:&lt;/h2&gt;
&lt;p&gt;Update (2016-6-4): here are some links on using Debian 8.4 Jessie&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://crufti.com/updating-a-beaglebone-black-to-debian-jessie/&quot;&gt;Updating a BeagleBone Black to Debian Jessie by Anna Gerber&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://elinux.org/Beagleboard:BeagleBoneBlack_Debian&quot;&gt;BeagleBoneBlack Debian images (console, iot, lxqt)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://elinux.org/Beagleboard:BeagleBoneBlack_Debian#Flashing_eMMC&quot;&gt;Flashing eMMC, Embedded Linux Wiki&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://rcn-ee.net/deb/flasher/saucy/&quot;&gt;BeagleBone Black Ubuntu eMMC Images&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://elinux.org/BeagleBoardUbuntu#eMMC:_BeagleBone_Black&quot;&gt;elinux wiki; BeagleBoardUbuntu: eMMC: BeagleBone Black&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://learn.adafruit.com/beaglebone-black-installing-operating-systems/overview&quot;&gt;Adafruit; BeagleBone Black: Installing Operating Systems&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://derekmolloy.ie/write-a-new-image-to-the-beaglebone-black/&quot;&gt;Writing a new Image to the Beaglebone Black&lt;/a&gt; by Derek Molloy&lt;/li&gt;
&lt;/ul&gt;</content:encoded></item><item><title>Font Size based on Font Family</title><link>https://ericeastwood.com/blog/font-size-based-on-font-family/</link><guid isPermaLink="true">https://ericeastwood.com/blog/font-size-based-on-font-family/</guid><description>Font legibility, crispness(aliasing), and physical size vary between fonts when set at the same font-size. Fonts are designed/optimized at distinct sizes and alias extremely well at those specific size intervals. This makes it hard to set a catch-all size on the web and have it work beautifully with many typefaces.

As you can see from the image above, Calibri is a much smaller font compared to Ubuntu and Open Sans. You can also see the varying levels of clarity between the sizes of each font.
So what if you have a font stack in CSS that looks like font-family: &apos;Ubuntu&apos;, &apos;Calibri&apos;, sans-serif; and you fallback to Calibri. All of a sudden your sites font size greatly decreases. Of course Calibri is a</description><pubDate>Mon, 19 May 2014 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Font legibility, crispness(aliasing), and physical size vary between fonts when set at the same &lt;code&gt;font-size&lt;/code&gt;. Fonts are designed/optimized at distinct sizes and alias extremely well at those specific size intervals. This makes it hard to set a catch-all size on the web and have it work beautifully with many typefaces.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://jsfiddle.net/MadLittleMods/6BgYC/&quot;&gt;&lt;img src=&quot;/images/blog/font-size-based-on-font-family/font-chart.png&quot; alt=&quot;Font chart&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;As you can see from the image above, Calibri is a much smaller font compared to Ubuntu and Open Sans. You can also see the varying levels of clarity between the sizes of each font.&lt;/p&gt;
&lt;p&gt;So what if you have a font stack in CSS that looks like &lt;code&gt;font-family: &apos;Ubuntu&apos;, &apos;Calibri&apos;, sans-serif;&lt;/code&gt; and you fallback to Calibri. All of a sudden your sites font size greatly decreases. Of course Calibri is a great looking font and you want to use it as a fallback but increase the size when it does. This guide will go over how you can have the best of all typefaces and style them just right so the fallbacks are perfect.&lt;/p&gt;
&lt;h1 id=&quot;css-only-alternative-maybe&quot;&gt;CSS only alternative (maybe)&lt;/h1&gt;
&lt;p&gt;The &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/CSS/font-size-adjust&quot;&gt;&lt;code&gt;font-size-adjust&lt;/code&gt;&lt;/a&gt; property takes a stab at this issue by making font size actually based on the size of the lower case letters in the loaded font. It works as a scalar for &lt;code&gt;font-size&lt;/code&gt; and guarantees the font will be scaled so that the lowercase letter height will be &lt;code&gt;font-size*font-size-adjust&lt;/code&gt;. In the example snippet below the typefaces lowercase letter height would be &lt;code&gt;6px&lt;/code&gt;.&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;/* lower case letters will be 6px high */&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #E45649&quot;&gt;font-size&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;: 12px;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #E45649&quot;&gt;font-size-adjust&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;: 0.5;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This helps with legibility at small sizes between font fallbacks but still does not let you customize the size based on the font family. Another problem is that &lt;code&gt;font-size-adjust&lt;/code&gt; is &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/CSS/font-size-adjust#Browser_compatibility&quot;&gt;only supported in Firefox at the moment&lt;/a&gt;.&lt;/p&gt;
&lt;h1 id=&quot;introducing-web-font-loader&quot;&gt;Introducing &lt;a href=&quot;https://github.com/typekit/webfontloader&quot;&gt;Web Font Loader&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;To achieve the true &lt;code&gt;font-size&lt;/code&gt; based on &lt;code&gt;font-family&lt;/code&gt; we are going to be using &lt;a href=&quot;https://github.com/typekit/webfontloader&quot;&gt;Adobe Typekits Web Font Loader JavaScript library&lt;/a&gt;. The readme in the GitHub repo explains a lot and goes through many configurations but I will be going over just what we need to get &lt;code&gt;font-size&lt;/code&gt; based on &lt;code&gt;font-family&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Web font Loader&lt;/strong&gt; works by identifying if the fonts specified in the modules of the configuration are loaded. And then adding corresponding css classes(what Typekit calls &lt;code&gt;Events&lt;/code&gt;) to the HTML tag of your page. You can then use those classes in your CSS to style your page appropriately.&lt;/p&gt;
&lt;p&gt;Don&apos;t be confused by the name &quot;Web Font &lt;strong&gt;Loader&lt;/strong&gt;&quot;, as we are not using the library to load/import fonts into the page(in this guide). We are simply testing for whether they are already loaded and are able to be used in the page.&lt;/p&gt;
&lt;hr&gt;
&lt;h1 id=&quot;how-to-use-web-font-loader&quot;&gt;How to use Web Font Loader&lt;/h1&gt;
&lt;p&gt;Web Font Loader(&lt;code&gt;webfont.js&lt;/code&gt;) is a &lt;a href=&quot;https://developers.google.com/speed/libraries/devguide#webfont&quot;&gt;Google hosted library&lt;/a&gt; so it is easy to include and use. You could always download and include it yourself. Web Font Loader even works offline(for the features we are using in this guide).&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;// Link the latest 1.x version. This applies to any google hosted library.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;src&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;//ajax.googleapis.com/ajax/libs/webfont/1/webfont.js&quot;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;// Or specify a set version&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;src&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;//ajax.googleapis.com/ajax/libs/webfont/1.5.3/webfont.js&quot;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&amp;#x3C;/&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;initialize-the-library&quot;&gt;Initialize the library&lt;/h2&gt;
&lt;p&gt;There are two ways to run Web Font Loader, but the easiest and most sensible way to me is to just call &lt;code&gt;WebFont.load({})&lt;/code&gt;. The other way is to set the global variable &lt;code&gt;WebFontConfig&lt;/code&gt; and then include the &lt;code&gt;webfont.js&lt;/code&gt; library. If you are using JS strict mode &lt;code&gt;&quot;use strict&quot;;&lt;/code&gt;, then use &lt;code&gt;window.WebFontConfig = {};&lt;/code&gt; to keep from getting errors.&lt;/p&gt;
&lt;p&gt;After you have &lt;code&gt;webfont.js&lt;/code&gt; included somewhere; Add each font family you are using to the &lt;code&gt;custom&lt;/code&gt; module &lt;code&gt;families&lt;/code&gt; array. In this small example we are going to use Open Sans which looks good at a base size of 12px and Ubuntu which looks good at a base size of 13px.&lt;/p&gt;
&lt;p&gt;You can put this snippet in a &lt;code&gt;&amp;#x3C;script&gt;&lt;/code&gt; tag at the bottom of the body so that it runs once the page has been fully parsed and rendered. It will work just fine if you include it in the head(or wherever).&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Get classes from fonts&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #E45649&quot;&gt;WebFont&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;load&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;({&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  custom&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    families&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;Open Sans&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;Ubuntu&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;],&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;},&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;});&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;define-font-sizes-using-the-event-classes&quot;&gt;Define Font Sizes using the Event Classes&lt;/h2&gt;
&lt;p&gt;Once the snippet above executes, it will add the css event classes the &lt;code&gt;HTML&lt;/code&gt; element of the page. We can use the CSS event classes to set a &lt;code&gt;font-size&lt;/code&gt; for each family.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/font-size-based-on-font-family/web-font-loader.png&quot; alt=&quot;Web Font Loader Even Classes&quot;&gt;&lt;/p&gt;
&lt;p&gt;The syntax for the CSS events looks like this:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;.wf-&amp;#x3C;familyname&gt;-&amp;#x3C;fvd&gt;-active&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&amp;#x3C;familyname&gt;&lt;/code&gt;: Lowercase name of the font. Spaces and underscore are stripped out.&lt;br&gt;
&lt;code&gt;&amp;#x3C;fvd&gt;&lt;/code&gt;: Shortand for describing the weight and style. ex.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;n4&lt;/code&gt;: normal style, weight: 400 (normal)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;n7&lt;/code&gt;: normal style, weight: 700 (bold)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;i4&lt;/code&gt;: italic style, weight 400 (normal)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;We will just be using the &lt;code&gt;n4&lt;/code&gt; fvd variant as there is no need to test each flavor of the font.&lt;/p&gt;
&lt;p&gt;Define the event classes in opposite(&lt;code&gt;left-&gt;right&lt;/code&gt; to &lt;code&gt;bottom-&gt;top&lt;/code&gt;; see example below) order you have in the &lt;code&gt;font-family&lt;/code&gt; stack on your body. This way they will override each other correctly when you have to fallback.&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #E45649&quot;&gt;body&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;font-family&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;Open Sans&apos;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;Ubuntu&apos;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;sans-serif&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;font-size&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;12px&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;font-weight&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;400&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;/* Change font-size based on font-family &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt; * We get these event classes from the webfontloader&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;*/&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #986801&quot;&gt;.wf-ubuntu-n4-active&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;body&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;font-size&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;13px&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #986801&quot;&gt;.wf-opensans-n4-active&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;body&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;font-size&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;: &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;12px&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now when Open Sans is available, it will use a &lt;code&gt;font-size&lt;/code&gt; of &lt;code&gt;12px&lt;/code&gt;.&lt;br&gt;
If Open Sans is not available and the &lt;code&gt;font-family&lt;/code&gt; stack falls back to Ubuntu, it uses a &lt;code&gt;font-size&lt;/code&gt; of &lt;code&gt;13px&lt;/code&gt;&lt;/p&gt;
&lt;h1 id=&quot;demo-jsfiddle&quot;&gt;Demo: &lt;a href=&quot;https://jsfiddle.net/MadLittleMods/LE3y4/&quot;&gt;jsFiddle&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;You can check out a &lt;a href=&quot;https://jsfiddle.net/MadLittleMods/LE3y4/&quot;&gt;demo&lt;/a&gt; of what the guide goes through.&lt;/p&gt;
&lt;p&gt;To test the font fallback and size change, just put a space between the multi-line comment like so &lt;code&gt;/* * /&lt;/code&gt; for the &lt;code&gt;@import&lt;/code&gt; definitions in the CSS. This will toggle the import on and off. If you already have Open Sans or Ubuntu installed locally in your OS, you won&apos;t see the difference.&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;/* Open sans is commented out (notice the space) */&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;/* * /&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;@import url(https://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;/* */&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;/* Ubuntu is defined */&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;/* */&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;@import&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;url&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;https://fonts.googleapis.com/css?family=Ubuntu:400,700,400italic,700italic&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;/* */&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content:encoded></item><item><title>Unity and DLLs: C# (managed) and C++ (unmanaged)</title><link>https://ericeastwood.com/blog/unity-and-dlls-c-managed-and-c-unmanaged/</link><guid isPermaLink="true">https://ericeastwood.com/blog/unity-and-dlls-c-managed-and-c-unmanaged/</guid><description>
With Unity 5, there is no difference in terms of engine features between Personal/Free and Professional editions. This means that &quot;Native Code Plugin Support&quot; is not a problem anymore and there are no restrictions with DLLs and C++(unmanaged) code.
This guide really only applies to Unity 4 and below

When dealing with unmanaged and managed code, verbiage like P/Invoke, marshaling, interoperability get thrown around. The whole ordeal can be a bit daunting.
This guide will go over dealing with DLLs in Unity Free/Standard and Unity Pro. Even with the native(unmanaged) code barrier in Unity Free, it is still possible to use unmanaged code.
Overview
Specifically, we will be making a C# managed DLL which relies on/references a C++ unmanaged DLL and then use those functions</description><pubDate>Thu, 01 May 2014 00:00:00 GMT</pubDate><content:encoded>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;With Unity 5&lt;/strong&gt;, there is no difference in terms of engine features between Personal/Free and Professional editions. This means that &lt;a href=&quot;https://unity3d.com/unity/engine-features&quot;&gt;&quot;Native Code Plugin Support&quot;&lt;/a&gt; is not a problem anymore and there are no restrictions with DLLs and C++(unmanaged) code.&lt;/p&gt;
&lt;p&gt;This guide really only applies to Unity 4 and below&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;When dealing with unmanaged and managed code, verbiage like P/Invoke, marshaling, interoperability get thrown around. The whole ordeal can be a bit daunting.&lt;/p&gt;
&lt;p&gt;This guide will go over dealing with DLLs in Unity Free/Standard and Unity Pro. Even with the &lt;a href=&quot;https://docs.unity3d.com/Documentation/Manual/Plugins.html&quot;&gt;native(unmanaged) code barrier in Unity Free&lt;/a&gt;, it is still possible to use unmanaged code.&lt;/p&gt;
&lt;h2 id=&quot;overview&quot;&gt;Overview&lt;/h2&gt;
&lt;p&gt;Specifically, we will be making a C# managed DLL which relies on/references a C++ unmanaged DLL and then use those functions in Unity.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;TLDR; For Unity 4 Pro and Unity 5:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Add all code/DLLs to the Plugins folder: &lt;code&gt;UnityProject&lt;/code&gt;-&gt;&lt;code&gt;Plugins&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;TLDR; For Unity Free:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Add unmanaged code to the Unity Project Root: &lt;code&gt;UnityProject&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Add managed code to the Plugins folder: &lt;code&gt;UnityProject&lt;/code&gt;-&gt;&lt;code&gt;Plugins&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;When you build a project, copy the unmanaged code to &lt;code&gt;BuildRoot&lt;/code&gt;-&gt;&lt;code&gt;Data&lt;/code&gt;-&gt;&lt;code&gt;Plugins&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;create-a-c-dll-unmanaged&quot;&gt;Create a C++ DLL (Unmanaged)&lt;/h2&gt;
&lt;p&gt;To start, lets create the unmanaged DLL which the other pieces rely on.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;In Visual Studio, Create a New Project: &lt;code&gt;Visual C++&lt;/code&gt;-&gt;&lt;code&gt;Win32&lt;/code&gt;-&gt;&lt;code&gt;Win32 Console Application&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Name it &lt;code&gt;TestCPPLibrary&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;On the Application Settings Wizard that pops up after you press OK: change the &lt;code&gt;Application Type&lt;/code&gt; to &lt;code&gt;DLL&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Check the &lt;code&gt;Empty Project&lt;/code&gt; box on the same page&lt;br&gt;
&lt;img src=&quot;/images/blog/unity-and-dlls-c-managed-and-c-unmanaged/create-win32-c-console-app.png&quot; alt=&quot;Create Win32 C++ Console Application&quot;&gt; &lt;img src=&quot;/images/blog/unity-and-dlls-c-managed-and-c-unmanaged/app-settings-wizard-dll-empty-project.png&quot; alt=&quot;Application Settings Wizard: DLL and Empty Project&quot;&gt;&lt;/li&gt;
&lt;li&gt;Create the following two files and paste in the contents&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;testcpplibraryh&quot;&gt;&lt;code&gt;TestCPPLibrary.h&lt;/code&gt;&lt;/h3&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// TestCPPLibrary.h&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;#ifdef&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;TESTFUNCDLL_EXPORT&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;#define&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;TESTFUNCDLL_API&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; __declspec(dllexport)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;#else&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;#define&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;TESTFUNCDLL_API&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; __declspec(dllimport)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;#endif&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;extern&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;C&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    TESTFUNCDLL_API &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;TestMultiply&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; a, &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; b);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	TESTFUNCDLL_API &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;TestDivide&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; a, &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; b);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;testcpplibrarycpp&quot;&gt;&lt;code&gt;TestCPPLibrary.cpp&lt;/code&gt;&lt;/h3&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// TestCPPLibrary.cpp : Defines the exported functions for the DLL application.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;//&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;#include&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;TestCPPLibrary.h&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;extern&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;C&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;TestMultiply&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;a&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;b&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; a &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; b;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;TestDivide&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;a&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;b&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; (b &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;) {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;			//throw invalid_argument(&quot;b cannot be zero!&quot;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; a &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; b;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;create-a-c-dll-managed&quot;&gt;Create a C# DLL (Managed)&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;In Visual Studio, Create a New Project: &lt;code&gt;Visual C#&lt;/code&gt;-&gt;&lt;code&gt;Windows&lt;/code&gt;-&gt;&lt;code&gt;Class Library&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Name it &lt;code&gt;TestCSharpLibrary&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Add the C++ Dll to your C# Solution
&lt;ul&gt;
&lt;li&gt;Right-click the solution in your C# project and goto &lt;code&gt;Add&lt;/code&gt;-&gt;&lt;code&gt;Existing Item&lt;/code&gt;&lt;br&gt;
&lt;img src=&quot;/images/blog/unity-and-dlls-c-managed-and-c-unmanaged/add-existing-project.png&quot; alt=&quot;Add existing project&quot;&gt;&lt;/li&gt;
&lt;li&gt;Browse and choose your &lt;code&gt;TestCPPLibrary&lt;/code&gt; project.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Right click on your C# project and go to &lt;code&gt;Properties&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;In the &lt;code&gt;Application&lt;/code&gt; tab, change the &lt;code&gt;Target Framework&lt;/code&gt; to &lt;code&gt;.NET Framework 3.5&lt;/code&gt;&lt;br&gt;
&lt;img src=&quot;/images/blog/unity-and-dlls-c-managed-and-c-unmanaged/c-project-properties-context-menu.png&quot; alt=&quot;C# Project Context Menu: Properties&quot;&gt; &lt;img src=&quot;/images/blog/unity-and-dlls-c-managed-and-c-unmanaged/c-project-properties-target-framework.png&quot; alt=&quot;C# Project Properties-&gt;Application-&gt;Target Framework (.net version)&quot;&gt;&lt;/li&gt;
&lt;li&gt;Create the following file and paste in the contents&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;testcsharplibrarycs&quot;&gt;TestCSharpLibrary.cs&lt;/h3&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; System;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;Runtime&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;InteropServices&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;namespace&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; TestCSharpLibrary&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    public &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #C18401&quot;&gt;TestCSharpLibrary&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;        // From c++ Dll (unmanaged)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;        [&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;DllImport&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;TestCPPLibrary&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;)]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;        public static extern float TestMultiply&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;a&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;b)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;        // From c++ Dll (unmanaged)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;        [&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;DllImport&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;TestCPPLibrary&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;)]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;        public static extern float TestDivide&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;a&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;b)&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;        public &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;static&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;SharpMultiply&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; a, &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; b) {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;            &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; (a &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; b);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;        }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;        public &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;static&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;SharpDivide&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; a, &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; b) {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;            &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; (b &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;            {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;                &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;            }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;            &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; (a &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; b);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;        }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;build-make-the-dlls&quot;&gt;Build (Make the DLLs)&lt;/h2&gt;
&lt;p&gt;Right click the solution and press &lt;code&gt;Build&lt;/code&gt; (F7). It should run until you see:&lt;br&gt;
&lt;code&gt;========== Build: 2 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;You should be able to find both DLLs in the C# project folder:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;TestCSharpDll\TestCSharpLibrary\Debug\TestCPPLibrary.dll&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;TestCSharpDll\TestCSharpLibrary\TestCSharpLibrary\bin\Debug\TestCSharpLibrary.dll&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;add-the-dlls-to-your-unity-project&quot;&gt;Add the DLLs to your Unity Project&lt;/h2&gt;
&lt;p&gt;Since &lt;a href=&quot;https://docs.unity3d.com/Documentation/Manual/Plugins.html&quot;&gt;native(unmanaged, the c++ DLL in our case) is a Pro/Mobile-only feature&lt;/a&gt;, it is quite easy to get this running in Unity Pro, but a bit more involved for Unity Free/Standard/Indie.&lt;/p&gt;
&lt;h3 id=&quot;unity-pro-and-any-unity-5&quot;&gt;Unity Pro and any Unity 5&lt;/h3&gt;
&lt;p&gt;If you are using Unity Pro,&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Copy both DLLs(&lt;code&gt;TestCSharpLibrary.dll&lt;/code&gt;, &lt;code&gt;TestCPPLibrary.dll&lt;/code&gt;) into &lt;code&gt;UnityProject&lt;/code&gt;-&gt;&lt;code&gt;Plugins&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The project will work in the Unity Editor and when you make a Build&lt;/p&gt;
&lt;h3 id=&quot;unity-freestandardindie&quot;&gt;Unity (Free/Standard/Indie)&lt;/h3&gt;
&lt;p&gt;If you are using the standard version of Unity:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Copy &lt;code&gt;TestCSharpLibrary.dll&lt;/code&gt;, the C# managed DLL, into &lt;code&gt;UnityProject&lt;/code&gt;-&gt;&lt;code&gt;Plugins&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Copy &lt;code&gt;TestCPPLibrary.dll&lt;/code&gt;, the C++ unmanaged DLL, into the &lt;code&gt;UnityProject&lt;/code&gt; root.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This will allow the project to run in the Unity Editor but will not work in a build.&lt;/p&gt;
&lt;p&gt;To get your project working in a build... After you build your project:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Copy &lt;code&gt;TestCPPLibrary.dll&lt;/code&gt;, into your &lt;code&gt;Build Root&lt;/code&gt;-&gt;&lt;code&gt;Data&lt;/code&gt;-&gt;&lt;code&gt;Plugins&lt;/code&gt;, alongside your other DLL&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;using-the-dll-in-unity&quot;&gt;Using the DLL in Unity&lt;/h2&gt;
&lt;p&gt;Here is a simple script utilizing the DLLs:&lt;/p&gt;
&lt;h3 id=&quot;usedllcs&quot;&gt;UseDLL.cs&lt;/h3&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #C18401&quot;&gt;UnityEngine&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #C18401&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #C18401&quot;&gt;Collections&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #C18401&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #C18401&quot;&gt;Runtime&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #C18401&quot;&gt;InteropServices&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #C18401&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #C18401&quot;&gt;IO&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #C18401&quot;&gt;UseDll&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; : &lt;/span&gt;&lt;span style=&quot;color: #C18401&quot;&gt;MonoBehaviour&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Straight From the c++ Dll (unmanaged)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	[&lt;/span&gt;&lt;span style=&quot;color: #C18401&quot;&gt;DllImport&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;TestCPPLibrary&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;EntryPoint&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;TestDivide&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;)]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;static&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;extern&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;StraightFromDllTestDivide&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; a, &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; b);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Use this for initialization&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;Start&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; () {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;/* */&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Call the C# DLL SharpMultiply function&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; multiplyResult &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;TestCSharpLibrary&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;TestCSharpLibrary&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;SharpMultiply&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Call the C# DLL TestDivide function which relies on the C++ DLL for this functionality&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; divideResult &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;TestCSharpLibrary&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;TestCSharpLibrary&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;TestDivide&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;15&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; straightFromDllDivideResult &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;StraightFromDllTestDivide&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;20&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Print it out to the console&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;Debug&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;Log&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;multiplyResult&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;Debug&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;Log&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;divideResult&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;Debug&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;Log&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;straightFromDllDivideResult&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Write the result into a file, so we can even see it working in a build&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #C18401&quot;&gt;StreamWriter&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; writer &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #C18401&quot;&gt;StreamWriter&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;debug.txt&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;true&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;writer&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;WriteLine&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;multiplyResult&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;writer&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;WriteLine&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;divideResult&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;writer&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;WriteLine&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;straightFromDllDivideResult&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;/* */&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Update is called once per frame&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;Update&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; () {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Running the script, should output to the console and write to debug.txt:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/unity-and-dlls-c-managed-and-c-unmanaged/unity-console-logs-output.png&quot; alt=&quot;Unity console logs showing the script above running &amp;#x27;15 from SharpMultiply(3, 5)&amp;#x27;, &amp;#x27;5 from TestDivide(15, 3)&amp;#x27;, and &amp;#x27;4 from StraightFromDllTestDivide(20, 5)&amp;#x27;&quot;&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&quot;running-into-issues&quot;&gt;Running into Issues?:&lt;/h2&gt;
&lt;h3 id=&quot;internal-compiler-error--systemreflectionreflectiontypeloadexception&quot;&gt;Internal compiler error ... &lt;code&gt;System.Reflection.ReflectionTypeLoadException&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;If you are getting an error similar to &lt;code&gt;Internal compiler error. System.Reflection.ReflectionTypeLoadException&lt;/code&gt; in Unity when trying to build your project; You need to change the targeted .NET version of your C# file to something like .NET 3.5.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Right click on your C# project and go to &lt;code&gt;Properties&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;In the &lt;code&gt;Application&lt;/code&gt; tab, change the &lt;code&gt;Target Framework&lt;/code&gt; to &lt;code&gt;.NET Framework 3.5&lt;/code&gt;&lt;br&gt;
&lt;img src=&quot;/images/blog/unity-and-dlls-c-managed-and-c-unmanaged/c-project-properties-context-menu.png&quot; alt=&quot;C# Project Context Menu: Properties&quot;&gt; &lt;img src=&quot;/images/blog/unity-and-dlls-c-managed-and-c-unmanaged/c-project-properties-target-framework.png&quot; alt=&quot;C# Project Properties-&gt;Application-&gt;Target Framework (.net version)&quot;&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;failed-to-load--expected-64-bit-architecture-image_file_machine_amd64-but-was-image_file_machine_i386&quot;&gt;Failed to load ... expected 64 bit architecture (IMAGE_FILE_MACHINE_AMD64), but was IMAGE_FILE_MACHINE_I386.&lt;/h3&gt;
&lt;p&gt;If you are getting this error, you probably need to recompile your libraries for x64 platform (64 bit).&lt;/p&gt;
&lt;p&gt;In Visual Studio, go to the properties of your project, then at the top click the &quot;Configuration Manager...&quot; button. In the table, under the &lt;code&gt;Platform&lt;/code&gt; column, change it to &quot;x64&quot; then recompile your project.&lt;/p&gt;</content:encoded></item><item><title>How to Install WordPress with Nginx on Ubuntu 12.04</title><link>https://ericeastwood.com/blog/how-to-install-wordpress-with-nginx-on-ubuntu-1204/</link><guid isPermaLink="true">https://ericeastwood.com/blog/how-to-install-wordpress-with-nginx-on-ubuntu-1204/</guid><description>About
WordPress is an open source, PHP based blog and content management system(CMS) made to streamline the process of getting your website up and looking pretty. The WordPress community makes a multitude of plugins (over 30,000) that extend the functionality to make it work just the way you like. There is also an enormous support community to help with any issues.
Nginx(pronounced &quot;engine-x&quot;) is a popular light-weight server alternative to Apache. It is considered leaner and meaner than Apache because it uses an event-driven system that chomps through requests rather than spinning up separate processes and threads for each request.
Prerequisites:

User with root privileges
Linux, Nginx, MySQL, PHP (LEMP) stack

Download WordPress
&lt;!-- prettier-ignore --&gt;

Download the zipped package(archive file) directly from the WordPress website: wget https://wordpress.org/latest.tar.gz
Unzip/Extract</description><pubDate>Thu, 17 Apr 2014 00:00:00 GMT</pubDate><content:encoded>&lt;h1 id=&quot;about&quot;&gt;About&lt;/h1&gt;
&lt;p&gt;&lt;a href=&quot;https://wordpress.org/&quot;&gt;WordPress&lt;/a&gt; is an open source, PHP based blog and content management system(CMS) made to streamline the process of getting your website up and looking pretty. The WordPress community makes a &lt;a href=&quot;https://wordpress.org/plugins/&quot;&gt;multitude of plugins (over 30,000)&lt;/a&gt; that extend the functionality to make it work just the way you like. There is also an enormous &lt;a href=&quot;https://wordpress.org/support/&quot;&gt;support community&lt;/a&gt; to help with any issues.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://wiki.nginx.org/&quot;&gt;Nginx&lt;/a&gt;(pronounced &quot;engine-x&quot;) is a popular light-weight server alternative to Apache. It is considered leaner and meaner than Apache because it uses an event-driven system that chomps through requests rather than spinning up separate processes and threads for each request.&lt;/p&gt;
&lt;h1 id=&quot;prerequisites&quot;&gt;Prerequisites:&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;User with root privileges&lt;/li&gt;
&lt;li&gt;Linux, Nginx, MySQL, PHP (LEMP) stack&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id=&quot;download-wordpress&quot;&gt;Download WordPress&lt;/h1&gt;
&lt;!-- prettier-ignore --&gt;
&lt;ol&gt;
&lt;li&gt;Download the zipped package(archive file) directly from the WordPress website: &lt;code&gt;wget https://wordpress.org/latest.tar.gz&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Unzip/Extract the files from the package: &lt;code&gt;tar -xvzf latest.tar.gz&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Create the &lt;code&gt;/var/www&lt;/code&gt; directory. The &lt;code&gt;-p&lt;/code&gt; flag will create the directory only if it doesn&apos;t exist already: &lt;code&gt;sudo mkdir -p /var/www&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; Instead of creating and using the &lt;code&gt;/var/www&lt;/code&gt; directory, you can use &lt;code&gt;/usr/share/nginx/www&lt;/code&gt; instead. Make sure to adjust all of the commands and configs if you do.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Add permissions to the Nginx user(&lt;code&gt;www-data&lt;/code&gt;) to the directory we just created: &lt;code&gt;sudo chown -R www-data:www-data /var/www&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Now let&apos;s also add your username to the &lt;code&gt;www-data&lt;/code&gt; group: &lt;code&gt;sudo usermod -a -G www-data yourusername&lt;/code&gt; (replace &quot;yourusername&quot; with your username)&lt;/li&gt;
&lt;li&gt;Copy the WordPress files we just extracted into the &lt;code&gt;/var/www/&lt;/code&gt; directory: &lt;code&gt;sudo cp -r ~/wordpress/* /var/www&lt;/code&gt; - Don&apos;t worry, the files are not public yet. We will change this in the Nginx server block.&lt;/li&gt;
&lt;li&gt;Now we can clean up a bit. Delete the zip archive: &lt;code&gt;rm latest.tar.gz&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Delete the folder we extracted: &lt;code&gt;rm -r wordpress/&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&quot;create-the-database-and-user&quot;&gt;Create the Database and User&lt;/h2&gt;
&lt;!-- prettier-ignore --&gt;
&lt;ol&gt;
&lt;li&gt;Start the MySQL shell and login: &lt;code&gt;mysql -u root -p&lt;/code&gt;
&lt;ul&gt;
&lt;li&gt;You should see &lt;code&gt;mysql&gt;&lt;/code&gt; on the left now. &lt;code&gt;Query OK [...]&lt;/code&gt; will appear after you enter each of the following commands.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Create a new database to store all wordpress content(articles, settings, etc). I am calling my database &quot;wordpress&quot; to keep things simple: &lt;code&gt;CREATE DATABASE wordpress;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Now we need to create a user which WordPress will use to set and retrieve content: &lt;code&gt;CREATE USER &apos;wordpressuser&apos;@&apos;localhost&apos; IDENTIFIED BY &apos;password&apos;;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;If you need to change the password of the user, you can just run this command: &lt;code&gt;SET PASSWORD FOR &apos;wordpressuser&apos;@&apos;localhost&apos; = PASSWORD(&apos;password&apos;);&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Give your wordpress user all permissions for the database we just created: &lt;code&gt;GRANT ALL PRIVILEGES ON wordpress.* TO &apos;wordpressuser&apos;@&apos;localhost&apos; IDENTIFIED BY &apos;password&apos;;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Now that you have set up some new privileges, reload these settings: &lt;code&gt;FLUSH PRIVILEGES;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Exit the MySQL shell: &lt;code&gt;exit;&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h1 id=&quot;create-a-nginx-server-block&quot;&gt;Create a Nginx Server Block&lt;/h1&gt;
&lt;!-- prettier-ignore --&gt;
&lt;ol&gt;
&lt;li&gt;Create a new Nginx server block file: &lt;code&gt;sudo nano /etc/nginx/sites-available/wordpress&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Paste the following snippet into the new file (explanation below)
&lt;ul&gt;
&lt;li&gt;Find &lt;code&gt;server_name example.com;&lt;/code&gt; and change it to your domain name &lt;code&gt;example.com&lt;/code&gt;. If you don&apos;t have a domain, you can use your server IP address.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;listen&lt;/code&gt; is the port we check for web requests on&lt;/li&gt;
&lt;li&gt;&lt;code&gt;root&lt;/code&gt; is the base folder where we have content&lt;/li&gt;
&lt;li&gt;&lt;code&gt;index&lt;/code&gt; is the auto-complete file when nothing is in the url(ex. &lt;code&gt;http://example.com/&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;server_name&lt;/code&gt; your domain or IP&lt;/li&gt;
&lt;li&gt;&lt;code&gt;location / { ... }&lt;/code&gt; is the block that allows the Wordpress permalinks to work&lt;/li&gt;
&lt;li&gt;&lt;code&gt;location ~ \.php$ { ... }&lt;/code&gt; is the block that passes any &lt;code&gt;.php&lt;/code&gt; request to the PHP&lt;/li&gt;
&lt;/ul&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;server&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt; listen &lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;80;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt; root &lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;/var/www;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt; index &lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;index.php index.html index.htm;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt; server_name &lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;example.com;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;location&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; / {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;# First attempt to serve request as file, then&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;# as directory, then fall back to index.html&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;   &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt; try_files &lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;uri&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; $&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;uri&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;/ /index.php;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;location&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;~&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;\.php$ &lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;# NOTE: You should have &quot;cgi.fix_pathinfo = 0;&quot; in php.ini&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;   &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt; try_files &lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;uri&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;=404&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;# With php5-fpm:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;   &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt; fastcgi_pass &lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;unix:/var/run/php5-fpm.sock;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;   &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt; fastcgi_index &lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;index.php;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;   &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt; fastcgi_param &lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;SCRIPT_FILENAME $&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;document_root&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;fastcgi_script_name&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;   &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt; include &lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;fastcgi_params;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Save and Exit. Press &lt;code&gt;Ctrl+x&lt;/code&gt; to exit. Press &lt;code&gt;y&lt;/code&gt; to confirm and then &lt;code&gt;enter&lt;/code&gt; to finally save.&lt;/li&gt;
&lt;li&gt;Enable the server block by creating a link between the configuration and the enabled directories: &lt;code&gt;sudo ln -s /etc/nginx/sites-available/wordpress /etc/nginx/sites-enabled/wordpress&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Remove the default server block from the enabled directory: &lt;code&gt;sudo rm /etc/nginx/sites-enabled/default&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Now reload the Nginx service: &lt;code&gt;sudo service nginx restart&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h1 id=&quot;setup-wordpress&quot;&gt;Setup WordPress&lt;/h1&gt;
&lt;p&gt;Now when you visit your site either by IP or domain it should show a &quot;There doesn&apos;t seem to be a wp-config.php file.&quot; dialog like the one below:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/how-to-install-wordpress-with-nginx-on-ubuntu-1204/no-wp-config-php.png&quot; alt=&quot;Dialog showing &amp;#x22;There doesn&amp;#x27;t seem to be a wp-config.php file.&amp;#x22;&quot;&gt;&lt;/p&gt;
&lt;p&gt;Press the &lt;code&gt;Create a Configuration File&lt;/code&gt; button and the &lt;code&gt;Let&apos;s go!&lt;/code&gt; button on the following page. Now you should see a form that asks for the database info. Fill it out appropriately with the credentials you set up, then press submit.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/how-to-install-wordpress-with-nginx-on-ubuntu-1204/wordpress-database-config.png&quot; alt=&quot;Wordpress database configuration form&quot;&gt;&lt;/p&gt;
&lt;p&gt;Press the &lt;code&gt;Run the install&lt;/code&gt; button on the following page.&lt;/p&gt;
&lt;p&gt;Now enter in your site title and admin account info and press the &lt;code&gt;Install WordPress&lt;/code&gt; button. The page should look like this.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/how-to-install-wordpress-with-nginx-on-ubuntu-1204/wordpress-install-form.png&quot; alt=&quot;Wordpress install form&quot;&gt;&lt;/p&gt;
&lt;h2 id=&quot;success&quot;&gt;Success!&lt;/h2&gt;
&lt;p&gt;It should present you with a &quot;Success!&quot; screen and you should be able to login to the admin panel and visit the main site now.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/how-to-install-wordpress-with-nginx-on-ubuntu-1204/wordpress-install-success.png&quot; alt=&quot;Wordpress successful installation screen&quot;&gt;&lt;/p&gt;
&lt;h2 id=&quot;optional-enable-permalinks&quot;&gt;(Optional) Enable Permalinks&lt;/h2&gt;
&lt;p&gt;Login to the WordPress admin interface.&lt;/p&gt;
&lt;p&gt;In the left-hand menu go to &lt;strong&gt;Settings&lt;/strong&gt; -&gt; &lt;strong&gt;Permalinks&lt;/strong&gt;. Change the radio button setting to your needs(I usually use &quot;Month and name&quot;). Then click &lt;code&gt;Save Changes&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id=&quot;optional-install-w3-total-cache&quot;&gt;(Optional) Install W3 Total Cache&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;https://wordpress.org/plugins/w3-total-cache/&quot;&gt;W3 Total Cache&lt;/a&gt;(W3TC) is a quick and easy way to speed up your site by utilizing the power of caching and minification.&lt;/p&gt;
&lt;p&gt;I suggest running &lt;a href=&quot;https://developers.google.com/speed/pagespeed/insights/&quot;&gt;Google&apos;s PageSpeed Insight test&lt;/a&gt; before and after you install to see the improvement.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;NOTE:&lt;/em&gt; This plugin will cache your files making it a little bit difficult to make theme changes. All you have to do is Purge the cache every time you make a modification.&lt;/p&gt;
&lt;p&gt;Login to the WordPress admin interface.&lt;/p&gt;
&lt;p&gt;In the left-hand menu go to &lt;strong&gt;Plugins&lt;/strong&gt; -&gt; &lt;strong&gt;Add New&lt;/strong&gt;. Type &lt;code&gt;W3 Total Cache&lt;/code&gt; in the search.&lt;/p&gt;
&lt;p&gt;Click the &lt;code&gt;Install Now&lt;/code&gt; link.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/how-to-install-wordpress-with-nginx-on-ubuntu-1204/install-w3-total-cache.png&quot; alt=&quot;Install W3 Total Cache&quot;&gt;&lt;/p&gt;
&lt;p&gt;If WordPress is asking for your FTP credentials, this means it can&apos;t access the files directly. To fix this, just change the wordpress file owner to the &lt;code&gt;www-data&lt;/code&gt; user and group&lt;/p&gt;
&lt;p&gt;&lt;code&gt;sudo chown -R www-data:www-data /var/www&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Click the &lt;code&gt;Activate Plugin&lt;/code&gt; link(&lt;a href=&quot;/images/blog/how-to-install-wordpress-with-nginx-on-ubuntu-1204/installing-and-activate-w3-total-cache.png&quot;&gt;screenshot&lt;/a&gt;) after it installs.&lt;/p&gt;
&lt;p&gt;Click the W3TC &lt;code&gt;Settings&lt;/code&gt; link or in the left-hand menu go to &lt;strong&gt;Performance&lt;/strong&gt; -&gt; &lt;strong&gt;General Settings&lt;/strong&gt;.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Leave the &quot;Toggle All&quot; radio unchecked&lt;/li&gt;
&lt;li&gt;Enable &lt;code&gt;Page cache&lt;/code&gt;. Cache pages for faster loading and more efficient delivery.&lt;/li&gt;
&lt;li&gt;Enable &lt;code&gt;Minify&lt;/code&gt;. Shrink and combine JS and CSS files for faster loading and more efficient delivery.&lt;/li&gt;
&lt;li&gt;Enable &lt;code&gt;Object Cache&lt;/code&gt;. Speed up generation of content by WordPress.&lt;/li&gt;
&lt;li&gt;Enable &lt;code&gt;Browser Cache&lt;/code&gt;. Properly tags content so that browser clients minimize downloads of pages (file header stuff).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you are getting an error(something about the file length 150, etc) with the Minify function: Visit &lt;code&gt;http://example.com/wp-admin/admin.php?page=w3tc_minify#advanced&lt;/code&gt; and check the &lt;code&gt;Disable minify automatic file name length test&lt;/code&gt; option. The &lt;code&gt;Filename length&lt;/code&gt; should be 150. Disable &lt;code&gt;Minify&lt;/code&gt;, save, then re-enable it.&lt;/p&gt;
&lt;p&gt;You need to include the W3TC &lt;code&gt;nginx.conf&lt;/code&gt; file generated in the root of your wordpress install to the wordpress nginx server block. Add this to bottom of the server block below the php location block.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;/etc/nginx/sites-available/wordpress&lt;/code&gt;&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;server&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  [...]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;# For W3 Total Cache(W3TC)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt; include &lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;/var/www/nginx.conf;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Save(&lt;code&gt;Ctrl+x&lt;/code&gt;) and restart nginx: &lt;code&gt;sudo service nginx restart&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;There is a lot more you can do with W3 Total Cache but those are just the easy click and done settings. To further utilize this plugin, you could get a CDN to host all of your static files, or even add in the &lt;a href=&quot;https://www.cloudflare.com/&quot;&gt;CloudFlare&lt;/a&gt; integration.&lt;/p&gt;
&lt;h2 id=&quot;want-even-more&quot;&gt;Want even more?&lt;/h2&gt;
&lt;p&gt;You could even install Varnish. Varnish is a web app accelerator that stores a copy of a page and serves it immediately when a request comes in rather than having Nginx and WordPress rebuild the page on every request. This will act as another layer of caching on top of &lt;code&gt;W3 Total Cache&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;In the &lt;code&gt;W3 Total Cache&lt;/code&gt; settings under the &lt;code&gt;Reverse Proxy&lt;/code&gt; category make sure to add &lt;code&gt;127.0.0.1&lt;/code&gt; to the &lt;code&gt;Varnish Servers&lt;/code&gt; textarea. This will allow W3 Total Cache to purge the Varnish cache.&lt;/p&gt;
&lt;h2 id=&quot;common-commands&quot;&gt;Common Commands:&lt;/h2&gt;

















&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Command&lt;/th&gt;&lt;th&gt;Description&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;sudo service nginx restart&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Restart the Nginx process&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;sudo nano /etc/nginx/sites-available/wordpress&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Edit the Nginx server block we made for WordPress&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;</content:encoded></item><item><title>Facedancer21 Getting Started in Windows</title><link>https://ericeastwood.com/blog/facedancer21-getting-started-in-windows/</link><guid isPermaLink="true">https://ericeastwood.com/blog/facedancer21-getting-started-in-windows/</guid><description>This guide will go over compiling the firmware, flashing it to your device, and emulating your first USB device. I was successful using Windows 8(not 8.1) but it still came with challenges. Hopefully this guide can steer you clear of any head-banging issues.
If you need help making/assembling your own Facedancer board, follow this guide I made previously.
Getting started
Inspect your board for any solder bridges, cold joints, etc. Use a multimeter in continuity mode to test. This is important as you are connecting this to your precious pc.
Plug in the host side to your pc via USB 2.0. I ran into Blue Screen issues on Windows 8 using USB 3.0.
If you want to be cautious, plug it in on an old</description><pubDate>Wed, 19 Mar 2014 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;This guide will go over compiling the firmware, flashing it to your device, and emulating your first USB device. I was successful using Windows 8(not 8.1) but it still came with challenges. Hopefully this guide can steer you clear of any head-banging issues.&lt;/p&gt;
&lt;p&gt;If you need help making/assembling your own Facedancer board, follow &lt;a href=&quot;/blog/13/assembling-the-facedancer21&quot;&gt;this guide&lt;/a&gt; I made previously.&lt;/p&gt;
&lt;h2 id=&quot;getting-started&quot;&gt;Getting started&lt;/h2&gt;
&lt;p&gt;Inspect your board for any solder bridges, cold joints, etc. Use a multimeter in continuity mode to test. This is important as you are connecting this to your precious pc.&lt;/p&gt;
&lt;p&gt;Plug in the host side to your pc via USB 2.0. &lt;a href=&quot;https://www.youtube.com/watch?v=JKYcg53YHMo&quot;&gt;I ran into Blue Screen issues on Windows 8 using USB 3.0&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;If you want to be cautious, plug it in on an old PC first and see if it enumerates without issue. You could even use a &lt;a href=&quot;http://www.circuitsathome.com/products-page/usb-interfaces/adum4160-usb-isolator-board-populated&quot;&gt;USB Isolator like this&lt;/a&gt;(I use one).&lt;/p&gt;
&lt;p&gt;You should see the Rx and Tx LEDs blink a bit. It should automatically start finding drivers. When it is done, in Device Manager, you should have &lt;code&gt;USB Serial Converter&lt;/code&gt; under the Universal Serial Bus controllers category and a &lt;code&gt;USB Serial Port(COMx)&lt;/code&gt; under Ports (COM &amp;#x26; LPT) category.&lt;/p&gt;
&lt;h2 id=&quot;getting-the-code&quot;&gt;Getting the code&lt;/h2&gt;
&lt;p&gt;All of the firmware is available in the &lt;a href=&quot;https://svn.code.sf.net/p/goodfet/code/&quot;&gt;goodfet svn repo&lt;/a&gt;. To download the repo, download and install &lt;a href=&quot;https://tortoisesvn.net/&quot;&gt;TortoiseSVN&lt;/a&gt;. Now create a folder where you want to store the svn(avoid spaces in the path). I chose &lt;code&gt;Downloads/goodfet_svn&lt;/code&gt;. TortoiseSVN is a shell extension so that means it adds entries to your right-click context menu. Right click the folder you just created and click &lt;code&gt;SVN Checkout...&lt;/code&gt; &lt;img src=&quot;/images/blog/facedancer21-getting-started-in-windows/tortoise-svn-checkout.png&quot; alt=&quot;TortoiseSVN Checkout&quot;&gt;. In the URL field enter: &lt;code&gt;https://svn.code.sf.net/p/goodfet/code/trunk/&lt;/code&gt; and press OK. All of the files should download and you will get a green checkmark on all the files and directories.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/facedancer21-getting-started-in-windows/svn-checkout-dialog.png&quot; alt=&quot;SVN checkout dialog&quot;&gt;&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;client&lt;/code&gt; folder refers to more of the host-side stuff. The &lt;code&gt;firmware&lt;/code&gt; folder applies to the stuff you program into your device.&lt;/p&gt;
&lt;p&gt;After you got it all downloaded you need to add the &lt;code&gt;client&lt;/code&gt; directory to your &lt;code&gt;path&lt;/code&gt; environment variable. ex: &lt;code&gt;C:\Users\madli_000\Downloads\goodfet_svn\client;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Note: You will need to exit your console(cmd prompt) every time you update an environment variable for them to take effect. To set or modify an environment variable, you can use &lt;code&gt;setx somekey somevalue&lt;/code&gt; in cmd prompt. Or go to control panel: &lt;strong&gt;Control Panel&lt;/strong&gt; -&gt; &lt;strong&gt;System and Security&lt;/strong&gt; -&gt; &lt;strong&gt;System&lt;/strong&gt; -&gt; &lt;strong&gt;Advanced System Settings&lt;/strong&gt; -&gt; &lt;strong&gt;Environment Variables&lt;/strong&gt;. If you are adding directories to the &lt;code&gt;path&lt;/code&gt; variable, just separate them with a semicolon(&lt;code&gt;;&lt;/code&gt;).&lt;/p&gt;
&lt;h2 id=&quot;compiling-the-code&quot;&gt;Compiling the Code&lt;/h2&gt;
&lt;p&gt;If you just want a pre-compiled hex file (not sure how up to date it is), you can just &lt;a href=&quot;http://goodfet.sourceforge.net/dist/facedancer21.hex&quot;&gt;download from the project &lt;code&gt;dist/&lt;/code&gt; directory&lt;/a&gt;. Otherwise, you&apos;ll need to compile it yourself using the steps below:&lt;/p&gt;
&lt;!-- prettier-ignore --&gt;
&lt;ol&gt;
&lt;li&gt;Install &lt;a href=&quot;https://www.python.org/download/&quot;&gt;32-bit Python 2.7.x&lt;/a&gt;. Add python to your &lt;code&gt;path&lt;/code&gt; environment variable; ex. &lt;code&gt;C:\Python27_32bit\;C:\Python27_32bit\Scripts;&lt;/code&gt;. If you don&apos;t add it to your path you will have to call python via its full path every time like &lt;code&gt;&quot;C:\Python27_32bit\python.exe&quot;&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Install pyserial by running this command &lt;code&gt;pip install pyserial&lt;/code&gt;. If you need the &lt;code&gt;pip&lt;/code&gt; command: Use &lt;a href=&quot;https://www.lfd.uci.edu/~gohlke/pythonlibs/&quot;&gt;these Windows binaries&lt;/a&gt; and first install &lt;code&gt;setuptools&lt;/code&gt;. Then install &lt;code&gt;pip&lt;/code&gt;. If you didn&apos;t add python to your path in the previous step you will have to use pip&apos;s full path like: &lt;code&gt;&quot;C:\Python27_32bit\Scripts\pip.exe&quot; install pyserial&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Install &lt;a href=&quot;http://www.mingw.org/&quot;&gt;MinGW&lt;/a&gt;. Add it to your &lt;code&gt;path&lt;/code&gt; environment variable; ex. &lt;code&gt;C:\MinGW\bin&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Download the &lt;a href=&quot;https://sourceforge.net/projects/mspgcc/&quot;&gt;mspgcc zip&lt;/a&gt;. Create a &lt;code&gt;3rd_party&lt;/code&gt; folder inside your MinGW installation (&lt;code&gt;C:\MinGW\3rd_party&lt;/code&gt;). Copy the mspgcc zip into this folder. Now unzip it. Add the bin folder inside where you unzipped to your &lt;code&gt;path&lt;/code&gt; environment variable; ex. &lt;code&gt;C:\MinGW\3rd_party\mspgcc-20120406-p20120911\bin&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Install &lt;a href=&quot;https://github.com/bmatzelle/gow&quot;&gt;GOW: &lt;em&gt;lightweight alternative to Cygwin&lt;/em&gt;&lt;/a&gt;. It should be already added to your &lt;code&gt;path&lt;/code&gt; but just check to make sure; ex. &lt;code&gt;C:\Program Files (x86)\Gow\bin&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Add the environment variable &lt;code&gt;board&lt;/code&gt; with the value of &lt;code&gt;facedancer21&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;cd&lt;/code&gt; to the &lt;code&gt;firmware&lt;/code&gt; folder in the svn(ex. &lt;code&gt;cd &quot;C:\Users\madli_000\Downloads\goodfet_svn\firmware&quot;&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;make clean install&lt;/code&gt; in cmd prompt. This will probably error out(like the message below) but do not worry. you still generated/compiled the &lt;code&gt;goodfet.hex&lt;/code&gt; file we need.
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;make (e=2): The system cannot find the file specified.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;make: *** [install] Error 2&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&quot;flashing-the-code&quot;&gt;Flashing the code&lt;/h2&gt;
&lt;p&gt;It is important to understand the &lt;code&gt;COMX&lt;/code&gt;, &lt;code&gt;ttySX&lt;/code&gt;, &lt;code&gt;port X&lt;/code&gt; relationship. Simply put, &lt;code&gt;ttySX&lt;/code&gt; and &lt;code&gt;port X&lt;/code&gt; are zero indexed so they will be one less than COMX. ex. COM7=ttyS6=port 6&lt;/p&gt;
&lt;p&gt;Flash the firmware to your Facedancer board:&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;&quot;C:\Python27_32bit\python.exe&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;C:\Users\madli_000\Downloads\goodfet_svn\client\goodfet.bsl&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;--comport=6&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;--speed=38400&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;--debug&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;-e&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;-p&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;C:\Users\madli_000\Downloads\goodfet_svn\firmware\goodfet.hex&quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;OR if you added python to your path and are in the &lt;code&gt;client&lt;/code&gt; directory, it can be simplified to:&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;python&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;goodfet.bsl&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;--comport=6&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;--speed=38400&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;--debug&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;-e&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;-p&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;../firmware/goodfet.hex&quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;A lot of stuff should scroll in your cmd prompt. When it is done it should say: &lt;code&gt;5374 bytes programmed.&lt;/code&gt; You can see the full output of this being successful with &lt;code&gt;DEBUG=3&lt;/code&gt; in &lt;code&gt;goodfet.bsl&lt;/code&gt; in &lt;a href=&quot;https://pastebin.com/9QKNNXsY&quot;&gt;this pastebin&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;You can run &lt;code&gt;&quot;C:\Python27_32bit\python.exe&quot; goodfet.bsl -h&lt;/code&gt; to find out what all those parameters mean.&lt;/p&gt;
&lt;h2 id=&quot;emulating-your-first-usb-device-communicating-through-the-target-port&quot;&gt;Emulating your first USB Device (Communicating through the TARGET port)&lt;/h2&gt;
&lt;p&gt;Now that your board is all set up, it is time to get into the action.&lt;/p&gt;
&lt;p&gt;Plug in another cable in the &lt;code&gt;TARGET&lt;/code&gt; end and into another PC or your own(haven&apos;t tried).&lt;/p&gt;
&lt;p&gt;In the &lt;code&gt;client&lt;/code&gt; svn directory, run &lt;code&gt;python goodfet.maxusbhid&lt;/code&gt; in cmd prompt.&lt;/p&gt;
&lt;p&gt;You should see the lights start to blink pretty solid. On the second PC, in Device Manager you should see &lt;code&gt;HID Keyboard Device&lt;/code&gt; under the keyboards category.&lt;/p&gt;
&lt;details&gt;
&lt;summary&gt;Here is the full console output of running that command.&lt;/summary&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;C:\Users\madli_000\Downloads\goodfet_svn\client&gt;&quot;C:\Python27_32bit\python.exe&quot; goodfet.maxusbhid&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;C:\Users\madli_000\Downloads\goodfet_svn\client\GoodFETMAXUSB.py:15: UserWarning: This library will soon be deprecated in favor of the USB*.py libraries.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &quot;&quot;&quot;This library will soon be deprecated in favor of the USB*.py libraries.&quot;&quot;&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;goodfet.maxusbhid:16: UserWarning: The libraries upon which this program depends will soon be deprecated in&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;favor of the USB*.py libraries.  See facedancer-keyboard.py for an example of&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;this program written using the new libraries.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  this program written using the new libraries.&quot;&quot;&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;port: None&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;port: None&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;port: COM7&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;Connected to MAX342x Rev. 13&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;Starting a HID device.  This won&apos;t return.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;Handling a setup packet of bmRequestType=0x80, bRequest=0x06, wValue=0x0100, wIndex=0x0000, wLength=0x0040&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;Handling a setup packet of bmRequestType=0x00, bRequest=0x05, wValue=0x0001, wIndex=0x0000, wLength=0x0000&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;Handling a setup packet of bmRequestType=0x80, bRequest=0x06, wValue=0x0100, wIndex=0x0000, wLength=0x0012&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;Handling a setup packet of bmRequestType=0x80, bRequest=0x06, wValue=0x0200, wIndex=0x0000, wLength=0x0009&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;Handling a setup packet of bmRequestType=0x80, bRequest=0x06, wValue=0x0300, wIndex=0x0000, wLength=0x00ff&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;Handling a setup packet of bmRequestType=0x80, bRequest=0x06, wValue=0x0303, wIndex=0x0409, wLength=0x00ff&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;Handling a setup packet of bmRequestType=0x80, bRequest=0x06, wValue=0x0200, wIndex=0x0000, wLength=0x00ff&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;Handling a setup packet of bmRequestType=0x80, bRequest=0x06, wValue=0x0300, wIndex=0x0000, wLength=0x00ff&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;Handling a setup packet of bmRequestType=0x80, bRequest=0x06, wValue=0x0302, wIndex=0x0409, wLength=0x00ff&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;Handling a setup packet of bmRequestType=0x80, bRequest=0x06, wValue=0x0300, wIndex=0x0000, wLength=0x00ff&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;Handling a setup packet of bmRequestType=0x80, bRequest=0x06, wValue=0x0302, wIndex=0x0409, wLength=0x00ff&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;Handling a setup packet of bmRequestType=0x80, bRequest=0x06, wValue=0x0100, wIndex=0x0000, wLength=0x0012&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;Handling a setup packet of bmRequestType=0x80, bRequest=0x06, wValue=0x0200, wIndex=0x0000, wLength=0x0009&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;Handling a setup packet of bmRequestType=0x80, bRequest=0x06, wValue=0x0200, wIndex=0x0000, wLength=0x0022&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;Handling a setup packet of bmRequestType=0x00, bRequest=0x09, wValue=0x0001, wIndex=0x0000, wLength=0x0000&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;Handling a setup packet of bmRequestType=0x21, bRequest=0x0a, wValue=0x0000, wIndex=0x0000, wLength=0x0000&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;Stalling a class request.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;Stalling EPO for bmRequestType=0x21, bRequest=0x0a, wValue=0x0000, wIndex=0x0000, wLength=0x0000&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;Handling a setup packet of bmRequestType=0x81, bRequest=0x06, wValue=0x2200, wIndex=0x0000, wLength=0x006b&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/details&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/facedancer21-getting-started-in-windows/device-manager-with-hid-keyboard-device.jpg&quot; alt=&quot;Device Manager: HID Keyboard Device&quot;&gt;&lt;/p&gt;
&lt;h1 id=&quot;running-into-issues&quot;&gt;Running into issues?&lt;/h1&gt;
&lt;p&gt;This guide is mostly from my memory as I didn&apos;t want to uninstall everything just to try to step back through it. If you running into an issue, try these things below and then contact me and tell me what I forgot.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Try &lt;a href=&quot;https://www.cygwin.com/install.html&quot;&gt;Cygwin&lt;/a&gt;. I couldn&apos;t get it to program but maybe you will be successful. You will need the &lt;code&gt;devel/make&lt;/code&gt; and the &lt;code&gt;python&lt;/code&gt; package.&lt;/li&gt;
&lt;li&gt;If using Cygwin, try adding the environment variable &lt;code&gt;CYGWIN&lt;/code&gt; with the value of &lt;code&gt;reset_com&lt;/code&gt;. See &lt;a href=&quot;https://cygwin.com/cygwin-ug-net/using-cygwinenv.html&quot;&gt;this documentation&lt;/a&gt; for more details.&lt;/li&gt;
&lt;li&gt;Try setting the environment variable &lt;code&gt;GOODFET&lt;/code&gt; to &lt;code&gt;ttyS6&lt;/code&gt; or &lt;code&gt;6&lt;/code&gt;. This is sometimes used in some of the scripts if it can&apos;t find a port.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;command-cheat-sheet&quot;&gt;Command cheat sheet&lt;/h2&gt;





























&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Command&lt;/th&gt;&lt;th&gt;Description&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;make clean install&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Same as &lt;code&gt;make clean&lt;/code&gt; and &lt;code&gt;make install&lt;/code&gt;. Use in the &lt;code&gt;firmware&lt;/code&gt; svn directory to compile and create the &lt;code&gt;goodfet.hex&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;python goodfet.bsl --comport=6 --speed=38400 --debug -e -p &quot;../firmware/goodfet.hex&quot;&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Use in the &lt;code&gt;client&lt;/code&gt; svn directory to Program the board with the compiled hex on COM7(change port to your situation).&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;python goodfet.bsl -h&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Show the help text for goodfet.bsl. Shows all possible arguments, etc.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;python goodfet.maxusbhid&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Use in the &lt;code&gt;client&lt;/code&gt; svn directory to emulate a HID Keyboard device.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;python -m serial.tools.list_ports&lt;/code&gt;&lt;/td&gt;&lt;td&gt;List all serial ports. &lt;a href=&quot;http://pyserial.sourceforge.net/shortintro.html#listing-ports&quot;&gt;Does not always work properly&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;h2 id=&quot;extra-links&quot;&gt;Extra Links:&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://goodfet.sourceforge.net/hardware/facedancer21/&quot;&gt;Official Facedancer21 page&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://int3.cc/blogs/news/8217777-flashing-the-facedancer21&quot;&gt;Flashing the FaceDancer21 by int3.cc&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://blog.j-michel.org/post/67652808280/a-journey-in-script-kiddie-land-and-kernel-land&quot;&gt;A journey in script-kiddie-land and kernel-land&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content:encoded></item><item><title>Swap File Guide (Ubuntu)</title><link>https://ericeastwood.com/blog/swap-file-guide-ubuntu/</link><guid isPermaLink="true">https://ericeastwood.com/blog/swap-file-guide-ubuntu/</guid><description>Here is a basic how-to guide on setting up and managing a swap file. I am using Ubuntu 12.04 but I am sure it applies to other versions and Linux distros. I recently had to figure out how to increase the size of an existing swap file so I thought I would throw together a guide(see section below &quot;Create Swap file` if you need to do this).
A swap file(called a page file in Windows) is a way to increase memory/RAM capacity without upgrading hardware (virtual memory). It is simply a file on your hard drive. When your physical sticks of RAM get full, the system will copy over to the swap file to avoid a crash or lose data. Swap</description><pubDate>Tue, 11 Mar 2014 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Here is a basic how-to guide on setting up and managing a swap file. I am using Ubuntu 12.04 but I am sure it applies to other versions and Linux distros. I recently had to figure out how to increase the size of an existing swap file so I thought I would throw together a guide(see section below &quot;Create Swap file` if you need to do this).&lt;/p&gt;
&lt;p&gt;A swap file(called a page file in Windows) is a way to increase memory/RAM capacity without upgrading hardware (virtual memory). It is simply a file on your hard drive. When your physical sticks of RAM get full, the system will copy over to the swap file to avoid a crash or lose data. Swap files will be slower at reading and writing because they reside on your hard drive but is better than a complete failure.&lt;/p&gt;
&lt;p&gt;See table of useful commands (cheat sheet) when dealing with swap files at the bottom of this article.&lt;/p&gt;
&lt;h1 id=&quot;create-a-swap-file&quot;&gt;Create a swap file&lt;/h1&gt;
&lt;h2 id=&quot;create-a-file-for-swapping&quot;&gt;Create a file for swapping&lt;/h2&gt;
&lt;p&gt;You need to create a big file the size of your swap. Use &lt;code&gt;dd&lt;/code&gt; or &lt;code&gt;fallocate&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;ex:&lt;br&gt;
Create a 512MB or .5GB swap file: &lt;code&gt;sudo dd if=/dev/zero of=/swapfile bs=1024 count=524288&lt;/code&gt;&lt;br&gt;
Create a 1024MB or 1GB swap file: &lt;code&gt;sudo dd if=/dev/zero of=/swapfile bs=1024 count=1048576&lt;/code&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Size is determined by: &lt;code&gt;bs*count&lt;/code&gt; in bytes&lt;/li&gt;
&lt;li&gt;&lt;code&gt;if=/dev/zero&lt;/code&gt; makes it read from that file. &lt;a href=&quot;https://en.wikipedia.org/wiki//dev/zero&quot;&gt;&lt;code&gt;/dev/zero&lt;/code&gt;&lt;/a&gt; returns as many null characters that are read.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;of=/swapfile&lt;/code&gt; determines the name&lt;/li&gt;
&lt;li&gt;&lt;code&gt;bs&lt;/code&gt; is the number of bytes in a chunk&lt;/li&gt;
&lt;li&gt;&lt;code&gt;count&lt;/code&gt; is the number of chunks&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;prepare-the-swap-file&quot;&gt;Prepare the swap file&lt;/h2&gt;
&lt;p&gt;Run: &lt;code&gt;sudo mkswap /swapfile&lt;/code&gt;&lt;/p&gt;
&lt;h2 id=&quot;activate-the-swap-file&quot;&gt;Activate the swap file&lt;/h2&gt;
&lt;p&gt;Run: &lt;code&gt;sudo swapon /swapfile&lt;/code&gt;&lt;/p&gt;
&lt;h2 id=&quot;make-the-swap-file-permanent-by-adding-it-the-the-fstab&quot;&gt;Make the swap file permanent by adding it the the &lt;code&gt;fstab&lt;/code&gt;&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Open &lt;code&gt;/etc/fstab&lt;/code&gt;. You could use: &lt;code&gt;sudo nano /etc/fstab&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Add this line to the end: &lt;code&gt;/swapfile none swap sw 0 0&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;em&gt;If you want to learn more about the &lt;code&gt;fstab&lt;/code&gt; syntax/configuration, see &lt;a href=&quot;https://help.ubuntu.com/community/Fstab#Fstab_File_Configuration&quot;&gt;this fstab Ubuntu doc&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;
&lt;h2 id=&quot;set-the-permissions-on-the-swap-file-to-0600&quot;&gt;Set the permissions on the swap file to &lt;code&gt;0600&lt;/code&gt;:&lt;/h2&gt;
&lt;p&gt;This will only allow the owner(root) to read and write to the file.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;sudo chown root:root /swapfile&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;sudo chmod 0600 /swapfile&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;set-swappiness-to-10&quot;&gt;Set swappiness to 10&lt;/h2&gt;
&lt;p&gt;Swappiness is a value 0 to 100. A value of 0 means that the swap file will be avoided until actually necessary (run out of memory). A value of 100 will put stuff into the swap file as soon as possible. The default is 60. You can think of the number as the percentage left of actual RAM when the system starts copying into the swap file.&lt;/p&gt;
&lt;p&gt;A swappiness value of 10 will make it act as an emergency airbag to avoid &lt;code&gt;out of memory&lt;/code&gt; errors.&lt;/p&gt;
&lt;p&gt;Run both commands:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;echo 10 | sudo tee /proc/sys/vm/swappiness&lt;/code&gt; OR &lt;code&gt;sudo sysctl vm.swappiness=10&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;echo vm.swappiness = 10 | sudo tee -a /etc/sysctl.conf&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The first one modifies the swapiness variable in the virtual memory(vm) process(not permanent). And the second makes it permanent by adding it to the conf which gets loaded in at boot time.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;You can &lt;a href=&quot;http://linux.101hacks.com/unix/tee-command-examples/&quot;&gt;see how &lt;code&gt;tee&lt;/code&gt; works here&lt;/a&gt;. It just overwrites the file and displays what is written. The &lt;code&gt;-a&lt;/code&gt; parameter appends the text instead.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Alternatively you can just:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Open &lt;code&gt;/etc/sysctl.conf&lt;/code&gt;. You could use &lt;code&gt;sudo nano /etc/sysctl.conf&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Find &lt;code&gt;vm.swappiness&lt;/code&gt;. If it doesn&apos;t exist, add it to bottom of the file: &lt;code&gt;vm.swappiness=10&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Change value to 10 and save. If using nano: press &lt;code&gt;Ctrl+x&lt;/code&gt; to exit, then press &lt;code&gt;y&lt;/code&gt; to save.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can check your swappiness value using this command: &lt;code&gt;cat /proc/sys/vm/swappiness&lt;/code&gt;&lt;/p&gt;
&lt;h2 id=&quot;verify-it-is-working&quot;&gt;Verify it is working:&lt;/h2&gt;
&lt;p&gt;Run &lt;code&gt;sudo swapon -s&lt;/code&gt; to see a summary of your swap file setup. It should be listed.&lt;/p&gt;
&lt;p&gt;Also if you run &lt;code&gt;free -m&lt;/code&gt;, it should show the split in usage between mem and swap.&lt;/p&gt;
&lt;h1 id=&quot;resize-existing-swap-file-increase-swap-sizespace&quot;&gt;Resize existing swap file (increase swap size/space)&lt;/h1&gt;
&lt;p&gt;Just create a new swapfile (follow instructions above), then deactivate the old one. Don&apos;t forget to update the &lt;code&gt;fstab&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;To deactivate a swapfile: &lt;code&gt;sudo swapoff /swapfile&lt;/code&gt;&lt;br&gt;
To delete the swapfile: &lt;code&gt;sudo rm /swapfile&lt;/code&gt;&lt;/p&gt;
&lt;h1 id=&quot;other-references&quot;&gt;Other References:&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://help.ubuntu.com/community/SwapFaq&quot;&gt;Ubuntu Docs: SwapFaq&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.digitalocean.com/community/articles/how-to-add-swap-on-ubuntu-12-04&quot;&gt;How To Add Swap on Ubuntu 12.04 - DigitalOcean&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id=&quot;basic-command-cheat-sheet&quot;&gt;Basic Command cheat sheet:&lt;/h1&gt;





































&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Command&lt;/th&gt;&lt;th&gt;Description&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;sudo swapon -s&lt;/code&gt;&lt;/td&gt;&lt;td&gt;List swap files&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;free -m&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Show memory usage breakdown&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;cat /proc/sys/vm/swappiness&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Check swappiness value&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;sudo swapon -a&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Turn on all swap files&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;sudo swapon /swapfile&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Turn on swap file specified&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;sudo swapoff -a&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Turn off all swap files&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;sudo swapoff /swapfile&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Turn off swap file specified&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;</content:encoded></item><item><title>Assembling the Facedancer21</title><link>https://ericeastwood.com/blog/assembling-the-facedancer21/</link><guid isPermaLink="true">https://ericeastwood.com/blog/assembling-the-facedancer21/</guid><description>The Facedancer is a board to fuzz and emulate/prototype USB devices with host side python, PyUSB. Here is the official Facedancer21 page. It was masterminded by Travis Goodspeed and Sergey Bratus. The Facedancer21 is the 24th revision of the pcb.
The Facedancer is not really available pre-assembled for cheap so you will have to build your own. You can buy a fully assembled version from this site but you don&apos;t get any SMD soldering practice and it costs about double.
If you already have a board and need some help flashing it and emulating your first device, follow this guide.

Tools:

Soldering Iron
Spool of Solder
Flux (I used a flux pen)
Tweezers
Spool of desoldering Wick or Braid
Multimeter for testing
Helping hands
Magnifying glass or something of the sorts


Parts:
You</description><pubDate>Thu, 06 Mar 2014 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;The Facedancer is a board to fuzz and emulate/prototype USB devices with host side python, &lt;a href=&quot;https://github.com/walac/pyusb&quot;&gt;PyUSB&lt;/a&gt;. Here is the &lt;a href=&quot;http://goodfet.sourceforge.net/hardware/facedancer21/&quot;&gt;official Facedancer21 page&lt;/a&gt;. It was masterminded by Travis Goodspeed and Sergey Bratus. The Facedancer21 is the 24th revision of the pcb.&lt;/p&gt;
&lt;p&gt;The Facedancer is not really available pre-assembled for cheap so you will have to build your own. You can buy a fully assembled version from &lt;a href=&quot;https://int3.cc/products/facedancer21&quot;&gt;this site&lt;/a&gt; but you don&apos;t get any SMD soldering practice and it costs about double.&lt;/p&gt;
&lt;p&gt;If you already have a board and need some help flashing it and emulating your first device, follow &lt;a href=&quot;/blog/15/facedancer21-getting-started-in-windows&quot;&gt;this guide&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/assembling-the-facedancer21/facedancer21-and-parts.png&quot; alt=&quot;Facedancer21 and Parts&quot;&gt;&lt;/p&gt;
&lt;h2 id=&quot;tools&quot;&gt;Tools:&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Soldering Iron&lt;/li&gt;
&lt;li&gt;Spool of Solder&lt;/li&gt;
&lt;li&gt;Flux &lt;em&gt;(I used a flux pen)&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;Tweezers&lt;/li&gt;
&lt;li&gt;Spool of desoldering Wick or Braid&lt;/li&gt;
&lt;li&gt;Multimeter for testing&lt;/li&gt;
&lt;li&gt;Helping hands&lt;/li&gt;
&lt;li&gt;Magnifying glass or something of the sorts&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/assembling-the-facedancer21/soldering-tools.png&quot; alt=&quot;Soldering Tools&quot;&gt;&lt;/p&gt;
&lt;h2 id=&quot;parts&quot;&gt;Parts:&lt;/h2&gt;
&lt;p&gt;You can order the Facedancer PCB by following &lt;a href=&quot;http://goodfet.sourceforge.net/orders/&quot;&gt;the instructions on this page&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I ordered double of the jelly-bean parts (resistors, capacitors, LEDs) in case I messed up soldering or lost one. All of the parts will run you about $35 from Digikey.&lt;/p&gt;
&lt;p&gt;Once you have received all of your parts, make sure they sent you the right parts. Visually inspect and match them to the images on Digikey. Digikey made a pick-error and sent me the wrong part. I got some 1k resistors instead of the 0.1uF caps. I didn&apos;t realize this when soldering them and when I plugged in the board it caused my PC to Blue Screen(BSoD). Luckily the good people in the &lt;code&gt;#goodfet&lt;/code&gt; IRC channel were able to spot that I had resistors where the caps should be.&lt;/p&gt;






































































&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Part (link to Digikey)&lt;/th&gt;&lt;th&gt;Package&lt;/th&gt;&lt;th&gt;Quantity&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;https://www.digikey.com/product-detail/en/FT232RL-REEL/768-1007-1-ND/&quot;&gt;FT232RL&lt;/a&gt;&lt;/td&gt;&lt;td&gt;SSOP28&lt;/td&gt;&lt;td&gt;1&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;https://www.digikey.com/product-detail/en/MSP430F2618TPM/296-26223-ND/&quot;&gt;MSP430F2618TPM&lt;/a&gt;&lt;/td&gt;&lt;td&gt;QFP64&lt;/td&gt;&lt;td&gt;1&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;https://www.digikey.com/product-detail/en/MAX3421EEHJ%2B/MAX3421EEHJ%2B-ND/&quot;&gt;MAX3421E&lt;/a&gt;&lt;/td&gt;&lt;td&gt;TQFP32&lt;/td&gt;&lt;td&gt;1&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;https://www.digikey.com/product-detail/en/USB-M26FTR/ED2992CT-ND/&quot;&gt;USB Mini female&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;2&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;https://www.digikey.com/product-search/en/USB-A1HSW6/ED2989-ND&quot;&gt;USB Type A female&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;1&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;https://www.digikey.com/product-detail/en/ABLS-12.000MHZ-B4-T/535-10218-1-ND/&quot;&gt;12 Mhz Crystal&lt;/a&gt;&lt;/td&gt;&lt;td&gt;HC49/US&lt;/td&gt;&lt;td&gt;1&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;https://www.digikey.com/product-detail/en/GRM1885C1H270JA01D/490-1413-1-ND/&quot;&gt;27pF capacitors&lt;/a&gt;&lt;/td&gt;&lt;td&gt;0603&lt;/td&gt;&lt;td&gt;2&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;https://www.digikey.com/product-detail/en/LMK107B7105KA-T/587-1242-1-ND/&quot;&gt;1uF capacitors&lt;/a&gt;&lt;/td&gt;&lt;td&gt;0603&lt;/td&gt;&lt;td&gt;2&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;https://www.digikey.com/product-detail/en/GRM188R71C104KA01D/490-1532-1-ND/&quot;&gt;0.1uF Decoupling Capacitors&lt;/a&gt;&lt;/td&gt;&lt;td&gt;0603&lt;/td&gt;&lt;td&gt;3&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;https://www.digikey.com/product-detail/en/APT1608SGC/754-1121-1-ND/&quot;&gt;0603 LEDs&lt;/a&gt;&lt;/td&gt;&lt;td&gt;0603&lt;/td&gt;&lt;td&gt;3&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;https://www.digikey.com/product-detail/en/RMCF0603JT330R/RMCF0603JT330RCT-ND/&quot;&gt;330ohm Resistors&lt;/a&gt;&lt;/td&gt;&lt;td&gt;0603&lt;/td&gt;&lt;td&gt;2&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;https://www.digikey.com/product-detail/en/RMCF0603JT33R0/RMCF0603JT33R0CT-ND/&quot;&gt;33ohm Resistors&lt;/a&gt;&lt;/td&gt;&lt;td&gt;0603&lt;/td&gt;&lt;td&gt;2&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;h2 id=&quot;assembly&quot;&gt;Assembly:&lt;/h2&gt;
&lt;p&gt;Here are a few SMD soldering tutorials to watch before you get started:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=b9FC9fAlfQE&quot;&gt;EEVblog #186 - Soldering Tutorial Part 3 - Surface Mount&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=3NN7UGWYmBY&quot;&gt;Surface Mount Soldering 101&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you have any random boards and parts, practice with those a bit before starting.&lt;/p&gt;
&lt;p&gt;I used a couple techniques to accomplish the job. Both of them are shown and explained in the video tutorials I mentioned above:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Tack and place:&lt;/strong&gt; Flux the pads. Put a bit of solder onto on of the pads. Use your tweezers to place the part and reflow the solder you just put on. Slide the part into place and remove the iron. Solder the rest of the pins/pads.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Drag soldering:&lt;/strong&gt; Flux the pads. Tack down a pin on multiple sides of the chip. Flux again. Add a little bit of solder to the first couple of pins. Now move your iron back and forth across the side until the solder flows to all the pins. You will have to make multiple passes. If you can&apos;t get solder to flow all the way down the to last pins on the side just add a bit to that side and repeat. Repeat for all sides. Check for solder bridges with your magnifying utility and use the desoldering wick/braid to clean them up.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Use the lowest temperature setting with your soldering iron that will still melt the solder. This will minimize lifting of pads, etc. It is extremely easy to lift the pads where there is a &lt;code&gt;no-connect&lt;/code&gt; (NC). Most of the pins on the MSP430 are left unconnected so if you accidentally lift a pad, check the schematic (below) to see if it is used. Just clean up the bridges.&lt;/p&gt;
&lt;h3 id=&quot;steps&quot;&gt;Steps:&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;Start with the QFP64 MSP430 chip.&lt;br&gt;
This is probably the hardest part of this build. A 64 pin 0.5mm pitch chip with very few pins actually connected to something else. You can see that a couple of pads lifted in the image, but fortunately only on unused pins (NC, not connected to anything).&lt;br&gt;
&lt;img src=&quot;/images/blog/assembling-the-facedancer21/msp-430-f2618-soldered.png&quot; alt=&quot;MSP430F2618TPM Footprint and Soldered&quot;&gt;&lt;/li&gt;
&lt;li&gt;Solder up the 3x 0.1uF caps to C1, C2, and C4 (Check the pcb layout below)&lt;br&gt;
&lt;img src=&quot;/images/blog/assembling-the-facedancer21/0-1u-f-cap-placement.png&quot; alt=&quot;0.1uF cap placement&quot;&gt;&lt;/li&gt;
&lt;li&gt;Also solder the 1x 1uF capacitor to C3&lt;br&gt;
&lt;img src=&quot;/images/blog/assembling-the-facedancer21/1u-f-cap-placement.png&quot; alt=&quot;1uF cap placement&quot;&gt;&lt;/li&gt;
&lt;li&gt;The last capacitors to solder are the 2x 27pF for the crystal oscillator. C6 and C7&lt;br&gt;
&lt;img src=&quot;/images/blog/assembling-the-facedancer21/27u-f-cap-placement.png&quot; alt=&quot;27uF cap placement&quot;&gt;&lt;/li&gt;
&lt;li&gt;Next is the row of 330ohm (2x) resistors and LEDs (3x). Tin each pad and move down the line. The little arrow on the bottom of the LED should be pointing in the same direction of the arrow on the silkscreen.&lt;br&gt;
&lt;img src=&quot;/images/blog/assembling-the-facedancer21/330ohm-led-row.png&quot; alt=&quot;330ohm and led row&quot;&gt; &lt;img src=&quot;/images/blog/assembling-the-facedancer21/330ohm-led-soldered.png&quot; alt=&quot;330ohm and led soldered&quot;&gt;&lt;/li&gt;
&lt;li&gt;Finish off the rest of the jelly bean parts by soldering the 2x 33ohm over by the &lt;code&gt;TARGET&lt;/code&gt; USB footprint.&lt;br&gt;
&lt;img src=&quot;/images/blog/assembling-the-facedancer21/330ohm-placement.png&quot; alt=&quot;330ohm placement&quot;&gt;&lt;/li&gt;
&lt;li&gt;Tack the MAX3421E chip down and drag solder each side just like the MSP430 in step 1.&lt;br&gt;
&lt;img src=&quot;/images/blog/assembling-the-facedancer21/max-3421-soldered.png&quot; alt=&quot;Soldered MAX3421E chip on the board&quot;&gt;&lt;/li&gt;
&lt;li&gt;Solder up the 2x USB Mini connectors. Tack one of the ground legs down. Do not be afraid to reflow the joint and straighten out the connector. It will be extremely hard to adjust the connector once you solder another leg.&lt;br&gt;
&lt;img src=&quot;/images/blog/assembling-the-facedancer21/usb-mini-connector-soldered.png&quot; alt=&quot;USB Mini connector soldered&quot;&gt;&lt;/li&gt;
&lt;li&gt;Solder up the FT232RL. Tack and drag.&lt;br&gt;
&lt;img src=&quot;/images/blog/assembling-the-facedancer21/ft-232-rl-soldered.png&quot; alt=&quot;FT232RL soldered&quot;&gt;&lt;/li&gt;
&lt;li&gt;Solder up the crystal. Nice and easy. Orientation does not matter.&lt;br&gt;
&lt;img src=&quot;/images/blog/assembling-the-facedancer21/crystal-soldered.png&quot; alt=&quot;Crystal Soldered&quot;&gt;&lt;/li&gt;
&lt;li&gt;Optionally, solder up the USB Type A connector on the bottom side for host functionality. You will need to bend the pins in order to fit it down onto the board. You may also want to clip a few of the leads to get them away from other pads.&lt;br&gt;
&lt;img src=&quot;/images/blog/assembling-the-facedancer21/usb-type-a-soldered.png&quot; alt=&quot;USB Type A soldered&quot;&gt;&lt;/li&gt;
&lt;li&gt;Done:&lt;br&gt;
&lt;img src=&quot;/images/blog/assembling-the-facedancer21/facedancer21-completed.png&quot; alt=&quot;Facedancer21 Completed&quot;&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&quot;whats-next&quot;&gt;Whats next?&lt;/h2&gt;
&lt;p&gt;Go flash your board. You can use my &lt;a href=&quot;/blog/15/facedancer21-getting-started-in-windows&quot;&gt;next guide&lt;/a&gt; in my Facedancer series: &lt;a href=&quot;/blog/15/facedancer21-getting-started-in-windows&quot;&gt;Facedancer21 Getting Started in Windows&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/assembling-the-facedancer21/facedancer21-pcb.png&quot; alt=&quot;Facedancer21 PCB&quot;&gt;&lt;br&gt;
&lt;img src=&quot;/images/blog/assembling-the-facedancer21/facedancer21-schematic.png&quot; alt=&quot;Facedancer21 Schematic&quot;&gt;&lt;/p&gt;
&lt;h2 id=&quot;extra-links&quot;&gt;Extra links:&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://travisgoodspeed.blogspot.com/2012/07/emulating-usb-devices-with-python.html&quot;&gt;Emulating USB Devices with Python&lt;/a&gt; by Travis Goodspeed&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://youtu.be/dp7IMyXyfvA?t=7m30s&quot;&gt;Writing a Thumbdrive from Scratch&lt;/a&gt; - Conference Talk: Travis Goodspeed&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=x-7ezoFju6I&quot;&gt;SEC-T 2012 - Trashing USB layers using the Facedancer Board&lt;/a&gt; - Conference Talk: Travis Goodspeed&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://int3.cc/blogs/news/10076009-the-facedancer21-imho-a-simple-example-of-our-community-at-it-s-best&quot;&gt;The FaceDancer21: IMHO a simple example of our community at its best...&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://hackaday.com/2012/07/05/facedancer-board-lets-your-python-programs-pretend-to-be-usb-hardware/&quot;&gt;Facedancer board lets your Python programs pretend to be USB hardware&lt;/a&gt; - Hackaday&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://blog.opensecurityresearch.com/2012/11/solder-time-facedancer11-and-goodfet41.html&quot;&gt;Solder Time! FaceDancer11 and GoodFET41 Assembly&lt;/a&gt; - Another assembly guide: By Brad Antoniewicz and Tushar Dalvi&lt;/li&gt;
&lt;/ul&gt;</content:encoded></item><item><title>CNC: Controlling Linear Servos</title><link>https://ericeastwood.com/blog/cnc-controlling-linear-servos/</link><guid isPermaLink="true">https://ericeastwood.com/blog/cnc-controlling-linear-servos/</guid><description>Here is a simple guide/tutorial on how to get your linear servo moving. The video below demos what I made. You can see how everything is set up below that:

          
            Play video
          
        
Parts:

Teensy 3.0 or 3.1: Substitute your own Arduino/microcontroller
Mini Linear Servo
1x 10 uF Capacitor
1x Diode
(Optional) Potentiometer for jog code.

I was able to run the mini servo off of the Teensy&apos;s 3.3V pin which has a 100mA max rating.
Code:
There are two different demo projects. The first one just jogs the servo back</description><pubDate>Wed, 29 Jan 2014 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Here is a simple guide/tutorial on how to get your linear servo moving. The video below demos what I made. You can see how everything is set up below that:&lt;/p&gt;
&lt;p&gt;&lt;lite-youtube videoid=&quot;Kj_3fwmUPNY&quot; style=&quot;background-image: url(&amp;#x27;https://i.ytimg.com/vi/Kj_3fwmUPNY/hqdefault.jpg&amp;#x27;);&quot;&gt;
          &lt;a href=&quot;https://youtube.com/watch?v=Kj_3fwmUPNY&quot; class=&quot;lty-playbtn no-collision-link&quot;&gt;
            &lt;span class=&quot;lyt-visually-hidden&quot;&gt;Play video&lt;/span&gt;
          &lt;/a&gt;
        &lt;/lite-youtube&gt;&lt;/p&gt;
&lt;h1 id=&quot;parts&quot;&gt;Parts:&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;Teensy 3.0 or 3.1: Substitute your own Arduino/microcontroller&lt;/li&gt;
&lt;li&gt;Mini Linear Servo&lt;/li&gt;
&lt;li&gt;1x 10 uF Capacitor&lt;/li&gt;
&lt;li&gt;1x Diode&lt;/li&gt;
&lt;li&gt;&lt;em&gt;(Optional)&lt;/em&gt; Potentiometer for jog code.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I was able to run the mini servo off of the Teensy&apos;s 3.3V pin which has a 100mA max rating.&lt;/p&gt;
&lt;h1 id=&quot;code&quot;&gt;Code:&lt;/h1&gt;
&lt;p&gt;There are two different demo projects. The first one just jogs the servo back and forth. The second demo uses the potentiometer as input to manually control the position of the servo.&lt;/p&gt;
&lt;p&gt;A linear servo works just the same as a normal hobby 0 to 180 degree servo. Instead of a short pulse being 0 degrees it represents a bottom position and 180 degrees represents a top position.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Pulse relationship (linear):&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;1000 microseconds: bottom position&lt;/li&gt;
&lt;li&gt;1500 microseconds: middle position&lt;/li&gt;
&lt;li&gt;2000 microseconds: top position&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The diode in both designs acts as a &lt;a href=&quot;https://en.wikipedia.org/wiki/Flyback_diode&quot;&gt;flyback diode&lt;/a&gt; to mitigate any current generated from moving the servo by hand (bumping the arm, etc).&lt;/p&gt;
&lt;h2 id=&quot;first-demo&quot;&gt;First demo:&lt;/h2&gt;
&lt;p&gt;Sweeps the linear servo up and down.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/cnc-controlling-linear-servos/auto-jog-servo-wiring-diagram.png&quot; alt=&quot;First Demo Wiring Diagram. Auto jog Linear Servo&quot;&gt;&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; servoPin &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; pulse &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;1000&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;setup&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;() {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;pinMode&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(servoPin, OUTPUT);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;loop&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;() {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;digitalWrite&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(servoPin, HIGH);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;delayMicroseconds&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(pulse);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;digitalWrite&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(servoPin, LOW);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;delay&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;300&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;digitalWrite&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(servoPin, HIGH);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;delayMicroseconds&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2000&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;digitalWrite&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(servoPin, LOW);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;delay&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;300&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&quot;second-demo&quot;&gt;Second Demo:&lt;/h2&gt;
&lt;p&gt;Manually control/jog the linear servo with the potentiometer. Includes some averaging to smooth the potentiometer input.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/cnc-controlling-linear-servos/linear-servo-pot-wiring-diagram.png&quot; alt=&quot;Second Demo Wiring Diagram. Linear Servo controlled by Pot&quot;&gt;&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;const&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; servoPin &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;const&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; potPin &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;23&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;const&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; pulseStart &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;1000&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt; // Number of microseconds to get to position 0%&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;const&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; pulseEnd &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2000&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt; // Number of microseconds to get to position 100%&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; pulseRange &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt; // We use this later to scale potVal&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;const&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; timeBetweenPulses &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;30000&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt; // Number of microseconds between pulses&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;elapsedMicros sincePulse;&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt; // Keeps track of time between pulses&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;elapsedMicros sincePulseStart;&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt; // Keeps track of pulse length in time&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;elapsedMicros sinceSerial;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;elapsedMicros sincePotRead;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; potVal &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;const&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; numReadings &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;8&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;readings&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;[numReadings];&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; readIndex &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; total &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; averagedPotVal &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; pulseTime &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;setup&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;() {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;pinMode&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(servoPin, OUTPUT);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	pulseRange &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; pulseEnd &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; pulseStart;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;	// Init read values&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; i &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;; i &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; numReadings; i&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;++&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;readings&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;[i] &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;Serial&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;begin&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;9600&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;loop&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;() {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(sincePotRead &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;1000&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		potVal &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;analogRead&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(potPin);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;		// subtract the last reading:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		total&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; total &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;readings&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;[readIndex];&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;		// read from the sensor:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;readings&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;[readIndex] &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; potVal;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;		// add the reading to the total:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		total&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; total &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;readings&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;[readIndex];&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;		// advance to the next position in the array:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		readIndex &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; readIndex &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;		// if we&apos;re at the end of the array...&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;		// ...wrap around to the beginning:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; (readIndex &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; numReadings)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			readIndex &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;		// calculate the average:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		averagedPotVal &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; total &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; numReadings;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		pulseTime &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; (((&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;)averagedPotVal&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;1023&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;pulseRange)&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;pulseStart;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		sincePotRead &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; (sinceSerial &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;100000&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		String unformater &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;&apos;&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		String sep &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;, &quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;Serial&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;println&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(averagedPotVal) &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; sep &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;String&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(pulseTime) &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;\0&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		sinceSerial &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(sincePulse &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; timeBetweenPulses)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;		// Keep high for the amount we want&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; (sincePulseStart &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;&amp;#x3C;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; pulseTime)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;digitalWriteFast&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(servoPin, HIGH);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;else&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;digitalWriteFast&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(servoPin, LOW);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;			// No need to to do this as we do it later&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;			// But doesn&apos;t hurt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			sincePulseStart &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;			// Now that the pulse is done&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;			// Reset the time between pulse&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			sincePulse &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;else&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;		// Reset pulseStart time until we actually get to doing it&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;		// Because this variable keeps counting&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		sincePulseStart &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content:encoded></item><item><title>Now with RSS</title><link>https://ericeastwood.com/blog/now-with-rss/</link><guid isPermaLink="true">https://ericeastwood.com/blog/now-with-rss/</guid><description>I added a RSS feed so that you can keep up with whatever I am doing. You can also see it linked in the footer.
Just follow:
https://ericeastwood.com/rss.xml
If you have any suggestions on how to improve the feed (number of items, descriptions, etc), please feel free to contact me.</description><pubDate>Tue, 21 Jan 2014 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;I added a &lt;a href=&quot;/rss.xml&quot;&gt;RSS feed&lt;/a&gt; so that you can keep up with whatever I am doing. You can also see it linked in the footer.&lt;/p&gt;
&lt;p&gt;Just follow:&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;https://ericeastwood.com/rss.xml&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If you have any suggestions on how to improve the feed (number of items, descriptions, etc), please feel free to contact me.&lt;/p&gt;</content:encoded></item><item><title>CNC: Controlling Stepper Motors</title><link>https://ericeastwood.com/blog/cnc-controlling-stepper-motors/</link><guid isPermaLink="true">https://ericeastwood.com/blog/cnc-controlling-stepper-motors/</guid><description>Here is a simple guide to get your stepper motors spinning. The video below demos what I made. You can see how everything is set up below that:

          
            Play video
          
        
Parts:

Teensy 3.0 or 3.1: Substitute your own Arduino/microcontroller
Stepper Motors: 1.7A NEMA 17 4-wire
Motor Controllers: I used a 3.5A controller with the TB6560 chips
Power Supply: 24V 10A (I used a Sopudar SPD-240-24)

Wiring Diagram / Schematic:

Code (.ino, arduino code):
const int stepperX_pul = 0;
const int stepperX_dir = 1;

const int stepperY_pul = 2;
const int stepperY_dir =</description><pubDate>Sun, 29 Dec 2013 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Here is a simple guide to get your stepper motors spinning. The video below demos what I made. You can see how everything is set up below that:&lt;/p&gt;
&lt;p&gt;&lt;lite-youtube videoid=&quot;XHOySJXU7w8&quot; style=&quot;background-image: url(&amp;#x27;https://i.ytimg.com/vi/XHOySJXU7w8/hqdefault.jpg&amp;#x27;);&quot;&gt;
          &lt;a href=&quot;https://youtube.com/watch?v=XHOySJXU7w8&quot; class=&quot;lty-playbtn no-collision-link&quot;&gt;
            &lt;span class=&quot;lyt-visually-hidden&quot;&gt;Play video&lt;/span&gt;
          &lt;/a&gt;
        &lt;/lite-youtube&gt;&lt;/p&gt;
&lt;h1 id=&quot;parts&quot;&gt;Parts:&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;Teensy 3.0 or 3.1: Substitute your own Arduino/microcontroller&lt;/li&gt;
&lt;li&gt;Stepper Motors: 1.7A NEMA 17 4-wire&lt;/li&gt;
&lt;li&gt;Motor Controllers: I used a 3.5A controller with the TB6560 chips&lt;/li&gt;
&lt;li&gt;Power Supply: 24V 10A (I used a Sopudar SPD-240-24)&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id=&quot;wiring-diagram--schematic&quot;&gt;Wiring Diagram / Schematic:&lt;/h1&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/cnc-controlling-stepper-motors/teensy-stepper-motor-setup.png&quot; alt=&quot;Teensy 3.0 Stepper Motor Setup Diagram&quot;&gt;&lt;/p&gt;
&lt;h1 id=&quot;code-ino-arduino-code&quot;&gt;Code (.ino, arduino code):&lt;/h1&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;const&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; stepperX_pul &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;const&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; stepperX_dir &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;const&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; stepperY_pul &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;const&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; stepperY_dir &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; microstep_count &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;setup&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;()&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;	// Set up the x axis&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;pinMode&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(stepperX_pul, OUTPUT);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;pinMode&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(stepperX_dir, OUTPUT);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;	// Set up the y axis&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;pinMode&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(stepperY_pul, OUTPUT);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;pinMode&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(stepperY_dir, OUTPUT);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;	// initialize the pulse pins&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;digitalWrite&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(stepperX_pul, HIGH);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;digitalWrite&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(stepperY_pul, HIGH);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;	// initialize the direction pins&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;digitalWrite&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(stepperX_dir, HIGH);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;digitalWrite&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(stepperY_dir, HIGH);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;loop&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;()&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;digitalWrite&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(stepperX_pul, HIGH);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;digitalWrite&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(stepperY_pul, HIGH);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;delayMicroseconds&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;100&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;digitalWrite&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(stepperY_pul, LOW);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;digitalWrite&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(stepperX_pul, LOW);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;delayMicroseconds&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;100&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;	// Once we make a full revolution,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;	// make the motor spin the other direction&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(microstep_count &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;3200&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;digitalWrite&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(stepperX_dir, &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;digitalRead&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(stepperX_dir));&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt; // Change direction.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;digitalWrite&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(stepperY_dir, &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;digitalRead&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(stepperY_dir));&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt; // Change direction.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;delay&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;100&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		microstep_count &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;else&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		microstep_count&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;++&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content:encoded></item><item><title>Pong on a FPGA</title><link>https://ericeastwood.com/blog/pong-on-a-fpga/</link><guid isPermaLink="true">https://ericeastwood.com/blog/pong-on-a-fpga/</guid><description>Just finished the classic tennis game Pong for my Basys 2 FPGA (built from scratch). The project is written in VHDL and is played on a VGA monitor. You can see a video of it in action at the bottom of this article.

Features:

Multiplayer: Battle against your friend
Play against the AI. Or AI vs AI battles
Score Keeping
Hidden Mode / Easter Egg (see below)

Source:
Just visit the GitHub Repo.
Controls:





























ActionControlPlayer Left/1 Paddle movementbtn2 and btn3Player Right/2 Paddle movementbtn0 and btn1Resetswitch0Player Left/1 AI Enableswitch7Player Right/2 AI Enableswitch6
Technology:
A small list of things implemented in this design:

Collision Detection and Resolution
VGA Output, game video
Text display on VGA which includes a ram arbiter (uses my other project FP-V-GA Text)
Basic AI for the paddles
Button and Switch Input
Seven-segment driver (BCD converter)

Other:
I</description><pubDate>Wed, 18 Dec 2013 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;Just finished the classic tennis game &lt;a href=&quot;https://en.wikipedia.org/wiki/Pong&quot;&gt;Pong&lt;/a&gt; for my &lt;a href=&quot;https://www.digilentinc.com/Products/Detail.cfm?Prod=BASYS2&quot;&gt;Basys 2&lt;/a&gt; FPGA (built from scratch). The project is written in VHDL and is played on a VGA monitor. You can see a video of it in action at the bottom of this article.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/pong-on-a-fpga/pong-game-screenshot.png&quot; alt=&quot;Pong game screenshot&quot;&gt;&lt;/p&gt;
&lt;h2 id=&quot;features&quot;&gt;Features:&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Multiplayer: Battle against your friend&lt;/li&gt;
&lt;li&gt;Play against the AI. Or AI vs AI battles&lt;/li&gt;
&lt;li&gt;Score Keeping&lt;/li&gt;
&lt;li&gt;Hidden Mode / Easter Egg (see below)&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;source&quot;&gt;Source:&lt;/h2&gt;
&lt;p&gt;Just visit the &lt;a href=&quot;https://github.com/MadLittleMods/VHDL-Pong&quot;&gt;GitHub Repo&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;controls&quot;&gt;Controls:&lt;/h2&gt;





























&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Action&lt;/th&gt;&lt;th&gt;Control&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;Player Left/1 Paddle movement&lt;/td&gt;&lt;td&gt;btn2 and btn3&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Player Right/2 Paddle movement&lt;/td&gt;&lt;td&gt;btn0 and btn1&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Reset&lt;/td&gt;&lt;td&gt;switch0&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Player Left/1 AI Enable&lt;/td&gt;&lt;td&gt;switch7&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Player Right/2 AI Enable&lt;/td&gt;&lt;td&gt;switch6&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;h2 id=&quot;technology&quot;&gt;Technology:&lt;/h2&gt;
&lt;p&gt;A small list of things implemented in this design:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Collision Detection and Resolution&lt;/li&gt;
&lt;li&gt;VGA Output, game video&lt;/li&gt;
&lt;li&gt;Text display on VGA which includes a ram arbiter (uses my other project &lt;a href=&quot;https://github.com/MadLittleMods/FP-V-GA-Text&quot;&gt;FP-V-GA Text&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Basic AI for the paddles&lt;/li&gt;
&lt;li&gt;Button and Switch Input&lt;/li&gt;
&lt;li&gt;Seven-segment driver (BCD converter)&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;other&quot;&gt;Other:&lt;/h2&gt;
&lt;p&gt;I entered this project into the &lt;a href=&quot;https://hackaday.com/2013/12/03/new-contest-win-one-of-20-microchip-fubarino-boards/&quot;&gt;Hackaday Fubarino Contest&lt;/a&gt; so of course there is an easter egg. Just get the score to read &lt;code&gt;1337&lt;/code&gt; and you will see an awesome Hackaday mode. This means the player on the left side needs &lt;code&gt;13&lt;/code&gt; points and player on the right needs &lt;code&gt;37&lt;/code&gt; points. The mode lasts for as long as you keep the score as &lt;code&gt;1337&lt;/code&gt; so you will have to work together to volley the ball around. I made two versions of the pixel hackaday logo but ended up using the bigger one as the ball.&lt;/p&gt;
&lt;p&gt;Featured on &lt;a href=&quot;https://hackaday.com/2013/12/26/fubarino-contest-fpga-pong/&quot;&gt;Hackaday.com&lt;/a&gt;: &lt;a href=&quot;https://hackaday.com/2013/12/26/fubarino-contest-fpga-pong/&quot;&gt;Fubarino Contest: FPGA Pong&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update 2013-12-31:&lt;/strong&gt; &lt;a href=&quot;https://hackaday.com/2013/12/31/fubarino-contest-winners/&quot;&gt;I am one of the Fubarino Contest Winners! (article on Hackaday)&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/pong-on-a-fpga/hackaday-ball.png&quot; alt=&quot;Special Hackaday ball used during Hackaday mode&quot;&gt;&lt;/p&gt;
&lt;p&gt;Watch the video to see this special mode:&lt;/p&gt;
&lt;p&gt;&lt;lite-youtube videoid=&quot;H2etR0ogEfI&quot; style=&quot;background-image: url(&amp;#x27;https://i.ytimg.com/vi/H2etR0ogEfI/hqdefault.jpg&amp;#x27;);&quot;&gt;
          &lt;a href=&quot;https://youtube.com/watch?v=H2etR0ogEfI&quot; class=&quot;lty-playbtn no-collision-link&quot;&gt;
            &lt;span class=&quot;lyt-visually-hidden&quot;&gt;Play video&lt;/span&gt;
          &lt;/a&gt;
        &lt;/lite-youtube&gt;&lt;/p&gt;</content:encoded></item><item><title>VGA Simulator: Getting Started</title><link>https://ericeastwood.com/blog/vga-simulator-getting-started/</link><guid isPermaLink="true">https://ericeastwood.com/blog/vga-simulator-getting-started/</guid><description>Go straight to the VGA Simulator
About
The VGA Simulator is a web based tool to easily view a raw VGA signal without having to hook it up to an actual CRT monitor. Easily review and save any frames generated. It uses horizontal sync, vertical sync, and red, green, blue to recreate pixel perfect frames.

The purpose of this tool was to create a faster way to debug FPGA/VHDL projects that utilize VGA. The problem is that synthesizing and generating a bit-file takes too long with Xilinx mainly because it only utilizes a single core. Although we have Simulators such as Isim to debug almost every aspect of a design, it is hard visualize a bunch a 1 or 0 flying past the</description><pubDate>Wed, 11 Dec 2013 00:00:00 GMT</pubDate><content:encoded>&lt;h2 id=&quot;go-straight-to-the-vga-simulator&quot;&gt;Go straight to the &lt;a href=&quot;https://madlittlemods.github.io/vga-simulator&quot;&gt;VGA Simulator&lt;/a&gt;&lt;/h2&gt;
&lt;h1 id=&quot;about&quot;&gt;About&lt;/h1&gt;
&lt;p&gt;The &lt;a href=&quot;https://madlittlemods.github.io/vga-simulator&quot;&gt;VGA Simulator&lt;/a&gt; is a web based tool to easily view a raw VGA signal without having to hook it up to an actual CRT monitor. Easily review and save any frames generated. It uses horizontal sync, vertical sync, and red, green, blue to recreate pixel perfect frames.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/vga-simulator-getting-started/vga-sim-example-frame.png&quot; alt=&quot;Example image frame output from the VGA simulator showing some text drawn to the screen&quot;&gt;&lt;/p&gt;
&lt;p&gt;The purpose of this tool was to create a faster way to debug FPGA/VHDL projects that utilize VGA. The problem is that synthesizing and generating a bit-file takes too long with Xilinx mainly because it only utilizes a single core. Although we have Simulators such as Isim to debug almost every aspect of a design, it is hard visualize a bunch a &lt;code&gt;1&lt;/code&gt; or &lt;code&gt;0&lt;/code&gt; flying past the screen on the rgb lines.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;This tool is not VHDL specific&lt;/strong&gt;, you just need to generate a log file with lines formatted as so: &lt;code&gt;current_sim_time time_units: hs vs red green blue&lt;/code&gt; (ex. &lt;code&gt;535 ns: 1 1 010 010 01&lt;/code&gt;)&lt;/p&gt;
&lt;p&gt;&lt;lite-youtube videoid=&quot;dvEsUZPtYF4&quot; style=&quot;background-image: url(&amp;#x27;https://i.ytimg.com/vi/dvEsUZPtYF4/hqdefault.jpg&amp;#x27;);&quot;&gt;
          &lt;a href=&quot;https://youtube.com/watch?v=dvEsUZPtYF4&quot; class=&quot;lty-playbtn no-collision-link&quot;&gt;
            &lt;span class=&quot;lyt-visually-hidden&quot;&gt;Play video&lt;/span&gt;
          &lt;/a&gt;
        &lt;/lite-youtube&gt;&lt;/p&gt;
&lt;h1 id=&quot;workflow&quot;&gt;Workflow&lt;/h1&gt;
&lt;ol&gt;
&lt;li&gt;Create a test bench for your design.&lt;/li&gt;
&lt;li&gt;Add some code that logs the vga signal to a file.&lt;/li&gt;
&lt;li&gt;Run that log file in the &lt;a href=&quot;https://madlittlemods.github.io/vga-simulator&quot;&gt;VGA Simulator&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h1 id=&quot;set-up&quot;&gt;Set up&lt;/h1&gt;
&lt;!-- prettier-ignore --&gt;
&lt;ol&gt;
&lt;li&gt;Create a test bench or open up an existing test bench&lt;/li&gt;
&lt;li&gt;Add the use statements for both the ieee and std to the top of your file with the rest of the using statements
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;use&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; ieee.std_logic_textio.&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;all&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;use&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; std.textio.&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;all&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Add the following process that logs to the file. The &lt;code&gt;clk&lt;/code&gt; needs to be synchonized to your pixel clock and be just as fast or oversample your pixel clock. You can write your own logging, it just needs be formatted as so: &lt;code&gt;current_sim_time time_units: hs vs red green blue&lt;/code&gt; (ex. &lt;code&gt;535 ns: 1 1 010 010 01&lt;/code&gt;). Also see &lt;code&gt;Log File Formatting&lt;/code&gt; below.
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;process&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; (clk)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;file&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; file_pointer: &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;text&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;is&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;out&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;write.txt&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;variable&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; line_el: &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;line&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;begin&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;rising_edge&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(clk) &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;then&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;-- Write the time&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;write&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(line_el, &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;now&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;); &lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;-- write the line.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;write&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(line_el, &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;:&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;); &lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;-- write the line.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;-- Write the hsync&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;write&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(line_el, &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot; &quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;write&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(line_el, hsync); &lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;-- write the line.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;-- Write the vsync&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;write&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(line_el, &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot; &quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;write&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(line_el, vsync); &lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;-- write the line.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;-- Write the red&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;write&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(line_el, &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot; &quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;write&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(line_el, Red); &lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;-- write the line.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;-- Write the green&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;write&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(line_el, &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot; &quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;write&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(line_el, Green); &lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;-- write the line.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;-- Write the blue&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;write&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(line_el, &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot; &quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;write&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(line_el, Blue); &lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;-- write the line.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;-- write the contents into the file.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;writeline&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(file_pointer, line_el);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;end&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;end&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;process&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Run the test bench in &lt;code&gt;Isim&lt;/code&gt; or any other simulator&lt;/li&gt;
&lt;li&gt;Find your log file and browse for it in the &lt;a href=&quot;https://madlittlemods.github.io/vga-simulator&quot;&gt;VGA Simulator&lt;/a&gt; tool. The log file should be in the same folder as the test bench or in the executable folder of your simulation tool.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Optional:&lt;/em&gt; Set the &lt;code&gt;back porch&lt;/code&gt; in the fine tuning section. This will center your image in the canvas so that no clipping occurs. The back porch is the amount of pixel clock cycles after the rising edge of the sync pulses (hsync for back porch x, and vsync for back porch y). &lt;em&gt;&lt;a href=&quot;/images/blog/vga-simulator-getting-started/vga-signal-timing-diagram.jpg&quot;&gt;See this diagram&lt;/a&gt; (&lt;a href=&quot;https://eewiki.net/pages/viewpage.action?pageId=15925278&quot;&gt;source&lt;/a&gt;)&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;Click submit and watch the frames generate&lt;/li&gt;
&lt;li&gt;You can also review any frames generated by the process by clicking the thumbnails.&lt;/li&gt;
&lt;li&gt;To save a frame, just make the frame the main monitor window and then click the &lt;code&gt;Download current frame&lt;/code&gt; link just above the monitor.&lt;/li&gt;
&lt;/ol&gt;
&lt;h1 id=&quot;log-file-formatting--syntax&quot;&gt;Log File Formatting / Syntax&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;Must be a &lt;code&gt;.txt&lt;/code&gt; file&lt;/li&gt;
&lt;li&gt;Text file lines must be formatted as so &lt;code&gt;current_sim_time time_units: hs vs red green blue&lt;/code&gt; (ex. &lt;code&gt;535 ns: 1 1 010 010 01&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Everything should be binary except sim time&lt;/li&gt;
&lt;li&gt;Pad red, green, and blue with &lt;code&gt;0&lt;/code&gt; (zeroes) to the max color depth&lt;/li&gt;
&lt;li&gt;Log a line every rising edge of a clock that is synchronized with your pixel clock and is just as fast or oversamples.&lt;/li&gt;
&lt;li&gt;Make sure you set your clock period correctly in your testbench!&lt;/li&gt;
&lt;/ul&gt;</content:encoded></item><item><title>Animated Sine Wave two-ways with pygame and tkinter</title><link>https://ericeastwood.com/blog/animated-sine-wave-two-ways-with-pygame-and-tkinter/</link><guid isPermaLink="true">https://ericeastwood.com/blog/animated-sine-wave-two-ways-with-pygame-and-tkinter/</guid><description>I decided to post up this simple script that generates an animated sine wave that scrolls horizontally. I built both versions because I need to use a canvas and some bare-bone pixel manipulation for a future project and want to find the best solution.
Update (2013-12-11): I decided to use JavaScript and the HTML5 &amp;#x3C;canvas&gt; for the project I ended up making. Go check out the VGA Simulator
The first one is made with pygame, which runs smooth and is straight forward efficient. The second version made with tkinter is slow and laggy. I even had to batch edit pixels which does not help much. Both of them function exactly the same but the tkinter version is just not as fast.
Version made</description><pubDate>Sun, 01 Dec 2013 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;I decided to post up this simple script that generates an animated sine wave that scrolls horizontally. I built both versions because I need to use a canvas and some bare-bone pixel manipulation for a future project and want to find the best solution.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update (2013-12-11):&lt;/strong&gt; I decided to use JavaScript and the HTML5 &lt;code&gt;&amp;#x3C;canvas&gt;&lt;/code&gt; for the project I ended up making. Go check out the &lt;a href=&quot;https://madlittlemods.github.io/vga-simulator&quot;&gt;VGA Simulator&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The first one is made with &lt;a href=&quot;https://pygame.org/&quot;&gt;pygame&lt;/a&gt;, which runs smooth and is straight forward efficient. The second version made with &lt;a href=&quot;https://wiki.python.org/moin/TkInter&quot;&gt;tkinter&lt;/a&gt; is slow and laggy. I even had to batch edit pixels which does not help much. Both of them function exactly the same but the tkinter version is just not as fast.&lt;/p&gt;
&lt;h1 id=&quot;version-made-with-pygame&quot;&gt;Version made with &lt;a href=&quot;https://pygame.org/&quot;&gt;pygame&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;All you need is Python 2.7 and &lt;a href=&quot;https://pygame.org/&quot;&gt;pygame&lt;/a&gt; installed. If you are on Windows, you might consider getting a &lt;a href=&quot;https://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame&quot;&gt;nice binary from here&lt;/a&gt;. This is also a great project to get started with &lt;a href=&quot;https://pygame.org/&quot;&gt;pygame&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/animated-sine-wave-two-ways-with-pygame-and-tkinter/sine-wave-pygame.png&quot; alt=&quot;Sine wave script running with pygame&quot;&gt;&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; pygame&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; time&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; math&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;# Some config width height settings&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;canvas_width &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;640&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;canvas_height &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;480&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;# Just define some colors we can use&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;color &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; pygame.Color(&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;255&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;255&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;background_color &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; pygame.Color(&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;pygame.init()&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;# Set the window title&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;pygame.display.set_caption(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;Sine Wave&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;# Make a screen to see&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;screen &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; pygame.display.set_mode((canvas_width, canvas_height))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;screen.fill(background_color)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;# Make a surface to draw on&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;surface &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; pygame.Surface((canvas_width, canvas_height))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;surface.fill(background_color)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;# Simple main loop&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;running &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;True&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;while&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; running:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; event &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;in&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; pygame.event.get():&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; event.type &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; pygame.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;QUIT&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;			running &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;False&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;# Redraw the background&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	surface.fill(background_color)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;# Update sine wave&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	frequency &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;4&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	amplitude &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;50&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;# in px&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	speed &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; x &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;in&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;range&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;, canvas_width):&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		y &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;((canvas_height&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;) &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; amplitude&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;math.sin(frequency&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;((&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(x)&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;canvas_width)&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;math.pi) &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; (speed&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;time.time()))))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		surface.set_at((x, y), color)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;# Put the surface we draw on, onto the screen&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	screen.blit(surface, (&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;# Show it.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	pygame.display.flip()&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;hr&gt;
&lt;h1 id=&quot;version-made-with-tkinter&quot;&gt;Version made with &lt;a href=&quot;https://wiki.python.org/moin/TkInter&quot;&gt;tkinter&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;&lt;img src=&quot;/images/blog/animated-sine-wave-two-ways-with-pygame-and-tkinter/sine-wave-tkinter.png&quot; alt=&quot;Sine wave script running with tkinter&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;NOTE:&lt;/strong&gt; For python 3.x: change the import statement at the top to &lt;code&gt;from tkinter import ...&lt;/code&gt; (&quot;...&quot; is the rest of that line) - The package changes to lowercase &lt;code&gt;T&lt;/code&gt; in 3.x. The uppercase Tkinter package is for python 2.x&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;from&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; Tkinter &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; Tk, Canvas, PhotoImage, mainloop&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; math&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; time&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;# Used to store debug file&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;#import os&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;#BASE_DIR = os.path.realpath(os.path.dirname(__file__))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;# Some config width height settings&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;canvas_width &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;640&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;canvas_height &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;480&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;# Create a window&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;window &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; Tk()&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;# Set the window title&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;window.wm_title(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;Sine Wave&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;# Put a canvas on the window&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;canvas &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; Canvas(window, &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;width&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;canvas_width, &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;height&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;canvas_height, &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;bg&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;#000000&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;canvas.pack()&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;# Create a image, this acts as the canvas&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;img &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; PhotoImage(&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;width&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;canvas_width, &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;height&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;canvas_height)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;# Put the image on the canvas&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;canvas.create_image((canvas_width&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;, canvas_height&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;), &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;image&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;img, &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;state&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;normal&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;def&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;sine_wave_anim&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;()&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;# Update sine wave&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	frequency &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;4&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	amplitude &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;50&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;# in px&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	speed &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;# We create a blank area for what where we are going to draw&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	color_table &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; [[&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;#000000&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; x &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;in&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;range&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;, canvas_width)] &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; y &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;in&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;range&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;, amplitude&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;)]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;# And draw on that area&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; x &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;in&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;range&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;, canvas_width):&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		y &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(amplitude &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; amplitude&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;math.sin(frequency&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;((&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(x)&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;canvas_width)&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;math.pi) &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; (speed&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;time.time()))))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		color_table[y][x] &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;#ffff00&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;# Don&apos;t individually put pixels as tkinter sucks at this&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;		&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;#img.put(&quot;#ffff00&quot;, (x, y))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;# Then batch put it on the canvas&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;# tkinter is extremely inefficient doing it one by one&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	img.put(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;&apos;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.join(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;{&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; (&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot; &quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.join(&lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;str&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(color) &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; color &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;in&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; row)) &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;} &quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; row &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;in&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; color_table), (&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(canvas_height&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; amplitude)))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;# Debug the color_table&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;#with open(os.path.join(BASE_DIR, &apos;output.txt&apos;), &quot;w+&quot;) as text_file:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;#	text_file.write(&apos;&apos;.join(&quot;{&quot; + (&quot; &quot;.join(str(color) for color in row)) + &quot;} &quot; for row in color_table))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;# Continue the animation as fast as possible. A value of 0 (milliseconds), blocks everything.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	window.after(&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;, sine_wave_anim)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;# Start off the anim&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;sine_wave_anim()&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;mainloop()&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content:encoded></item><item><title>CCLK to JTAG Clock: Bit File Programming Error Fix</title><link>https://ericeastwood.com/blog/cclk-to-jtag-clock-bit-file-programming-error-fix/</link><guid isPermaLink="true">https://ericeastwood.com/blog/cclk-to-jtag-clock-bit-file-programming-error-fix/</guid><description>If you are running into the following error (Adept, or other programmer), here is how to fix it in Xilinx.
I came across this issue when using my Basys 2 and trying to load a bit file with Digilent&apos;s Adept programmer. It is only a compatibility issue with the bit file and FPGA board.

Startup clock for this file is&apos;CCLK&apos; instead of &apos;JTAG CLK&apos;. Problems will likely occur.
Associate config file with device anyway?


In the Processes pane, select Generate Programming File

Then go to Process -&gt; Process Properties -&gt; Startup Options -&gt; FPGA Start-Up Clock and change it to JTAG CLK.
 
Click, OK. Then re-generate the programming file and program your board.
</description><pubDate>Thu, 21 Nov 2013 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;If you are running into the following error (&lt;a href=&quot;https://www.digilentinc.com/Products/Detail.cfm?Prod=ADEPT2&quot;&gt;Adept&lt;/a&gt;, or other programmer), here is how to fix it in Xilinx.&lt;/p&gt;
&lt;p&gt;I came across this issue when using my &lt;a href=&quot;https://www.digilentinc.com/Products/Detail.cfm?Prod=BASYS2&quot;&gt;Basys 2&lt;/a&gt; and trying to load a bit file with Digilent&apos;s Adept programmer. It is only a compatibility issue with the bit file and FPGA board.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Startup clock for this file is&apos;CCLK&apos; instead of &apos;JTAG CLK&apos;. Problems will likely occur.&lt;br&gt;
Associate config file with device anyway?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;ol&gt;
&lt;li&gt;In the &lt;code&gt;Processes&lt;/code&gt; pane, select &lt;code&gt;Generate Programming File&lt;/code&gt;&lt;br&gt;
&lt;img src=&quot;/images/blog/cclk-to-jtag-clock-bit-file-programming-error-fix/xilinx-processes-pane.png&quot; alt=&quot;Xilinx Processes pane&quot;&gt;&lt;/li&gt;
&lt;li&gt;Then go to &lt;strong&gt;Process&lt;/strong&gt; -&gt; &lt;strong&gt;Process Properties&lt;/strong&gt; -&gt; &lt;strong&gt;Startup Options&lt;/strong&gt; -&gt; &lt;strong&gt;FPGA Start-Up Clock&lt;/strong&gt; and change it to &lt;code&gt;JTAG CLK&lt;/code&gt;.&lt;br&gt;
&lt;img src=&quot;/images/blog/cclk-to-jtag-clock-bit-file-programming-error-fix/xilinx-process-context-menu.png&quot; alt=&quot;Xilinx Process context menu highlighting &amp;#x27;Process Properties...&amp;#x27;&quot;&gt; &lt;img src=&quot;/images/blog/cclk-to-jtag-clock-bit-file-programming-error-fix/xilinx-process-properties.png&quot; alt=&quot;Xilinx process properties window with &amp;#x27;JTAG Clock&amp;#x27; selected&quot;&gt;&lt;/li&gt;
&lt;li&gt;Click, &lt;strong&gt;OK&lt;/strong&gt;. Then re-generate the programming file and program your board.&lt;/li&gt;
&lt;/ol&gt;</content:encoded></item><item><title>Coherent UI Getting Started</title><link>https://ericeastwood.com/blog/coherent-ui-getting-started/</link><guid isPermaLink="true">https://ericeastwood.com/blog/coherent-ui-getting-started/</guid><description>Coherent UI developed by Coherent Labs is a fully featured GUI system for any Unity (or .NET) game that utilizes the power of HTML, CSS, and Javascript. Use any bleeding edge HTML5, CSS3 features that run on WebKit and any JavaScript libraries you need. It is literally as easy as making a web page on Chrome. It also utilizes the WebKit debugger (just like Chrome) so it is easy find the root cause of any problem.
The video explains the whole process but this blog post contains some nice references (see video description for timestamps).

          
            Play video
   </description><pubDate>Mon, 18 Nov 2013 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;&lt;a href=&quot;https://coherent-labs.com/&quot;&gt;Coherent UI&lt;/a&gt; developed by &lt;a href=&quot;https://coherent-labs.com/&quot;&gt;Coherent Labs&lt;/a&gt; is a fully featured GUI system for any Unity (or .NET) game that utilizes the power of HTML, CSS, and Javascript. Use any bleeding edge HTML5, CSS3 features that run on WebKit and any JavaScript libraries you need. It is literally as easy as making a web page on Chrome. It also utilizes the WebKit debugger (just like Chrome) so it is easy find the root cause of any problem.&lt;/p&gt;
&lt;p&gt;The video explains the whole process but this blog post contains some nice references (see video description for timestamps).&lt;/p&gt;
&lt;p&gt;&lt;lite-youtube videoid=&quot;BM-lGSY5Y4I&quot; style=&quot;background-image: url(&amp;#x27;https://i.ytimg.com/vi/BM-lGSY5Y4I/hqdefault.jpg&amp;#x27;);&quot;&gt;
          &lt;a href=&quot;https://youtube.com/watch?v=BM-lGSY5Y4I&quot; class=&quot;lty-playbtn no-collision-link&quot;&gt;
            &lt;span class=&quot;lyt-visually-hidden&quot;&gt;Play video&lt;/span&gt;
          &lt;/a&gt;
        &lt;/lite-youtube&gt;&lt;/p&gt;
&lt;h2 id=&quot;notes&quot;&gt;Notes:&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Only works with Unity Pro
&lt;ul&gt;
&lt;li&gt;This is because Coherent UI is a &lt;code&gt;Plugin&lt;/code&gt; which means it is written in native code (C, C++, Objective-C, etc). &lt;code&gt;Plugin&lt;/code&gt;s are only supported by Unity Pro. &lt;a href=&quot;https://docs.unity3d.com/Documentation/Manual/Plugins.html&quot;&gt;See this documentation&lt;/a&gt;. Also note that &lt;code&gt;Plugin&lt;/code&gt;s do not work in the web player.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;There is a evaluation/developer version that they can send you. Same but has a watermark&lt;/li&gt;
&lt;/ul&gt;
&lt;h1 id=&quot;setting-it-up&quot;&gt;Setting it up:&lt;/h1&gt;
&lt;!-- prettier-ignore --&gt;
&lt;ol&gt;
&lt;li&gt;Import the Coherent Package by going to &lt;strong&gt;Assets&lt;/strong&gt; -&gt; &lt;strong&gt;Import Package&lt;/strong&gt; -&gt; &lt;strong&gt;Custom Package&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Install Coherent by going to &lt;strong&gt;Assets&lt;/strong&gt; -&gt; &lt;strong&gt;Coherent UI&lt;/strong&gt; -&gt; &lt;strong&gt;Install Coherent UI&lt;/strong&gt; (not necessary in newer versions)&lt;/li&gt;
&lt;li&gt;Set the folder where all your UI files will reside: &lt;strong&gt;Edit&lt;/strong&gt; -&gt; &lt;strong&gt;Project Settings&lt;/strong&gt; -&gt; &lt;strong&gt;Cohere UI&lt;/strong&gt; -&gt; &lt;strong&gt;Select UI Folder&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Drag a &lt;code&gt;CoherentUIView&lt;/code&gt; Script onto your Camera (&lt;strong&gt;Standard Assets&lt;/strong&gt; -&gt; &lt;strong&gt;Scripts&lt;/strong&gt; -&gt; &lt;strong&gt;CoherentUI&lt;/strong&gt; -&gt; &lt;strong&gt;CoherentUIView&lt;/strong&gt;)&lt;/li&gt;
&lt;li&gt;On the &lt;code&gt;CoherentUIView&lt;/code&gt;, enable &lt;code&gt;Is Transparent&lt;/code&gt; so that we can see the game.&lt;/li&gt;
&lt;li&gt;Also enable &lt;code&gt;Enable Binding Attribute&lt;/code&gt; so we can talk between JavaScript and Unity. In Coherent 1.6+, this is now called &lt;code&gt;Enable [CoherentMethodAttribute]&lt;/code&gt; under the &lt;code&gt;Scripting&lt;/code&gt; section on the &lt;code&gt;CoherentUIView&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;To clarify, use Automatic binding (this is if you are looking at the docs)&lt;/li&gt;
&lt;li&gt;In newer versions of Coherent (at least 1.6 and up) you need to add &lt;code&gt;couiView.ReceivesInput = true;&lt;/code&gt; in code to have input forwarded on desktop.&lt;/li&gt;
&lt;li&gt;Make a C# Hud script and also drag it onto the camera. You can use the code below as your base:
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #C18401&quot;&gt;UnityEngine&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #C18401&quot;&gt;System&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #C18401&quot;&gt;Collections&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #C18401&quot;&gt;Coherent&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #C18401&quot;&gt;UI&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #C18401&quot;&gt;Binding&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #C18401&quot;&gt;HUD&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; : &lt;/span&gt;&lt;span style=&quot;color: #C18401&quot;&gt;MonoBehaviour&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;private&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #C18401&quot;&gt;CoherentUIView&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;m_View&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;Start&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; () {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;m_View&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;GetComponent&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;color: #C18401&quot;&gt;CoherentUIView&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;&gt;();&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h1 id=&quot;calling-a-gui-javascript-function-with-unity-c&quot;&gt;Calling a (GUI) JavaScript function with (Unity) C#:&lt;/h1&gt;
&lt;p&gt;In Unity (C#):&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;m_View&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;View&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;TriggerEvent&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;jsEventExample&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;arg1&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;arg2&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;arg3&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Part of your GUI JavaScript (JS):&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;BoundFunctionInJavaScript&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;()&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;console&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;log&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;arguments&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;arguments&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #0184BC&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;arguments&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;]);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;$&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(document).&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;ready&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;()&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Bind event “jsEventExample” to a js function&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;engine&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;on&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;jsEventExample&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;BoundFunctionInJavaScript,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;});&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;h1 id=&quot;calling-a-unity-c-function-in-gui-javascript&quot;&gt;Calling a (Unity) C# function in (GUI) JavaScript:&lt;/h1&gt;
&lt;p&gt;In Unity (C#):&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #C18401&quot;&gt;Coherent&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #C18401&quot;&gt;UI&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #C18401&quot;&gt;CoherentMethod&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;FunctionInUnity&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;)]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;FunctionInUnity&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; arg1, &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; arg2, &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;float&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; arg3)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Returns sum of arguments supplied&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;arg1&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;arg2&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;arg3&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Part of your GUI JavaScript (JS):&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Calls a function in Unity called “functionInUnity” with 3 arguments&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;// Get return data via arguments[0]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #E45649&quot;&gt;engine&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;call&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;FunctionInUnity&apos;&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;arg1,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;arg2,&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;arg3).&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;then&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;()&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;console&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: #4078F2&quot;&gt;log&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;arguments&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;]);&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;});&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content:encoded></item><item><title>Apache Guide (Basic)</title><link>https://ericeastwood.com/blog/apache-guide-basic/</link><guid isPermaLink="true">https://ericeastwood.com/blog/apache-guide-basic/</guid><description>Basic &amp;#x3C;Directory&gt; tag explanation
Here is a sample script allowing all users:
&amp;#x3C;Directory &quot;/var/www/static/&quot;&gt;
	Options -Indexes
	Order deny,allow
	Allow from all
	AllowOverride All
	Require all granted
&amp;#x3C;/Directory&gt;

Options -Indexes: Removes the ability to view all files in directory if index html or php are not present
Order deny,allow: Applies the deny operations before the allow operations
AllowOverride All: Allows .htaccess to override settings in httpd.conf, etc
Require all granted: some mod_authz_core thing. Not completely sure.

Create password protected Directory or Location:
# PW protect URL
&amp;#x3C;Location &quot;/secret-stuff&quot;&gt;
	AuthType Basic
	AuthName &quot;Private Directory&quot;
	AuthUserFile /etc/httpd/.htpasswd
	Require valid-user
&amp;#x3C;/Location&gt;

# PW protect directory
&amp;#x3C;Directory &quot;/path/to/directory&quot;&gt;
	# ... Look above
&amp;#x3C;/Directory&gt;

AuthType Basic: Set the Basic authentication method
AuthName &quot;Private Directory&quot;: Provide a name for the location. This shows up on the login modal/popup (optional)
AuthUserFile /etc/httpd/.htpasswd: Specify the pathname to the file that contains usernames and passwords. The usual</description><pubDate>Fri, 15 Nov 2013 00:00:00 GMT</pubDate><content:encoded>&lt;h2 id=&quot;basic-directory-tag-explanation&quot;&gt;Basic &lt;code&gt;&amp;#x3C;Directory&gt;&lt;/code&gt; tag explanation&lt;/h2&gt;
&lt;p&gt;Here is a sample script allowing all users:&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;&amp;#x3C;Directory &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;/var/www/static/&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;Options&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; -Indexes&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;Order&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; deny,allow&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;Allow&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; from all&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;AllowOverride&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; All&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;Require&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; all granted&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;&amp;#x3C;/Directory&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Options -Indexes&lt;/code&gt;: Removes the ability to view all files in directory if &lt;code&gt;index&lt;/code&gt; html or php are not present&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Order deny,allow&lt;/code&gt;: Applies the &lt;code&gt;deny&lt;/code&gt; operations before the &lt;code&gt;allow&lt;/code&gt; operations&lt;/li&gt;
&lt;li&gt;&lt;code&gt;AllowOverride All&lt;/code&gt;: Allows .htaccess to override settings in httpd.conf, etc&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Require all granted&lt;/code&gt;: some &lt;code&gt;mod_authz_core&lt;/code&gt; thing. Not completely sure.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;create-password-protected-directory-or-location&quot;&gt;Create password protected Directory or Location:&lt;/h2&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;# PW protect URL&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;&amp;#x3C;Location &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;/secret-stuff&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;AuthType&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; Basic&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;AuthName&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &quot;Private Directory&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;AuthUserFile&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; /etc/httpd/.htpasswd&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;	&lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;Require&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; valid-user&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;&amp;#x3C;/Location&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;# PW protect directory&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;&amp;#x3C;Directory &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;/path/to/directory&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #8D8E96; font-style: italic&quot;&gt;	# ... Look above&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;&amp;#x3C;/Directory&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;AuthType Basic&lt;/code&gt;: Set the Basic authentication method&lt;/li&gt;
&lt;li&gt;&lt;code&gt;AuthName &quot;Private Directory&quot;&lt;/code&gt;: Provide a name for the location. This shows up on the login modal/popup (optional)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;AuthUserFile /etc/httpd/.htpasswd&lt;/code&gt;: Specify the pathname to the file that contains usernames and passwords. The usual filename to use is .htpasswd&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Require valid-user&lt;/code&gt;: Specify that only users that exist in the file are allowed access&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;via &lt;a href=&quot;http://doc.norang.ca/apache-basic-auth.html&quot;&gt;this documentation&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&quot;create-htpasswd-file&quot;&gt;Create &lt;code&gt;.htpasswd&lt;/code&gt; file:&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;Run &lt;code&gt;htpasswd /etc/httpd/.htpasswd newuser&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Type the password and re-type&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&quot;change-password-of-existing-user&quot;&gt;Change password of existing user&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;Run &lt;code&gt;htpasswd -p /etc/httpd/.htpasswd newuser&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Type your new password and re-type&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;via &lt;a href=&quot;http://httpd.apache.org/docs/2.2/programs/htpasswd.html&quot;&gt;this documentation&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&quot;find-apache-user-or-group&quot;&gt;Find Apache User or Group:&lt;/h2&gt;
&lt;p&gt;This is the user with permissions on your machine that apache uses to carry out its functions. If you are getting permission denied in the &lt;code&gt;error.log&lt;/code&gt; you probably need to add this group to the directory/file.&lt;/p&gt;
&lt;p&gt;For Ubuntu the default user and group is &lt;code&gt;www-data&lt;/code&gt;. You can find it in &lt;code&gt;/etc/apache2/apache2.conf&lt;/code&gt; which will look like:&lt;/p&gt;
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;User ${APACHE_RUN_USER}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;Group ${APACHE_RUN_GROUP}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;${APACHE_RUN_USER}&lt;/code&gt; is a reference to environment variables set in &lt;code&gt;/etc/apache2/envvars&lt;/code&gt; so just go look in there for &lt;code&gt;APACHE_RUN_USER&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;via Lars Noodén on &lt;a href=&quot;http://ubuntuforums.org/showthread.php?t=1293508&quot;&gt;this thread&lt;/a&gt;&lt;/p&gt;
&lt;h2 id=&quot;basic-apache-commands&quot;&gt;Basic Apache commands:&lt;/h2&gt;













&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Command&lt;/th&gt;&lt;th&gt;Description&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;sudo /etc/init.d/apache2 reload&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Restart the apache server&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;</content:encoded></item><item><title>Django setup for WAMP</title><link>https://ericeastwood.com/blog/django-setup-for-wamp/</link><guid isPermaLink="true">https://ericeastwood.com/blog/django-setup-for-wamp/</guid><description>This is a basic guide to get Django running with WAMP. This tutorial was written with Python 2.7.5 and Django 1.5 in mind but applies for all versions.
You can use the Windows command prompt (cmd) whenever it says to run a command. I suggest using this command prompt alternative.
Basic Setup:
&lt;!-- prettier-ignore --&gt;

Install WAMP
Get mod_wsgi module for apache. I suggest getting it from here. Add mod_wsgi.sotoC:\wamp-2-4.64bit\bin\apache\Apache2.4.4\modules
Add the line in httpd.conf: LoadModule wsgi_module modules/mod_wsgi-ap24-py27.so
Install Python 2.7.5 because Python 3.3 does not have enough supported packages
Install virtualenv (python package) using this command: pip install virtualenv
Create a folder called www-src alongside your wamp www folder and navigate to it in cmd using this command: cd C:\wamp-2-4.64bit\www-src
Create a new environment called venv using this command:</description><pubDate>Thu, 14 Nov 2013 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;This is a basic guide to get Django running with WAMP. This tutorial was written with Python 2.7.5 and Django 1.5 in mind but applies for all versions.&lt;/p&gt;
&lt;p&gt;You can use the Windows command prompt (cmd) whenever it says to run a command. I suggest using &lt;a href=&quot;http://sourceforge.net/projects/console/&quot;&gt;this command prompt alternative&lt;/a&gt;.&lt;/p&gt;
&lt;h1 id=&quot;basic-setup&quot;&gt;Basic Setup:&lt;/h1&gt;
&lt;!-- prettier-ignore --&gt;
&lt;ol&gt;
&lt;li&gt;Install &lt;a href=&quot;http://www.wampserver.com/en/&quot;&gt;WAMP&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Get &lt;code&gt;mod_wsgi&lt;/code&gt; module for apache. I suggest getting &lt;a href=&quot;http://www.lfd.uci.edu/~gohlke/pythonlibs/#mod_wsgi&quot;&gt;it from here&lt;/a&gt;. Add &lt;code&gt;mod_wsgi.so&lt;/code&gt;to&lt;code&gt;C:\wamp-2-4.64bit\bin\apache\Apache2.4.4\modules&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Add the line in &lt;code&gt;httpd.conf&lt;/code&gt;: &lt;code&gt;LoadModule wsgi_module modules/mod_wsgi-ap24-py27.so&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Install &lt;a href=&quot;http://www.python.org/download/&quot;&gt;Python 2.7.5&lt;/a&gt; because Python 3.3 does not have enough supported packages&lt;/li&gt;
&lt;li&gt;Install &lt;a href=&quot;https://pypi.python.org/pypi/virtualenv&quot;&gt;virtualenv (python package)&lt;/a&gt; using this command: &lt;code&gt;pip install virtualenv&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Create a folder called &lt;code&gt;www-src&lt;/code&gt; alongside your wamp &lt;code&gt;www&lt;/code&gt; folder and navigate to it in cmd using this command: &lt;code&gt;cd C:\wamp-2-4.64bit\www-src&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Create a new environment called &lt;code&gt;venv&lt;/code&gt; using this command: &lt;code&gt;virtualenv venv&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Navigate to &lt;code&gt;C:\wamp-2-4.64bit\www-src\venv\Scripts&lt;/code&gt; and run the command &lt;code&gt;activate&lt;/code&gt; to get your virtualenv running. You will notice &lt;code&gt;(venv)&lt;/code&gt; in cmd.&lt;/li&gt;
&lt;li&gt;Install &lt;a href=&quot;https://www.djangoproject.com/&quot;&gt;django&lt;/a&gt; in your virtualenv from the &lt;a href=&quot;https://www.djangoproject.com/download/&quot;&gt;website&lt;/a&gt; or use this command: &lt;code&gt;pip install Django&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Make a new django project using this command: &lt;code&gt;python django-admin.py startproject mysite&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Add the python home to the bottom of apaches&apos;s &lt;code&gt;httpd.conf&lt;/code&gt; and point to your virtualenv: &lt;code&gt;WSGIPythonHome &quot;C:/wamp-2-4.64bit/www-src/venv&quot;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Connect it to WAMP by adding this to apaches&apos;s &lt;code&gt;httpd.conf&lt;/code&gt;:
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;WSGIScriptAlias &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;/django-project&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;C:/wamp-2-4.64bit/www-src/django_project/django_project/wsgi.py&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;WSGIPythonPath &quot;C:/wamp-&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #986801&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;.64bit/www-src/django_project/&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;&amp;#x3C;Directory &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;C:/wamp-2-4.64bit/www-src/django_project/django_project/&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;   &amp;#x3C;Files &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;wsgi.py&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;       &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;Order&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; deny,allow&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;       &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;Require&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; all granted&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;   &amp;#x3C;/Files&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;&amp;#x3C;/Directory&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Put the following code at the top of &lt;code&gt;settings.py&lt;/code&gt;:
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; os&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;BASE_DIR&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; os.path.realpath(os.path.dirname(&lt;/span&gt;&lt;span style=&quot;color: #E45649&quot;&gt;__file__&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;))&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;In your django project &lt;code&gt;settings.py&lt;/code&gt; set up static file stuff:
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;STATIC_ROOT&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;C:/wamp-2-4.64bit/www/static&apos;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;STATIC_URL&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;http://localhost/static/&apos;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;STATICFILES_DIRS&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; (&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt; os.path.join(&lt;/span&gt;&lt;span style=&quot;color: #5E5A53&quot;&gt;BASE_DIR&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&apos;static&apos;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;),&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Serve your static files. Add this to apache&apos;s &lt;code&gt;httpd.conf&lt;/code&gt;:
&lt;pre is:raw=&quot;&quot; class=&quot;astro-code shaizei-light&quot; style=&quot;background-color: invalid-so-we-fallback-to-css; overflow-x: auto;&quot; tabindex=&quot;0&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;Alias&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;/static&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;C:/wamp-2-4.64bit/www/static&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;&amp;#x3C;Directory &lt;/span&gt;&lt;span style=&quot;color: #50A14F&quot;&gt;&quot;C:/wamp-2-4.64bit/www/static&quot;&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;   &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;Order&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; deny,allow&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;   &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;Allow&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; from all&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;   &lt;/span&gt;&lt;span style=&quot;color: #A626A4&quot;&gt;Require&lt;/span&gt;&lt;span style=&quot;color: #896868&quot;&gt; all granted&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;color: #896868&quot;&gt;&amp;#x3C;/Directory&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;hr&gt;
&lt;h1 id=&quot;common-commands&quot;&gt;Common Commands:&lt;/h1&gt;
&lt;p&gt;&lt;code&gt;manage.py&lt;/code&gt; is in the base of your django projects directory&lt;br&gt;
&lt;code&gt;django-admin.py&lt;/code&gt; should be on your system path. &lt;a href=&quot;https://docs.djangoproject.com/en/dev/faq/troubleshooting/#troubleshooting-django-admin-py&quot;&gt;Problems? See this documentation&lt;/a&gt;&lt;/p&gt;





























&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Command&lt;/th&gt;&lt;th&gt;Description&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;python manage.py collectstatic&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Gets all new or edited static files and puts it in the STATIC_ROOT to be served&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;python manage.py syncdb&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Update the db structure to reflect your models&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;python django-admin.py startproject mysite&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Start a django project to host your django apps&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;python manage.py startapp polls&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Start a django app in your django project&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;python manage.py changepassword *username*&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Change the password of the specified user. &lt;em&gt;(Optionally, you can visit: &lt;code&gt;example.com/path-to-admin/password_change/&lt;/code&gt; if you have the admin enabled)&lt;/em&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;h1 id=&quot;best-practices&quot;&gt;Best Practices:&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;Use &lt;a href=&quot;http://www.lfd.uci.edu/~gohlke/pythonlibs/&quot;&gt;these windows binaries&lt;/a&gt; for many python packages provided by Christoph Gohlke&lt;/li&gt;
&lt;/ul&gt;</content:encoded></item><item><title>Welcome to the site!</title><link>https://ericeastwood.com/blog/welcome-to-the-site/</link><guid isPermaLink="true">https://ericeastwood.com/blog/welcome-to-the-site/</guid><description>I am happy to move on from &quot;under construction&quot; to this iteration of the site. The site is built with Python and Django, my new found go-to for making websites. The design and layout was made with much love by me.
This site currently boasts a blog, about page, and contact page. I plan to write about my latest developments, tutorials, and quick guides about the web dev, design, hardware, and more.
Feel free to use the contact page to get in touch with me or the about page to get to know me first.</description><pubDate>Wed, 13 Nov 2013 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;I am happy to move on from &quot;under construction&quot; to this iteration of the site. The site is built with Python and &lt;a href=&quot;https://www.djangoproject.com/&quot;&gt;Django&lt;/a&gt;, my new found go-to for making websites. The design and layout was made with much love by me.&lt;/p&gt;
&lt;p&gt;This site currently boasts a blog, about page, and contact page. I plan to write about my latest developments, tutorials, and quick guides about the web dev, design, hardware, and more.&lt;/p&gt;
&lt;p&gt;Feel free to use the &lt;a href=&quot;/contact/&quot;&gt;contact page&lt;/a&gt; to get in touch with me or the &lt;a href=&quot;/about/&quot;&gt;about page&lt;/a&gt; to get to know me first.&lt;/p&gt;</content:encoded></item></channel></rss>