Update _site static files

master
Tait Hoyem 4 years ago
parent 26293041d9
commit e47368a0ee

@ -37,10 +37,10 @@
<p>While filling in one of my friends surveys I thought it would be
funny for them to know it is me without anyone else knowing.
We were young and had <code class="highlighter-rouge">Inspect Element</code>ed a few things together,
We were young and had <code class="language-plaintext highlighter-rouge">Inspect Element</code>ed a few things together,
so it was a safe bet that an HTML joke would let them know.</p>
<p>I decided to write my name like so: <code class="highlighter-rouge">&lt;b&gt;Steve&lt;/b&gt;</code>.
<p>I decided to write my name like so: <code class="language-plaintext highlighter-rouge">&lt;b&gt;Steve&lt;/b&gt;</code>.
Steve is in reference to the <a href="https://minecraft.gamepedia.com/Player">main character</a> in the video game Minecraft.</p>
<figure>
@ -69,13 +69,13 @@ How did this happen? You might wonder.</p>
<p>Here is a great demonstration why you should do most of your validation on the server side.
As a user, I can edit any of the HTML, CSS, or Javascript your server serves to me.</p>
<p>Quiz your friends uses the <code class="highlighter-rouge">maxlength=20</code> HTML attribute on the name input field.
Imagine trying to fit in a script tag doing anything useful with 20 characters! Dont forget that includes the <code class="highlighter-rouge">&lt;script&gt;</code> tag.
<p>Quiz your friends uses the <code class="language-plaintext highlighter-rouge">maxlength=20</code> HTML attribute on the name input field.
Imagine trying to fit in a script tag doing anything useful with 20 characters! Dont forget that includes the <code class="language-plaintext highlighter-rouge">&lt;script&gt;</code> tag.
That would leave 13 characters for Javascript.
Although Im sure a genius would be able to <a href="https://code.golf/">code golf</a> that, I know I couldnt.</p>
<p>Now obviously I can edit any HTML that a server has sent to me.
If I open up my inspect element window, I can go ahead and change that <code class="highlighter-rouge">maxlength</code> attribute to anything I want.
If I open up my inspect element window, I can go ahead and change that <code class="language-plaintext highlighter-rouge">maxlength</code> attribute to anything I want.
Lets change it to 100!</p>
<figure>
@ -96,9 +96,9 @@ Imagine being able to send entire executable programs as your “name” in one
<p>So I went on my merry way thinking about ways to use malicious javascript.
Then, I thought that might be mean, so I decided to warn users instead.
I filled in the name with a script tag and a call to <code class="highlighter-rouge">alert()</code> to warn the user about this site.</p>
I filled in the name with a script tag and a call to <code class="language-plaintext highlighter-rouge">alert()</code> to warn the user about this site.</p>
<p><code class="highlighter-rouge">JAVASCRIPT_NAME.JPG</code></p>
<p><code class="language-plaintext highlighter-rouge">JAVASCRIPT_NAME.JPG</code></p>
<p>I ran out of room before I could finish it. Hmmm.
What if I do “Inspect Element” and manually override the max-length attribute?</p>
@ -121,13 +121,13 @@ How can this be done?</p>
<p>Here is my quiz below:</p>
<p><code class="highlighter-rouge">CREATING_QUIZ.IMG</code></p>
<p><code class="language-plaintext highlighter-rouge">CREATING_QUIZ.IMG</code></p>
<h4 id="setting-a-name-with-an-html-tag">Setting A Name With an HTML Tag</h4>
<p>Just like the image above, about how I found out about this vulnerability: go ahead and use an HTML tag in your name to test this out.</p>
<p><code class="highlighter-rouge">BOLD_ITALIC_STEVE.JPG</code></p>
<p><code class="language-plaintext highlighter-rouge">BOLD_ITALIC_STEVE.JPG</code></p>
</div>

@ -39,11 +39,11 @@
<p>Now although this image shows all the different types of spacing as equal, the majority of the time these will mostly be padding (inner) and margin (outer). Padding is the inner space between the element and its border; margin is the outer space between two different elements.</p>
<p>Within the margin the user is unable to press any links or execute any javascript code. It is <em>empty</em> space. If each <code class="highlighter-rouge">&lt;link&gt;</code> on your navigation bar has 10 pixels of margin, then there would be 20 pixels in between each <code class="highlighter-rouge">&lt;link&gt;</code> that would <em>not</em> be clickable by the user.</p>
<p>Within the margin the user is unable to press any links or execute any javascript code. It is <em>empty</em> space. If each <code class="language-plaintext highlighter-rouge">&lt;link&gt;</code> on your navigation bar has 10 pixels of margin, then there would be 20 pixels in between each <code class="language-plaintext highlighter-rouge">&lt;link&gt;</code> that would <em>not</em> be clickable by the user.</p>
<p>If you have <code class="highlighter-rouge">&lt;link&gt;</code>s on your navigation bar with <em>padding</em> set to 20 pixels, however, then there will be 20 pixels on each side of the <code class="highlighter-rouge">&lt;link&gt;</code> text where the user <em>is</em> able to click.</p>
<p>If you have <code class="language-plaintext highlighter-rouge">&lt;link&gt;</code>s on your navigation bar with <em>padding</em> set to 20 pixels, however, then there will be 20 pixels on each side of the <code class="language-plaintext highlighter-rouge">&lt;link&gt;</code> text where the user <em>is</em> able to click.</p>
<p>If that part is confusing, try thinking about it in terms of whether <code class="highlighter-rouge">background-color</code> would apply.</p>
<p>If that part is confusing, try thinking about it in terms of whether <code class="language-plaintext highlighter-rouge">background-color</code> would apply.</p>
<table>
<thead>
@ -60,7 +60,7 @@
<td>between elements</td>
</tr>
<tr>
<td><code class="highlighter-rouge">background-color</code> applies</td>
<td><code class="language-plaintext highlighter-rouge">background-color</code> applies</td>
<td>Yes</td>
<td>No</td>
</tr>
@ -69,9 +69,9 @@
<p>In summary:</p>
<ul>
<li><strong>Padding</strong>: the space within a tag which is still part of the same tag. <code class="highlighter-rouge">background-color</code> applies.</li>
<li><strong>Margin</strong>: the space in between two seperate tags. <code class="highlighter-rouge">background-color</code> does not apply; it is empty space.</li>
<li><strong>Border</strong>: the space in between the two; it surrounds the padding, but is not the margin. It looks nice somtimes, but it has no non-visual function. <code class="highlighter-rouge">background-color</code> does not apply.</li>
<li><strong>Padding</strong>: the space within a tag which is still part of the same tag. <code class="language-plaintext highlighter-rouge">background-color</code> applies.</li>
<li><strong>Margin</strong>: the space in between two seperate tags. <code class="language-plaintext highlighter-rouge">background-color</code> does not apply; it is empty space.</li>
<li><strong>Border</strong>: the space in between the two; it surrounds the padding, but is not the margin. It looks nice somtimes, but it has no non-visual function. <code class="language-plaintext highlighter-rouge">background-color</code> does not apply.</li>
</ul>
<p>I hope this covers the basics of margin and padding! Happy coding!</p>

@ -107,9 +107,9 @@ In this case, “Hello!” would become “Ifmmp!”
That is just using a shift of one. You can use a shift of seven, for example, and then you would shift letters like so:</p>
<ul>
<li><code class="highlighter-rouge">A -&gt; +7 -&gt; H</code></li>
<li><code class="highlighter-rouge">Q -&gt; +7 -&gt; X</code></li>
<li><code class="highlighter-rouge">T -&gt; +7 -&gt; A</code></li>
<li><code class="language-plaintext highlighter-rouge">A -&gt; +7 -&gt; H</code></li>
<li><code class="language-plaintext highlighter-rouge">Q -&gt; +7 -&gt; X</code></li>
<li><code class="language-plaintext highlighter-rouge">T -&gt; +7 -&gt; A</code></li>
</ul>
<p>When you reach the end of the alphabet, wrap around to the beginning to find the encrypted letter.</p>

@ -56,7 +56,7 @@ You have been warned.</p>
<h2 id="step-0-setup">Step 0: Setup</h2>
<p>We will be using the utility <code class="highlighter-rouge">gpg</code> for this tutorial.</p>
<p>We will be using the utility <code class="language-plaintext highlighter-rouge">gpg</code> for this tutorial.</p>
<p>The other thing to note: The character $ (dollar sign) is usually not typed when shown in a command.
It simply indicates that you do not need administrative privilages to run these commands.</p>
@ -84,7 +84,7 @@ License GPLv3+: GNU GPL version 3 or later &lt;https://gnu.org/licenses/gpl.html
<p>To encrypt a document with somebodys public key, you need to first obtain it.
My public key is available <a href="/public-key.asc">at this link</a>, and you can use it to send me encrypted stuff.</p>
<p>If you are on a linux terminal, you can use the <code class="highlighter-rouge">curl</code> or <code class="highlighter-rouge">wget</code> command to download it.</p>
<p>If you are on a linux terminal, you can use the <code class="language-plaintext highlighter-rouge">curl</code> or <code class="language-plaintext highlighter-rouge">wget</code> command to download it.</p>
<p>wget:</p>
<pre class="terminal">
@ -130,7 +130,7 @@ Please select what kind of key you want:
Your selection?
</pre>
<p>Select the option <code class="highlighter-rouge">1</code>. You want two keys, both RSA.</p>
<p>Select the option <code class="language-plaintext highlighter-rouge">1</code>. You want two keys, both RSA.</p>
<p>Next we will select the key size:</p>
<pre class="terminal">
@ -164,9 +164,9 @@ Key expires at Tue Apr 7 02:24:23 2020 UTC
Is this correct? (y/N)
</pre>
<p>Type <code class="highlighter-rouge">y</code> to confirm your choice.</p>
<p>Type <code class="language-plaintext highlighter-rouge">y</code> to confirm your choice.</p>
<p>Now <code class="highlighter-rouge">gpg</code> is going to ask you to create a user id to indetify this key.
<p>Now <code class="language-plaintext highlighter-rouge">gpg</code> is going to ask you to create a user id to indetify this key.
Use some test data for now.
User input is in bold, feel free to follow along or to put your own test data in.</p>
@ -190,7 +190,7 @@ If you are simply using this for test purposes,
then you can feel free to set it to something like “test”.
When create a long-term use pulbic key make sure to make the password <em>very</em> secure.</p>
<p>During the process of creating your key, <code class="highlighter-rouge">gpg</code> may warn you with this message:</p>
<p>During the process of creating your key, <code class="language-plaintext highlighter-rouge">gpg</code> may warn you with this message:</p>
<pre class="terminal">
We need to generate a lot of random bytes. It is a good idea to perform
@ -236,8 +236,8 @@ $ gpg --export --armour "&lt;test@test.org&gt;" &gt; public-key.asc
<h2 id="step-2-import-public-key">Step 2: Import Public Key</h2>
<p>This list of keys that <code class="highlighter-rouge">gpg</code> keeps on tap so to speak, is called our “keyring”.
Your will need to import a new public key to encrypt files with <code class="highlighter-rouge">gpg</code>.</p>
<p>This list of keys that <code class="language-plaintext highlighter-rouge">gpg</code> keeps on tap so to speak, is called our “keyring”.
Your will need to import a new public key to encrypt files with <code class="language-plaintext highlighter-rouge">gpg</code>.</p>
<p>If you already created your own public key, then this step is not necessary unless you want to also encrypt something for me :)</p>
@ -248,7 +248,7 @@ Your will need to import a new public key to encrypt files with <code class="hig
</figcaption>
</figure>
<p>To import a public key to use for encrypting files, use the <code class="highlighter-rouge">--import</code> option of <code class="highlighter-rouge">gpg</code>. Like so:</p>
<p>To import a public key to use for encrypting files, use the <code class="language-plaintext highlighter-rouge">--import</code> option of <code class="language-plaintext highlighter-rouge">gpg</code>. Like so:</p>
<pre class="terminal">
$ gpg --import public-key.asc
@ -262,7 +262,7 @@ gpg: imported: 1
<h2 id="step-3-have-a-message-to-encrypt">Step 3: Have A Message To Encrypt</h2>
<p>You can make a new file which holds some important, secret data.
Feel free to use a graphical editor if you have one, if not, <code class="highlighter-rouge">nano</code> works alright too.</p>
Feel free to use a graphical editor if you have one, if not, <code class="language-plaintext highlighter-rouge">nano</code> works alright too.</p>
<pre class="terminal">
Rules Of A Good Life:
@ -273,21 +273,21 @@ Feel free to use a graphical editor if you have one, if not, <code class="highli
5. Have good friends!
</pre>
<p>Save this file as something like <code class="highlighter-rouge">test-pgp.txt</code>, and well use that name later.</p>
<p>Save this file as something like <code class="language-plaintext highlighter-rouge">test-pgp.txt</code>, and well use that name later.</p>
<h2 id="step-4-encrypt-a-message">Step 4: Encrypt A Message</h2>
<p>Now that we have a message to send and person to send to,
all we have to do is encrypt this message and itll be on its merry way!
To do so, we must specify two new options to <code class="highlighter-rouge">gpg</code>.</p>
To do so, we must specify two new options to <code class="language-plaintext highlighter-rouge">gpg</code>.</p>
<p>The first is <code class="highlighter-rouge">--recipient</code>.
This tells <code class="highlighter-rouge">gpg</code> to encrypt using a certin public key that we have in our keyring.
<p>The first is <code class="language-plaintext highlighter-rouge">--recipient</code>.
This tells <code class="language-plaintext highlighter-rouge">gpg</code> to encrypt using a certin public key that we have in our keyring.
You can use the persons name, email address, or the keys uid.</p>
<p>The second is <code class="highlighter-rouge">--encrypt</code>.</p>
<p>The second is <code class="language-plaintext highlighter-rouge">--encrypt</code>.</p>
<p>You will also specify the <code class="highlighter-rouge">--armour</code> option to use ASCII armoured files. Put this option after <code class="highlighter-rouge">--encrypt</code>, and put the file name after <code class="highlighter-rouge">--armour</code>. See below.</p>
<p>You will also specify the <code class="language-plaintext highlighter-rouge">--armour</code> option to use ASCII armoured files. Put this option after <code class="language-plaintext highlighter-rouge">--encrypt</code>, and put the file name after <code class="language-plaintext highlighter-rouge">--armour</code>. See below.</p>
<p>You can either use your own public key name to encrypt a document (allowng only you to decrypt it),
or you can use my public key that we imported earlier (allowing only me to decrypt it).
@ -329,10 +329,10 @@ nv117moLfK22Mst/
<h2 id="step-5-decryption-optional">Step 5: Decryption (optional)</h2>
<p>If you created your own public/private keypair in step 1,
and you encryped using <code class="highlighter-rouge">--recipient "Your Test Name"</code>,
and you encryped using <code class="language-plaintext highlighter-rouge">--recipient "Your Test Name"</code>,
then you can decrypt your document as well!</p>
<p>You will need to specify <code class="highlighter-rouge">--decrypt</code>, and thats all folks!</p>
<p>You will need to specify <code class="language-plaintext highlighter-rouge">--decrypt</code>, and thats all folks!</p>
<pre class="terminal">
$ gpg --decrypt test-gpg.txt.asc

@ -69,7 +69,7 @@ this system can withstand the failure of <em>two</em> drives.</p>
<ol>
<li>Celery Stick. An old grey HP laptop with a Braille stickered keyboard. <em>Does not work right now; bad thermal paste job.</em></li>
<li>A Dell laptop lent to me by my school during my studies.</li>
<li>Houston. A 21-inch 2011 iMac for which the screen does not work under Linux (excep with the <code class="highlighter-rouge">nomodeset</code> kernel option enabled).</li>
<li>Houston. A 21-inch 2011 iMac for which the screen does not work under Linux (excep with the <code class="language-plaintext highlighter-rouge">nomodeset</code> kernel option enabled).</li>
<li>An Old Toshiba laptop (circa 2010) that I got for $50 to test with OpenBSD (works….sometimes).</li>
<li>Main Rig. My main laptop is an ASUS-705 TUF gaming laptop.</li>
</ol>

@ -51,7 +51,7 @@ by linking to Javascript code stored on another server.</p>
<p>I have a file on my website called <a href="/assets/js/hacked.js">hacked.js</a>.
If I was able to run this javascript file on anybody visiting a certain website <em>that is not mine</em>, this would be called cross-site scripting.</p>
<p>Click the above <code class="highlighter-rouge">hacked.js</code> link to view the code I use to “hack” this website.
<p>Click the above <code class="language-plaintext highlighter-rouge">hacked.js</code> link to view the code I use to “hack” this website.
Its safe, I promise ;)</p>
<p>Now, how can we get this code to execute when a user visits this site?
@ -62,11 +62,11 @@ To explain, I will start with some of the underlying technologies.</p>
<p>No, this is not a Sherlock Holmes novel!</p>
<p>If we suppose that a website is built with sequences like these (called “tags”):
<code class="highlighter-rouge">&lt;body&gt;</code>, <code class="highlighter-rouge">&lt;p&gt;</code> (for paragraph), <code class="highlighter-rouge">&lt;link&gt;</code> and <code class="highlighter-rouge">&lt;b&gt;</code> for bold,
<code class="language-plaintext highlighter-rouge">&lt;body&gt;</code>, <code class="language-plaintext highlighter-rouge">&lt;p&gt;</code> (for paragraph), <code class="language-plaintext highlighter-rouge">&lt;link&gt;</code> and <code class="language-plaintext highlighter-rouge">&lt;b&gt;</code> for bold,
then why can you <em>see</em> the left and right angle bracket characters?
Dont they mean something? Shouldnt they be telling the browser:
<em>“Hey! Make me bold!”?</em>
Why <em>doesnt</em> everything after me typing <code class="highlighter-rouge">&lt;b&gt;</code> turn bold?</p>
Why <em>doesnt</em> everything after me typing <code class="language-plaintext highlighter-rouge">&lt;b&gt;</code> turn bold?</p>
<p>The answer is:</p>
@ -83,7 +83,7 @@ If I use the left and right brackets on my keyboard however,
things will indeed &lt;b&gt;show up bold&lt;/b&gt;.
</pre>
<p>Notice how all visible left angle brackets use an <code class="highlighter-rouge">&amp;lt;</code> to show them?</p>
<p>Notice how all visible left angle brackets use an <code class="language-plaintext highlighter-rouge">&amp;lt;</code> to show them?</p>
<p>These are called <a href="https://en.wikipedia.org/wiki/Escape_character">escape characters</a>.
They tell a system, in this case your web browser:
@ -91,12 +91,12 @@ They tell a system, in this case your web browser:
<h4 id="sanitization">Sanitization</h4>
<p>Most of the time XSS attacks are done using poorly sanitized HTML <code class="highlighter-rouge">&lt;input&gt;</code> elements.</p>
<p>Most of the time XSS attacks are done using poorly sanitized HTML <code class="language-plaintext highlighter-rouge">&lt;input&gt;</code> elements.</p>
<p>Sanitization is when a program (usually on the server side),
will remove characters like <code class="highlighter-rouge">&lt;</code> and replace them with the aforementioned “escape characters”.
Internally this would be something like <code class="highlighter-rouge">&amp;lt;</code>,
but they would show up to a user as <code class="highlighter-rouge">&lt;</code>.</p>
will remove characters like <code class="language-plaintext highlighter-rouge">&lt;</code> and replace them with the aforementioned “escape characters”.
Internally this would be something like <code class="language-plaintext highlighter-rouge">&amp;lt;</code>,
but they would show up to a user as <code class="language-plaintext highlighter-rouge">&lt;</code>.</p>
<p>When inputs are not properly sanitized <em>and</em> the input is shown to the user in another part of the website,
then a malicous user can type in HTML that will run whenever anybody tries to look at what they typed.
@ -110,16 +110,16 @@ Although this may annoy your victim it is not dangerous security wise.</p>
<p>There is one tag however, that <em>is</em> scary…</p>
<h2 id="script"><code class="highlighter-rouge">&lt;script&gt;</code></h2>
<h2 id="script"><code class="language-plaintext highlighter-rouge">&lt;script&gt;</code></h2>
<p>The <code class="highlighter-rouge">&lt;script&gt;</code> tag allows you to write code that can:</p>
<p>The <code class="language-plaintext highlighter-rouge">&lt;script&gt;</code> tag allows you to write code that can:</p>
<ol>
<li>Change the page contents.</li>
<li>Redirect the user to a new page automatically.</li>
<li>Get a users location.</li>
<li>Open a users microphone/webcam.</li>
<li>With the <code class="highlighter-rouge">src</code> <a href="https://www.w3schools.com/htmL/html_attributes.asp">attribute</a> you can also load a script from another site. (This is XSS)</li>
<li>With the <code class="language-plaintext highlighter-rouge">src</code> <a href="https://www.w3schools.com/htmL/html_attributes.asp">attribute</a> you can also load a script from another site. (This is XSS)</li>
</ol>
<p>Those last two will ask for permission from the user (if their browser isnt insanely insecure).</p>

@ -32,16 +32,16 @@
<div class="article">
<p>Despite the long name of the article, I have a feeling this may apply to more people than I might think.
If you have a Node.js application which needs socket.io connections that you want to pass throgh nginxs <code class="highlighter-rouge">reverse_proxy</code> directive then this is the article for you!</p>
If you have a Node.js application which needs socket.io connections that you want to pass throgh nginxs <code class="language-plaintext highlighter-rouge">reverse_proxy</code> directive then this is the article for you!</p>
<p>You <em>must</em> seperate the socket.io sockets and the static resources.</p>
<ul>
<li>The socket connections can be routed through the default <code class="highlighter-rouge">$host/socket.io</code> if you want to ease modifications to the source code.</li>
<li>The socket connections can be routed through the default <code class="language-plaintext highlighter-rouge">$host/socket.io</code> if you want to ease modifications to the source code.</li>
<li>The connections to your main npm Node.js application can be routed through the relevant directory.</li>
</ul>
<p>Here is the relevant part of my <code class="highlighter-rouge">projects.tait.tech.conf</code> file:</p>
<p>Here is the relevant part of my <code class="language-plaintext highlighter-rouge">projects.tait.tech.conf</code> file:</p>
<pre class="terminal">
location /socket.io {
@ -64,13 +64,13 @@ location /ttrpg {
<h3 id="explaination">Explaination:</h3>
<p>For this application,
I needed the <code class="highlighter-rouge">/ttrpg</code> directory to connect to my main Node.js instance. This was going to be the root of a ttrpg project.
I needed the <code class="language-plaintext highlighter-rouge">/ttrpg</code> directory to connect to my main Node.js instance. This was going to be the root of a ttrpg project.
It was to have static files served form my Node.js application.</p>
<p>I also needed <code class="highlighter-rouge">/socket.io</code> to conenct to my running <code class="highlighter-rouge">npm</code> instance.
When I tried to route all the traffic through the <code class="highlighter-rouge">/trrpg</code> location directive
<p>I also needed <code class="language-plaintext highlighter-rouge">/socket.io</code> to conenct to my running <code class="language-plaintext highlighter-rouge">npm</code> instance.
When I tried to route all the traffic through the <code class="language-plaintext highlighter-rouge">/trrpg</code> location directive
I had no luck whatsoever;
<code class="highlighter-rouge">$host/ttrpg/socket.io/*</code> calls <em>always</em> failed with a 404.</p>
<code class="language-plaintext highlighter-rouge">$host/ttrpg/socket.io/*</code> calls <em>always</em> failed with a 404.</p>
<p>Having two seperate blocks forwarding in different ways seems to fix this.
I am not knowledgable enough to understand how.</p>
@ -79,7 +79,7 @@ I am not knowledgable enough to understand how.</p>
<p>Happy hacking!</p>
<p><em>P.S. I forgot to mention I also symbolically linked the <code class="highlighter-rouge">socket.io.js</code> file (that node is supposed to serve automatically) to the static client dir.
<p><em>P.S. I forgot to mention I also symbolically linked the <code class="language-plaintext highlighter-rouge">socket.io.js</code> file (that node is supposed to serve automatically) to the static client dir.
For some reson the node instance would not serve this file without that.</em></p>
<pre class="terminal">

@ -35,7 +35,7 @@
<p>Also, Clue has been delayed due to my partner in crime on the project wokring too many hours.</p>
<p>I also posted a new project called <em><a href="https://github.com/TTWNO/caesar-cipher">Caesar Cipher</a></em> in C. It will be an intermediate example of how to use build systems like <code class="highlighter-rouge">make</code>.</p>
<p>I also posted a new project called <em><a href="https://github.com/TTWNO/caesar-cipher">Caesar Cipher</a></em> in C. It will be an intermediate example of how to use build systems like <code class="language-plaintext highlighter-rouge">make</code>.</p>
</div>

@ -45,18 +45,18 @@ Especially when I really just want to be playing games but I just need to check
<h2 id="solution">Solution</h2>
<p>So to solve this interesting problem, I decided to use <code class="highlighter-rouge">tmux</code>.
<code class="highlighter-rouge">tmux</code> is a <strong>t</strong>terminal <strong>mu</strong>ltiple<strong>x</strong>er.
<p>So to solve this interesting problem, I decided to use <code class="language-plaintext highlighter-rouge">tmux</code>.
<code class="language-plaintext highlighter-rouge">tmux</code> is a <strong>t</strong>terminal <strong>mu</strong>ltiple<strong>x</strong>er.
This allows you to run a terminal session, then detach fromc it while it still runs in the background.</p>
<p>This is very valuable when running command line applications that need to have an active console connection, like a Minecraft server.</p>
<p>So first I looked at the <code class="highlighter-rouge">tmux</code> command <code class="highlighter-rouge">send-keys</code>.</p>
<p>So first I looked at the <code class="language-plaintext highlighter-rouge">tmux</code> command <code class="language-plaintext highlighter-rouge">send-keys</code>.</p>
<h4 id="send-keys"><code class="highlighter-rouge">send-keys</code></h4>
<h4 id="send-keys"><code class="language-plaintext highlighter-rouge">send-keys</code></h4>
<p><code class="highlighter-rouge">send-keys</code> allows you to send text, and key presses to a <code class="highlighter-rouge">tmux</code> session.
Now assuming this <code class="highlighter-rouge">tmux</code> session is attached to a Minecraft server,
<p><code class="language-plaintext highlighter-rouge">send-keys</code> allows you to send text, and key presses to a <code class="language-plaintext highlighter-rouge">tmux</code> session.
Now assuming this <code class="language-plaintext highlighter-rouge">tmux</code> session is attached to a Minecraft server,
there is no reason you could not run a command like this:</p>
<pre class="terminal">
@ -70,9 +70,9 @@ Then, it will hit the newline character, this will execute the command.</p>
<p>But how do we get information about who is typing what in the Minecraft chat?</p>
<h3 id="tmuxs-capture-pane-is-painful"><code class="highlighter-rouge">tmux</code>s <code class="highlighter-rouge">capture-pane</code> is painful</h3>
<h3 id="tmuxs-capture-pane-is-painful"><code class="language-plaintext highlighter-rouge">tmux</code>s <code class="language-plaintext highlighter-rouge">capture-pane</code> is painful</h3>
<p>So in the manual page for <code class="highlighter-rouge">tmux</code> I can see a section recorded below for options I can give to the <code class="highlighter-rouge">capture-pane</code> subcommand.</p>
<p>So in the manual page for <code class="language-plaintext highlighter-rouge">tmux</code> I can see a section recorded below for options I can give to the <code class="language-plaintext highlighter-rouge">capture-pane</code> subcommand.</p>
<pre class="terminal">
-S and -E specify the starting and ending line numbers,
@ -82,10 +82,10 @@ Then, it will hit the newline character, this will execute the command.</p>
default is to capture only the visible contents of the pane.
</pre>
<p>What it seems to be saying is I can start at line <code class="highlighter-rouge">-S n</code> and end at line <code class="highlighter-rouge">-E n</code>.
Negative numbers start from the bottom, so <em>in theory</em> I can do the following: <code class="highlighter-rouge">tmux capture-pane -S -1</code> should capture only the last line, because Im starting from the last line. Right?</p>
<p>What it seems to be saying is I can start at line <code class="language-plaintext highlighter-rouge">-S n</code> and end at line <code class="language-plaintext highlighter-rouge">-E n</code>.
Negative numbers start from the bottom, so <em>in theory</em> I can do the following: <code class="language-plaintext highlighter-rouge">tmux capture-pane -S -1</code> should capture only the last line, because Im starting from the last line. Right?</p>
<p>No. It just doesnt work. Negative numbers do <em>not</em> work with the <code class="highlighter-rouge">tmux capture-pane</code> subcommand.</p>
<p>No. It just doesnt work. Negative numbers do <em>not</em> work with the <code class="language-plaintext highlighter-rouge">tmux capture-pane</code> subcommand.</p>
<p>So I did some simple UNIX piping, like so, to get just the last thing in the chat.</p>
@ -95,19 +95,19 @@ $ tmux capture-pane -p -t steve | tail -n1
</pre>
<p>TaterTheTot is my Minecraft username :)</p>
<p><code class="highlighter-rouge">-p</code> prints the result to the terminal/stdout.</p>
<p><code class="language-plaintext highlighter-rouge">-p</code> prints the result to the terminal/stdout.</p>
<p><code class="highlighter-rouge">steve</code> is the name of the tmux session Im trying to pull form.</p>
<p><code class="language-plaintext highlighter-rouge">steve</code> is the name of the tmux session Im trying to pull form.</p>
<p>So thats done! Beauty!</p>
<p>Now that we have that, how can we extract the username and the message from the latest line?</p>
<h3 id="grep"><code class="highlighter-rouge">grep</code></h3>
<h3 id="grep"><code class="language-plaintext highlighter-rouge">grep</code></h3>
<p><code class="highlighter-rouge">grep</code> is a command to find patterns of text.
<code class="highlighter-rouge">grep</code> has an option to only show a matching pattern of text.
This option is <code class="highlighter-rouge">-o</code>.</p>
<p><code class="language-plaintext highlighter-rouge">grep</code> is a command to find patterns of text.
<code class="language-plaintext highlighter-rouge">grep</code> has an option to only show a matching pattern of text.
This option is <code class="language-plaintext highlighter-rouge">-o</code>.</p>
<p>Lets see how we can use this in conjunction with our latest line of server output to get our results.</p>
@ -117,11 +117,11 @@ $ echo "[DEBUG] [SERVER] blah blah: &lt;TaterTheTot&gt; MY_MESAGE" | grep -o "&l
</pre>
<p>Now, thats my name with the &lt; and &gt; attached. Not bad!
We can use the <code class="highlighter-rouge">sed</code> command to clean it up a bit.</p>
We can use the <code class="language-plaintext highlighter-rouge">sed</code> command to clean it up a bit.</p>
<p>The syntax is like so: <code class="highlighter-rouge">select/somepattern/replacewith/global</code></p>
<p>The syntax is like so: <code class="language-plaintext highlighter-rouge">select/somepattern/replacewith/global</code></p>
<p>So the following command is: <code class="highlighter-rouge">s/[&lt;&gt;]//g</code></p>
<p>So the following command is: <code class="language-plaintext highlighter-rouge">s/[&lt;&gt;]//g</code></p>
<p>Select any characters that are either &lt; or &gt;.
Replace with nothing.
@ -138,7 +138,7 @@ TaterTheTot
<p>Now what about that pesky message?</p>
<h3 id="more-grep-more-sed">more <code class="highlighter-rouge">grep</code>; more <code class="highlighter-rouge">sed</code></h3>
<h3 id="more-grep-more-sed">more <code class="language-plaintext highlighter-rouge">grep</code>; more <code class="language-plaintext highlighter-rouge">sed</code></h3>
<p>Simple: capture everything after the &gt;. Leaving the users message entirely in tact.</p>

@ -33,20 +33,20 @@
<div class="article">
<p>In a very odd combination of requirements,
I needed to install <a href="https://multicraft.org">MultiCraft</a> on a Gentoo Linux system.
The PHP <code class="highlighter-rouge">USE</code> flags are important so you dont have to recompile it three times like I did.</p>
The PHP <code class="language-plaintext highlighter-rouge">USE</code> flags are important so you dont have to recompile it three times like I did.</p>
<p>Here are some useful tips I came across:</p>
<h3 id="php-use-flags">PHP <code class="highlighter-rouge">USE</code> flags</h3>
<h3 id="php-use-flags">PHP <code class="language-plaintext highlighter-rouge">USE</code> flags</h3>
<p>In <code class="highlighter-rouge">/etc/portage/package.use/php</code> I placed the following line:</p>
<p>In <code class="language-plaintext highlighter-rouge">/etc/portage/package.use/php</code> I placed the following line:</p>
<pre class="terminal">
dev-lang/php cgi mysql mysqli fpm pdo gd truetype
</pre>
<p>This should give you enough for a mysql backended MultiCraft installation.
The <code class="highlighter-rouge">cgi</code> option may not be required as <code class="highlighter-rouge">fpm</code> stands for <em>FastCGI Process Managment</em>.
The <code class="language-plaintext highlighter-rouge">cgi</code> option may not be required as <code class="language-plaintext highlighter-rouge">fpm</code> stands for <em>FastCGI Process Managment</em>.
I dont know for sure though.</p>
<h3 id="paper">Paper</h3>
@ -80,7 +80,7 @@ This completely stalled any work getting done with a ton of permission denied
<h4 id="security">Security</h4>
<p>If the panel is in the root directory of your NGINX web server,
use the following in your server block to deny access to the <code class="highlighter-rouge">/protected</code> directory.</p>
use the following in your server block to deny access to the <code class="language-plaintext highlighter-rouge">/protected</code> directory.</p>
<pre class="terminal">
location /protected {

@ -49,7 +49,7 @@ It focuses on speed, which is a priority, especially when using the ASGI protoco
$ uvicorn --reload myapp.asgi:application
</pre>
<p>The <code class="highlighter-rouge">--reload</code> option says to reload the server if any of the files get updated.
<p>The <code class="language-plaintext highlighter-rouge">--reload</code> option says to reload the server if any of the files get updated.
This is not recommended in production.
Sadly, I thought this meant I would need to do a hard shutdown of the server process every time I wanted to update.
This turned out to not be the case.</p>
@ -58,7 +58,7 @@ This turned out to not be the case.</p>
<p>There is another equine-named program called <a href="https://gunicorn.org/">gunicorn</a>
which can hold a number of processes under its control.
An interesting feature of <code class="highlighter-rouge">gunicorn</code> is that it will gracefully switch from an old to a new deployment,
An interesting feature of <code class="language-plaintext highlighter-rouge">gunicorn</code> is that it will gracefully switch from an old to a new deployment,
replacing the subprocesses one-by-one and eventually having only the new deployment active on all subprocesses.
The greatest part? Zero down time.
The server keeps any old processes open if there is communication with them,
@ -67,13 +67,13 @@ This was a very cool feature I wanted to take advantage of.</p>
<p>“Now hold on!” you might protest.
“gunicorn is a WSGI server!” … oh you got me there!
Yes, thats right, <code class="highlighter-rouge">gunicorn</code> is paired with <code class="highlighter-rouge">uvicorn</code> to serve my files.</p>
Yes, thats right, <code class="language-plaintext highlighter-rouge">gunicorn</code> is paired with <code class="language-plaintext highlighter-rouge">uvicorn</code> to serve my files.</p>
<h3 id="systemd">systemd</h3>
<p>Love it or hate it, the majority of Linux distributions use the <code class="highlighter-rouge">systemd</code> init system.
<p>Love it or hate it, the majority of Linux distributions use the <code class="language-plaintext highlighter-rouge">systemd</code> init system.
I decided it would be very convenient to have a .service file for my Django application to run automatically at boot.
<code class="highlighter-rouge">Systemd</code> allows me to do this with a file like the following one I stored in <code class="highlighter-rouge">/lib/systemd/system/lamegames.service</code>.</p>
<code class="language-plaintext highlighter-rouge">Systemd</code> allows me to do this with a file like the following one I stored in <code class="language-plaintext highlighter-rouge">/lib/systemd/system/lamegames.service</code>.</p>
<pre class="file">
[Unit]
@ -100,11 +100,11 @@ To configure my nginx installation, I used the following few directives to:</p>
<ol>
<li>Redirect most traffic towards the gunicorn server.</li>
<li>Redirect statically served files (CSS, JS, images) to the directory specified in the STATIC_ROOT variable of my <code class="highlighter-rouge">settings.py</code> file.</li>
<li>Redirect statically served files (CSS, JS, images) to the directory specified in the STATIC_ROOT variable of my <code class="language-plaintext highlighter-rouge">settings.py</code> file.</li>
<li>Use TLS to enable https://</li>
</ol>
<p>Serving the static files from nginx as opposed to the <code class="highlighter-rouge">gunicorn</code> server is necessary.
<p>Serving the static files from nginx as opposed to the <code class="language-plaintext highlighter-rouge">gunicorn</code> server is necessary.
Gunicorn and other production A/WSGI web server will not set the proper MIME type over TLS.
This will cause your browser to not load the Javascript/CSS.</p>
@ -141,7 +141,7 @@ server {
# systemctl enable lamegames
</pre>
<p>This enabled my <code class="highlighter-rouge">gunicorn</code> server to run once the server started.
<p>This enabled my <code class="language-plaintext highlighter-rouge">gunicorn</code> server to run once the server started.
NGINX is that way be default.</p>
<p>And tada! You now have a working Django project on a production server!</p>

@ -65,7 +65,7 @@ there will be code equivalents to the math.</p>
<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">import</span> <span class="nn">random</span>
<span class="c1"># r &lt;= 0 &lt;= W*H
</span><span class="n">r</span> <span class="o">=</span> <span class="n">random</span><span class="o">.</span><span class="n">randint</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="n">W</span><span class="o">*</span><span class="n">H</span><span class="p">)</span><span class="o">-</span><span class="mi">1</span>
</span><span class="n">r</span> <span class="o">=</span> <span class="n">random</span><span class="p">.</span><span class="n">randint</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="n">W</span><span class="o">*</span><span class="n">H</span><span class="p">)</span><span class="o">-</span><span class="mi">1</span>
<span class="c1"># x = r mod W
</span><span class="n">x</span> <span class="o">=</span> <span class="n">r</span> <span class="o">%</span> <span class="n">W</span>
@ -99,7 +99,7 @@ Whenever a player clicks a tile, the following logic should be used:</p>
<span class="n">you_lose</span><span class="p">()</span>
<span class="k">return</span>
<span class="c1"># if the bomb number is more than 0
</span> <span class="n">already_revealed</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="n">nx</span><span class="p">,</span> <span class="n">ny</span><span class="p">))</span>
</span> <span class="n">already_revealed</span><span class="p">.</span><span class="n">append</span><span class="p">((</span><span class="n">nx</span><span class="p">,</span> <span class="n">ny</span><span class="p">))</span>
<span class="c1"># from -1 to 1
</span> <span class="k">for</span> <span class="n">xd</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">):</span>

@ -65,14 +65,7 @@ img { display: block; width: 55%; margin-left: auto; margin-right: auto; }
blockquote { font-style: italic; }
@media screen and (max-width: 600px) { #menu, label[for="menu"] { text-align: left; display: inline-block; font-size: 20px; }
body { width: 90%; }
#info { margin: 0 7px; }
.menu-content { max-height: 0; overflow: hidden; }
nav { text-align: left; width: 100%; }
nav a { display: block; text-align: left; padding-left: 0; margin-left: 0; }
#menu { display: none; }
input:checked ~ .menu-content { max-height: 100%; border-bottom: 1px solid #aaa; color: red; } }
@media screen and (max-width: 600px) { #menu, label[for="menu"] { text-align: left; display: inline-block; font-size: 20px; } body { width: 90%; } #info { margin: 0 7px; } .menu-content { max-height: 0; overflow: hidden; } nav { text-align: left; width: 100%; } nav a { display: block; text-align: left; padding-left: 0; margin-left: 0; } #menu { display: none; } input:checked ~ .menu-content { max-height: 100%; border-bottom: 1px solid #aaa; color: red; } }
.contact-info { width: 90%; margin: auto; word-wrap: break-word; }

File diff suppressed because one or more lines are too long

@ -91,7 +91,7 @@ In this article, I will explain how you can do the same.</p>
<span class="post-date">19 July 2020</span>
<div class="post-excerpt"><p>In a very odd combination of requirements,
I needed to install <a href="https://multicraft.org">MultiCraft</a> on a Gentoo Linux system.
The PHP <code class="highlighter-rouge">USE</code> flags are important so you dont have to recompile it three times like I did.</p>
The PHP <code class="language-plaintext highlighter-rouge">USE</code> flags are important so you dont have to recompile it three times like I did.</p>
</div>
</td>
</tr>
@ -145,7 +145,7 @@ Clue.</p>
<h3 class="post-title"><a class="post-title-link" href="/2020/05/01/nginx-socket-io-projects.html">How to use NGINX as a reverse-proxy server for a Node.js application using socket.io</a></h2>
<span class="post-date">01 May 2020</span>
<div class="post-excerpt"><p>Despite the long name of the article, I have a feeling this may apply to more people than I might think.
If you have a Node.js application which needs socket.io connections that you want to pass throgh nginxs <code class="highlighter-rouge">reverse_proxy</code> directive then this is the article for you!</p>
If you have a Node.js application which needs socket.io connections that you want to pass throgh nginxs <code class="language-plaintext highlighter-rouge">reverse_proxy</code> directive then this is the article for you!</p>
</div>
</td>
</tr>

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="4.0.0">Jekyll</generator><link href="http://192.168.1.101:4000/feed.xml" rel="self" type="application/atom+xml" /><link href="http://192.168.1.101:4000/" rel="alternate" type="text/html" /><updated>2020-09-13T01:20:44+00:00</updated><id>http://192.168.1.101:4000/feed.xml</id><entry><title type="html">Minesweeper Bomb Generation And Tile Revealing</title><link href="http://192.168.1.101:4000/2020/09/12/minesweeper.html" rel="alternate" type="text/html" title="Minesweeper Bomb Generation And Tile Revealing" /><published>2020-09-12T00:00:00+00:00</published><updated>2020-09-12T00:00:00+00:00</updated><id>http://192.168.1.101:4000/2020/09/12/minesweeper</id><content type="html" xml:base="http://192.168.1.101:4000/2020/09/12/minesweeper.html">&lt;p&gt;When I was creating a little Minesweeper game, I got confused at some points.
<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="4.1.1">Jekyll</generator><link href="http://localhost:4000/feed.xml" rel="self" type="application/atom+xml" /><link href="http://localhost:4000/" rel="alternate" type="text/html" /><updated>2020-09-13T01:36:31+00:00</updated><id>http://localhost:4000/feed.xml</id><entry><title type="html">Minesweeper Bomb Generation And Tile Revealing</title><link href="http://localhost:4000/2020/09/12/minesweeper.html" rel="alternate" type="text/html" title="Minesweeper Bomb Generation And Tile Revealing" /><published>2020-09-12T00:00:00+00:00</published><updated>2020-09-12T00:00:00+00:00</updated><id>http://localhost:4000/2020/09/12/minesweeper</id><content type="html" xml:base="http://localhost:4000/2020/09/12/minesweeper.html">&lt;p&gt;When I was creating a little Minesweeper game, I got confused at some points.
My bomb generation didnt look quite right, and I for sure didnt quite get the whole cascading tile reveal thing.
With a bit of internet research, I found what I was looking for.
Ill explain it all in one place for my own research purposes.&lt;/p&gt;
@ -31,7 +31,7 @@ there will be code equivalents to the math.&lt;/p&gt;
&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;random&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# r &amp;lt;= 0 &amp;lt;= W*H
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;r&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;random&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;randint&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;W&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;H&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;r&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;random&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;randint&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;W&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;H&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# x = r mod W
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;r&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;%&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;W&lt;/span&gt;
@ -65,7 +65,7 @@ Whenever a player clicks a tile, the following logic should be used:&lt;/p&gt;
&lt;span class=&quot;n&quot;&gt;you_lose&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# if the bomb number is more than 0
&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;already_revealed&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;nx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ny&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;already_revealed&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;nx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ny&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# from -1 to 1
&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;xd&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
@ -88,7 +88,7 @@ I hope that this helps you with getting the general idea of a Minesweeper game.
The completed version of this game is available on my &lt;a href=&quot;https://lamegames.tait.tech/&quot;&gt;lamegames&lt;/a&gt; site.
Let me know what you think!&lt;/p&gt;
&lt;p&gt;Happy hacking!&lt;/p&gt;</content><author><name></name></author><summary type="html">When I was creating a little Minesweeper game, I got confused at some points. My bomb generation didnt look quite right, and I for sure didnt quite get the whole cascading tile reveal thing. With a bit of internet research, I found what I was looking for. Ill explain it all in one place for my own research purposes.</summary></entry><entry><title type="html">lamegames.tait.tech</title><link href="http://192.168.1.101:4000/2020/09/09/lamegames.html" rel="alternate" type="text/html" title="lamegames.tait.tech" /><published>2020-09-09T00:00:00+00:00</published><updated>2020-09-09T00:00:00+00:00</updated><id>http://192.168.1.101:4000/2020/09/09/lamegames</id><content type="html" xml:base="http://192.168.1.101:4000/2020/09/09/lamegames.html">&lt;p&gt;This is an announcement for a new project of mine:
&lt;p&gt;Happy hacking!&lt;/p&gt;</content><author><name></name></author><summary type="html">When I was creating a little Minesweeper game, I got confused at some points. My bomb generation didnt look quite right, and I for sure didnt quite get the whole cascading tile reveal thing. With a bit of internet research, I found what I was looking for. Ill explain it all in one place for my own research purposes.</summary></entry><entry><title type="html">lamegames.tait.tech</title><link href="http://localhost:4000/2020/09/09/lamegames.html" rel="alternate" type="text/html" title="lamegames.tait.tech" /><published>2020-09-09T00:00:00+00:00</published><updated>2020-09-09T00:00:00+00:00</updated><id>http://localhost:4000/2020/09/09/lamegames</id><content type="html" xml:base="http://localhost:4000/2020/09/09/lamegames.html">&lt;p&gt;This is an announcement for a new project of mine:
&lt;a href=&quot;https://lamegames.tait.tech&quot;&gt;lamegames.tait.tech&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This is something Im really excited to work on!&lt;/p&gt;
@ -96,7 +96,7 @@ Let me know what you think!&lt;/p&gt;
&lt;p&gt;Right now, Ive just got a rock-paper-scissors game.
A chat function, and a few simple card games to come.&lt;/p&gt;
&lt;p&gt;Check out the repository on my &lt;a href=&quot;https://github.com/TTWNO/lamegames.io&quot;&gt;Github&lt;/a&gt;.&lt;/p&gt;</content><author><name></name></author><summary type="html">This is an announcement for a new project of mine: lamegames.tait.tech.</summary></entry><entry><title type="html">How to Solve The Django Deployment Puzzle</title><link href="http://192.168.1.101:4000/2020/08/18/django-deployment.html" rel="alternate" type="text/html" title="How to Solve The Django Deployment Puzzle" /><published>2020-08-18T00:00:00+00:00</published><updated>2020-08-18T00:00:00+00:00</updated><id>http://192.168.1.101:4000/2020/08/18/django-deployment</id><content type="html" xml:base="http://192.168.1.101:4000/2020/08/18/django-deployment.html">&lt;p&gt;A few days ago I had a Django project I wanted to put on a real server.
&lt;p&gt;Check out the repository on my &lt;a href=&quot;https://github.com/TTWNO/lamegames.io&quot;&gt;Github&lt;/a&gt;.&lt;/p&gt;</content><author><name></name></author><summary type="html">This is an announcement for a new project of mine: lamegames.tait.tech.</summary></entry><entry><title type="html">How to Solve The Django Deployment Puzzle</title><link href="http://localhost:4000/2020/08/18/django-deployment.html" rel="alternate" type="text/html" title="How to Solve The Django Deployment Puzzle" /><published>2020-08-18T00:00:00+00:00</published><updated>2020-08-18T00:00:00+00:00</updated><id>http://localhost:4000/2020/08/18/django-deployment</id><content type="html" xml:base="http://localhost:4000/2020/08/18/django-deployment.html">&lt;p&gt;A few days ago I had a Django project I wanted to put on a real server.
This project is still in its infancy, but I thought it would be nice to put it on my resume and show my friends.
Little did I know the headache coming my way.
Here are some tips to help you not make the same mistakes as me.&lt;/p&gt;
@ -114,7 +114,7 @@ It focuses on speed, which is a priority, especially when using the ASGI protoco
$ uvicorn --reload myapp.asgi:application
&lt;/pre&gt;
&lt;p&gt;The &lt;code class=&quot;highlighter-rouge&quot;&gt;--reload&lt;/code&gt; option says to reload the server if any of the files get updated.
&lt;p&gt;The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;--reload&lt;/code&gt; option says to reload the server if any of the files get updated.
This is not recommended in production.
Sadly, I thought this meant I would need to do a hard shutdown of the server process every time I wanted to update.
This turned out to not be the case.&lt;/p&gt;
@ -123,7 +123,7 @@ This turned out to not be the case.&lt;/p&gt;
&lt;p&gt;There is another equine-named program called &lt;a href=&quot;https://gunicorn.org/&quot;&gt;gunicorn&lt;/a&gt;
which can hold a number of processes under its control.
An interesting feature of &lt;code class=&quot;highlighter-rouge&quot;&gt;gunicorn&lt;/code&gt; is that it will gracefully switch from an old to a new deployment,
An interesting feature of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gunicorn&lt;/code&gt; is that it will gracefully switch from an old to a new deployment,
replacing the subprocesses one-by-one and eventually having only the new deployment active on all subprocesses.
The greatest part? Zero down time.
The server keeps any old processes open if there is communication with them,
@ -132,13 +132,13 @@ This was a very cool feature I wanted to take advantage of.&lt;/p&gt;
&lt;p&gt;“Now hold on!” you might protest.
“gunicorn is a WSGI server!” … oh you got me there!
Yes, thats right, &lt;code class=&quot;highlighter-rouge&quot;&gt;gunicorn&lt;/code&gt; is paired with &lt;code class=&quot;highlighter-rouge&quot;&gt;uvicorn&lt;/code&gt; to serve my files.&lt;/p&gt;
Yes, thats right, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gunicorn&lt;/code&gt; is paired with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;uvicorn&lt;/code&gt; to serve my files.&lt;/p&gt;
&lt;h3 id=&quot;systemd&quot;&gt;systemd&lt;/h3&gt;
&lt;p&gt;Love it or hate it, the majority of Linux distributions use the &lt;code class=&quot;highlighter-rouge&quot;&gt;systemd&lt;/code&gt; init system.
&lt;p&gt;Love it or hate it, the majority of Linux distributions use the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;systemd&lt;/code&gt; init system.
I decided it would be very convenient to have a .service file for my Django application to run automatically at boot.
&lt;code class=&quot;highlighter-rouge&quot;&gt;Systemd&lt;/code&gt; allows me to do this with a file like the following one I stored in &lt;code class=&quot;highlighter-rouge&quot;&gt;/lib/systemd/system/lamegames.service&lt;/code&gt;.&lt;/p&gt;
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Systemd&lt;/code&gt; allows me to do this with a file like the following one I stored in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/lib/systemd/system/lamegames.service&lt;/code&gt;.&lt;/p&gt;
&lt;pre class=&quot;file&quot;&gt;
[Unit]
@ -165,11 +165,11 @@ To configure my nginx installation, I used the following few directives to:&lt;/
&lt;ol&gt;
&lt;li&gt;Redirect most traffic towards the gunicorn server.&lt;/li&gt;
&lt;li&gt;Redirect statically served files (CSS, JS, images) to the directory specified in the STATIC_ROOT variable of my &lt;code class=&quot;highlighter-rouge&quot;&gt;settings.py&lt;/code&gt; file.&lt;/li&gt;
&lt;li&gt;Redirect statically served files (CSS, JS, images) to the directory specified in the STATIC_ROOT variable of my &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;settings.py&lt;/code&gt; file.&lt;/li&gt;
&lt;li&gt;Use TLS to enable https://&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Serving the static files from nginx as opposed to the &lt;code class=&quot;highlighter-rouge&quot;&gt;gunicorn&lt;/code&gt; server is necessary.
&lt;p&gt;Serving the static files from nginx as opposed to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gunicorn&lt;/code&gt; server is necessary.
Gunicorn and other production A/WSGI web server will not set the proper MIME type over TLS.
This will cause your browser to not load the Javascript/CSS.&lt;/p&gt;
@ -206,7 +206,7 @@ server {
# systemctl enable lamegames
&lt;/pre&gt;
&lt;p&gt;This enabled my &lt;code class=&quot;highlighter-rouge&quot;&gt;gunicorn&lt;/code&gt; server to run once the server started.
&lt;p&gt;This enabled my &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gunicorn&lt;/code&gt; server to run once the server started.
NGINX is that way be default.&lt;/p&gt;
&lt;p&gt;And tada! You now have a working Django project on a production server!&lt;/p&gt;
@ -216,7 +216,7 @@ NGINX is that way be default.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;If using ws:// websockets, change them to wss:// for secure web sockets.&lt;/li&gt;
&lt;li&gt;Make sure to use channels.routing.get_default_application() instead of django.get_asgi_application() if yourre wanting to use channels/redis WebSockets.&lt;/li&gt;
&lt;/ul&gt;</content><author><name></name></author><summary type="html">A few days ago I had a Django project I wanted to put on a real server. This project is still in its infancy, but I thought it would be nice to put it on my resume and show my friends. Little did I know the headache coming my way. Here are some tips to help you not make the same mistakes as me.</summary></entry><entry><title type="html">BSD Journey, Part 1</title><link href="http://192.168.1.101:4000/2020/08/15/openbsd1.html" rel="alternate" type="text/html" title="BSD Journey, Part 1" /><published>2020-08-15T00:00:00+00:00</published><updated>2020-08-15T00:00:00+00:00</updated><id>http://192.168.1.101:4000/2020/08/15/openbsd1</id><content type="html" xml:base="http://192.168.1.101:4000/2020/08/15/openbsd1.html">&lt;p&gt;As Linux becomes controlled by corporate sponsors and becomes more full of proprietary blobs, drivers, and even closed-source software like Steam,
&lt;/ul&gt;</content><author><name></name></author><summary type="html">A few days ago I had a Django project I wanted to put on a real server. This project is still in its infancy, but I thought it would be nice to put it on my resume and show my friends. Little did I know the headache coming my way. Here are some tips to help you not make the same mistakes as me.</summary></entry><entry><title type="html">BSD Journey, Part 1</title><link href="http://localhost:4000/2020/08/15/openbsd1.html" rel="alternate" type="text/html" title="BSD Journey, Part 1" /><published>2020-08-15T00:00:00+00:00</published><updated>2020-08-15T00:00:00+00:00</updated><id>http://localhost:4000/2020/08/15/openbsd1</id><content type="html" xml:base="http://localhost:4000/2020/08/15/openbsd1.html">&lt;p&gt;As Linux becomes controlled by corporate sponsors and becomes more full of proprietary blobs, drivers, and even closed-source software like Steam,
One may wonder if there are other options out there.
For me, somebody that is intensely interested in security, there is one option: OpenBSD.&lt;/p&gt;
@ -249,7 +249,7 @@ Maybe he was right, maybe not. What I know is I am excited to find out!&lt;/p&gt
&lt;p&gt;Wish my luck on my OpenBSD journey. I will post updates here along the way.&lt;/p&gt;
&lt;p&gt;Happy hacking!&lt;/p&gt;</content><author><name></name></author><summary type="html">As Linux becomes controlled by corporate sponsors and becomes more full of proprietary blobs, drivers, and even closed-source software like Steam, One may wonder if there are other options out there. For me, somebody that is intensely interested in security, there is one option: OpenBSD.</summary></entry><entry><title type="html">Know How Your Representative Votes In Parliament</title><link href="http://192.168.1.101:4000/2020/07/30/canadian-parliament.html" rel="alternate" type="text/html" title="Know How Your Representative Votes In Parliament" /><published>2020-07-30T00:00:00+00:00</published><updated>2020-07-30T00:00:00+00:00</updated><id>http://192.168.1.101:4000/2020/07/30/canadian-parliament</id><content type="html" xml:base="http://192.168.1.101:4000/2020/07/30/canadian-parliament.html">&lt;p&gt;As an advocate for openness, I had an idea to make a project out of the government of Canadas &lt;a href=&quot;https://open.canada.ca/en/open-data&quot;&gt;Open Data&lt;/a&gt;
&lt;p&gt;Happy hacking!&lt;/p&gt;</content><author><name></name></author><summary type="html">As Linux becomes controlled by corporate sponsors and becomes more full of proprietary blobs, drivers, and even closed-source software like Steam, One may wonder if there are other options out there. For me, somebody that is intensely interested in security, there is one option: OpenBSD.</summary></entry><entry><title type="html">Know How Your Representative Votes In Parliament</title><link href="http://localhost:4000/2020/07/30/canadian-parliament.html" rel="alternate" type="text/html" title="Know How Your Representative Votes In Parliament" /><published>2020-07-30T00:00:00+00:00</published><updated>2020-07-30T00:00:00+00:00</updated><id>http://localhost:4000/2020/07/30/canadian-parliament</id><content type="html" xml:base="http://localhost:4000/2020/07/30/canadian-parliament.html">&lt;p&gt;As an advocate for openness, I had an idea to make a project out of the government of Canadas &lt;a href=&quot;https://open.canada.ca/en/open-data&quot;&gt;Open Data&lt;/a&gt;
initiative to take a look at how my local MP voted on various pieces of legislation.
It turns out though that this was not necessary due to how easy it was to find this information on the governments own website.
In this article, I will explain how you can do the same.&lt;/p&gt;
@ -292,22 +292,22 @@ or read the actual text by clicking the &lt;strong&gt;View this Bill on LEGISinf
&lt;p&gt;I thought this was pretty cool!
It was &lt;em&gt;way&lt;/em&gt; simpler than I thought it would be.&lt;/p&gt;
&lt;p&gt;Thanks, Canada!&lt;/p&gt;</content><author><name></name></author><summary type="html">As an advocate for openness, I had an idea to make a project out of the government of Canadas Open Data initiative to take a look at how my local MP voted on various pieces of legislation. It turns out though that this was not necessary due to how easy it was to find this information on the governments own website. In this article, I will explain how you can do the same.</summary></entry><entry><title type="html">Installing MultiCraft on Gentoo Linux</title><link href="http://192.168.1.101:4000/2020/07/19/multicraft-php-gentoo.html" rel="alternate" type="text/html" title="Installing MultiCraft on Gentoo Linux" /><published>2020-07-19T00:00:00+00:00</published><updated>2020-07-19T00:00:00+00:00</updated><id>http://192.168.1.101:4000/2020/07/19/multicraft-php-gentoo</id><content type="html" xml:base="http://192.168.1.101:4000/2020/07/19/multicraft-php-gentoo.html">&lt;p&gt;In a very odd combination of requirements,
&lt;p&gt;Thanks, Canada!&lt;/p&gt;</content><author><name></name></author><summary type="html">As an advocate for openness, I had an idea to make a project out of the government of Canadas Open Data initiative to take a look at how my local MP voted on various pieces of legislation. It turns out though that this was not necessary due to how easy it was to find this information on the governments own website. In this article, I will explain how you can do the same.</summary></entry><entry><title type="html">Installing MultiCraft on Gentoo Linux</title><link href="http://localhost:4000/2020/07/19/multicraft-php-gentoo.html" rel="alternate" type="text/html" title="Installing MultiCraft on Gentoo Linux" /><published>2020-07-19T00:00:00+00:00</published><updated>2020-07-19T00:00:00+00:00</updated><id>http://localhost:4000/2020/07/19/multicraft-php-gentoo</id><content type="html" xml:base="http://localhost:4000/2020/07/19/multicraft-php-gentoo.html">&lt;p&gt;In a very odd combination of requirements,
I needed to install &lt;a href=&quot;https://multicraft.org&quot;&gt;MultiCraft&lt;/a&gt; on a Gentoo Linux system.
The PHP &lt;code class=&quot;highlighter-rouge&quot;&gt;USE&lt;/code&gt; flags are important so you dont have to recompile it three times like I did.&lt;/p&gt;
The PHP &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;USE&lt;/code&gt; flags are important so you dont have to recompile it three times like I did.&lt;/p&gt;
&lt;p&gt;Here are some useful tips I came across:&lt;/p&gt;
&lt;h3 id=&quot;php-use-flags&quot;&gt;PHP &lt;code class=&quot;highlighter-rouge&quot;&gt;USE&lt;/code&gt; flags&lt;/h3&gt;
&lt;h3 id=&quot;php-use-flags&quot;&gt;PHP &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;USE&lt;/code&gt; flags&lt;/h3&gt;
&lt;p&gt;In &lt;code class=&quot;highlighter-rouge&quot;&gt;/etc/portage/package.use/php&lt;/code&gt; I placed the following line:&lt;/p&gt;
&lt;p&gt;In &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/portage/package.use/php&lt;/code&gt; I placed the following line:&lt;/p&gt;
&lt;pre class=&quot;terminal&quot;&gt;
dev-lang/php cgi mysql mysqli fpm pdo gd truetype
&lt;/pre&gt;
&lt;p&gt;This should give you enough for a mysql backended MultiCraft installation.
The &lt;code class=&quot;highlighter-rouge&quot;&gt;cgi&lt;/code&gt; option may not be required as &lt;code class=&quot;highlighter-rouge&quot;&gt;fpm&lt;/code&gt; stands for &lt;em&gt;FastCGI Process Managment&lt;/em&gt;.
The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cgi&lt;/code&gt; option may not be required as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;fpm&lt;/code&gt; stands for &lt;em&gt;FastCGI Process Managment&lt;/em&gt;.
I dont know for sure though.&lt;/p&gt;
&lt;h3 id=&quot;paper&quot;&gt;Paper&lt;/h3&gt;
@ -341,7 +341,7 @@ This completely stalled any work getting done with a ton of permission denied
&lt;h4 id=&quot;security&quot;&gt;Security&lt;/h4&gt;
&lt;p&gt;If the panel is in the root directory of your NGINX web server,
use the following in your server block to deny access to the &lt;code class=&quot;highlighter-rouge&quot;&gt;/protected&lt;/code&gt; directory.&lt;/p&gt;
use the following in your server block to deny access to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/protected&lt;/code&gt; directory.&lt;/p&gt;
&lt;pre class=&quot;terminal&quot;&gt;
location /protected {
@ -385,7 +385,7 @@ Query OK, 0 rows affected (0.01 sec)
Database 1 is the panel database.
Database 2 is the daemon database.&lt;/p&gt;
&lt;p&gt;Happy hacking :)&lt;/p&gt;</content><author><name></name></author><summary type="html">In a very odd combination of requirements, I needed to install MultiCraft on a Gentoo Linux system. The PHP USE flags are important so you dont have to recompile it three times like I did.</summary></entry><entry><title type="html">Independence</title><link href="http://192.168.1.101:4000/2020/07/12/independence.html" rel="alternate" type="text/html" title="Independence" /><published>2020-07-12T00:00:00+00:00</published><updated>2020-07-12T00:00:00+00:00</updated><id>http://192.168.1.101:4000/2020/07/12/independence</id><content type="html" xml:base="http://192.168.1.101:4000/2020/07/12/independence.html">&lt;blockquote&gt;
&lt;p&gt;Happy hacking :)&lt;/p&gt;</content><author><name></name></author><summary type="html">In a very odd combination of requirements, I needed to install MultiCraft on a Gentoo Linux system. The PHP USE flags are important so you dont have to recompile it three times like I did.</summary></entry><entry><title type="html">Independence</title><link href="http://localhost:4000/2020/07/12/independence.html" rel="alternate" type="text/html" title="Independence" /><published>2020-07-12T00:00:00+00:00</published><updated>2020-07-12T00:00:00+00:00</updated><id>http://localhost:4000/2020/07/12/independence</id><content type="html" xml:base="http://localhost:4000/2020/07/12/independence.html">&lt;blockquote&gt;
&lt;p&gt;“When given a choice between independence and dependence, always choose independence; you will never regret that choice!”—Luke Smith&lt;/p&gt;
&lt;/blockquote&gt;
@ -423,7 +423,7 @@ know where I live, where I am going, who are my friends, what do I believe; in t
&lt;p&gt;Your website is pulled for controversial views: switch hosts.&lt;/p&gt;
&lt;p&gt;Protect yourself; give yourself choices.
Why give others that power when you could have it for yourself?&lt;/p&gt;</content><author><name></name></author><summary type="html">“When given a choice between independence and dependence, always choose independence; you will never regret that choice!”—Luke Smith</summary></entry><entry><title type="html">How to use tmux to send and receive things from your Minecraft server</title><link href="http://192.168.1.101:4000/2020/06/25/tmux-minecraft.html" rel="alternate" type="text/html" title="How to use tmux to send and receive things from your Minecraft server" /><published>2020-06-25T00:00:00+00:00</published><updated>2020-06-25T00:00:00+00:00</updated><id>http://192.168.1.101:4000/2020/06/25/tmux-minecraft</id><content type="html" xml:base="http://192.168.1.101:4000/2020/06/25/tmux-minecraft.html">&lt;p&gt;So recently I had problem.
Why give others that power when you could have it for yourself?&lt;/p&gt;</content><author><name></name></author><summary type="html">“When given a choice between independence and dependence, always choose independence; you will never regret that choice!”—Luke Smith</summary></entry><entry><title type="html">How to use tmux to send and receive things from your Minecraft server</title><link href="http://localhost:4000/2020/06/25/tmux-minecraft.html" rel="alternate" type="text/html" title="How to use tmux to send and receive things from your Minecraft server" /><published>2020-06-25T00:00:00+00:00</published><updated>2020-06-25T00:00:00+00:00</updated><id>http://localhost:4000/2020/06/25/tmux-minecraft</id><content type="html" xml:base="http://localhost:4000/2020/06/25/tmux-minecraft.html">&lt;p&gt;So recently I had problem.
I run a Minecraft server on a big Linux computer I have running in my room.
Now, as a system administrator it is very helpful to be able to run some simple commands without needing to login with my key, password, TFA, etc.
It is, frankly, a lot of work.
@ -437,18 +437,18 @@ Especially when I really just want to be playing games but I just need to check
&lt;h2 id=&quot;solution&quot;&gt;Solution&lt;/h2&gt;
&lt;p&gt;So to solve this interesting problem, I decided to use &lt;code class=&quot;highlighter-rouge&quot;&gt;tmux&lt;/code&gt;.
&lt;code class=&quot;highlighter-rouge&quot;&gt;tmux&lt;/code&gt; is a &lt;strong&gt;t&lt;/strong&gt;terminal &lt;strong&gt;mu&lt;/strong&gt;ltiple&lt;strong&gt;x&lt;/strong&gt;er.
&lt;p&gt;So to solve this interesting problem, I decided to use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tmux&lt;/code&gt;.
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tmux&lt;/code&gt; is a &lt;strong&gt;t&lt;/strong&gt;terminal &lt;strong&gt;mu&lt;/strong&gt;ltiple&lt;strong&gt;x&lt;/strong&gt;er.
This allows you to run a terminal session, then detach fromc it while it still runs in the background.&lt;/p&gt;
&lt;p&gt;This is very valuable when running command line applications that need to have an active console connection, like a Minecraft server.&lt;/p&gt;
&lt;p&gt;So first I looked at the &lt;code class=&quot;highlighter-rouge&quot;&gt;tmux&lt;/code&gt; command &lt;code class=&quot;highlighter-rouge&quot;&gt;send-keys&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;So first I looked at the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tmux&lt;/code&gt; command &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;send-keys&lt;/code&gt;.&lt;/p&gt;
&lt;h4 id=&quot;send-keys&quot;&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;send-keys&lt;/code&gt;&lt;/h4&gt;
&lt;h4 id=&quot;send-keys&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;send-keys&lt;/code&gt;&lt;/h4&gt;
&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;send-keys&lt;/code&gt; allows you to send text, and key presses to a &lt;code class=&quot;highlighter-rouge&quot;&gt;tmux&lt;/code&gt; session.
Now assuming this &lt;code class=&quot;highlighter-rouge&quot;&gt;tmux&lt;/code&gt; session is attached to a Minecraft server,
&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;send-keys&lt;/code&gt; allows you to send text, and key presses to a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tmux&lt;/code&gt; session.
Now assuming this &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tmux&lt;/code&gt; session is attached to a Minecraft server,
there is no reason you could not run a command like this:&lt;/p&gt;
&lt;pre class=&quot;terminal&quot;&gt;
@ -462,9 +462,9 @@ Then, it will hit the newline character, this will execute the command.&lt;/p&gt
&lt;p&gt;But how do we get information about who is typing what in the Minecraft chat?&lt;/p&gt;
&lt;h3 id=&quot;tmuxs-capture-pane-is-painful&quot;&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;tmux&lt;/code&gt;s &lt;code class=&quot;highlighter-rouge&quot;&gt;capture-pane&lt;/code&gt; is painful&lt;/h3&gt;
&lt;h3 id=&quot;tmuxs-capture-pane-is-painful&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tmux&lt;/code&gt;s &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;capture-pane&lt;/code&gt; is painful&lt;/h3&gt;
&lt;p&gt;So in the manual page for &lt;code class=&quot;highlighter-rouge&quot;&gt;tmux&lt;/code&gt; I can see a section recorded below for options I can give to the &lt;code class=&quot;highlighter-rouge&quot;&gt;capture-pane&lt;/code&gt; subcommand.&lt;/p&gt;
&lt;p&gt;So in the manual page for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tmux&lt;/code&gt; I can see a section recorded below for options I can give to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;capture-pane&lt;/code&gt; subcommand.&lt;/p&gt;
&lt;pre class=&quot;terminal&quot;&gt;
-S and -E specify the starting and ending line numbers,
@ -474,10 +474,10 @@ Then, it will hit the newline character, this will execute the command.&lt;/p&gt
default is to capture only the visible contents of the pane.
&lt;/pre&gt;
&lt;p&gt;What it seems to be saying is I can start at line &lt;code class=&quot;highlighter-rouge&quot;&gt;-S n&lt;/code&gt; and end at line &lt;code class=&quot;highlighter-rouge&quot;&gt;-E n&lt;/code&gt;.
Negative numbers start from the bottom, so &lt;em&gt;in theory&lt;/em&gt; I can do the following: &lt;code class=&quot;highlighter-rouge&quot;&gt;tmux capture-pane -S -1&lt;/code&gt; should capture only the last line, because Im starting from the last line. Right?&lt;/p&gt;
&lt;p&gt;What it seems to be saying is I can start at line &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-S n&lt;/code&gt; and end at line &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-E n&lt;/code&gt;.
Negative numbers start from the bottom, so &lt;em&gt;in theory&lt;/em&gt; I can do the following: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tmux capture-pane -S -1&lt;/code&gt; should capture only the last line, because Im starting from the last line. Right?&lt;/p&gt;
&lt;p&gt;No. It just doesnt work. Negative numbers do &lt;em&gt;not&lt;/em&gt; work with the &lt;code class=&quot;highlighter-rouge&quot;&gt;tmux capture-pane&lt;/code&gt; subcommand.&lt;/p&gt;
&lt;p&gt;No. It just doesnt work. Negative numbers do &lt;em&gt;not&lt;/em&gt; work with the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;tmux capture-pane&lt;/code&gt; subcommand.&lt;/p&gt;
&lt;p&gt;So I did some simple UNIX piping, like so, to get just the last thing in the chat.&lt;/p&gt;
@ -487,19 +487,19 @@ $ tmux capture-pane -p -t steve | tail -n1
&lt;/pre&gt;
&lt;p&gt;TaterTheTot is my Minecraft username :)&lt;/p&gt;
&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;-p&lt;/code&gt; prints the result to the terminal/stdout.&lt;/p&gt;
&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-p&lt;/code&gt; prints the result to the terminal/stdout.&lt;/p&gt;
&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;steve&lt;/code&gt; is the name of the tmux session Im trying to pull form.&lt;/p&gt;
&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;steve&lt;/code&gt; is the name of the tmux session Im trying to pull form.&lt;/p&gt;
&lt;p&gt;So thats done! Beauty!&lt;/p&gt;
&lt;p&gt;Now that we have that, how can we extract the username and the message from the latest line?&lt;/p&gt;
&lt;h3 id=&quot;grep&quot;&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;grep&lt;/code&gt;&lt;/h3&gt;
&lt;h3 id=&quot;grep&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;grep&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;grep&lt;/code&gt; is a command to find patterns of text.
&lt;code class=&quot;highlighter-rouge&quot;&gt;grep&lt;/code&gt; has an option to only show a matching pattern of text.
This option is &lt;code class=&quot;highlighter-rouge&quot;&gt;-o&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;grep&lt;/code&gt; is a command to find patterns of text.
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;grep&lt;/code&gt; has an option to only show a matching pattern of text.
This option is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-o&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Lets see how we can use this in conjunction with our latest line of server output to get our results.&lt;/p&gt;
@ -509,11 +509,11 @@ $ echo &quot;[DEBUG] [SERVER] blah blah: &amp;lt;TaterTheTot&amp;gt; MY_MESAGE&q
&lt;/pre&gt;
&lt;p&gt;Now, thats my name with the &amp;lt; and &amp;gt; attached. Not bad!
We can use the &lt;code class=&quot;highlighter-rouge&quot;&gt;sed&lt;/code&gt; command to clean it up a bit.&lt;/p&gt;
We can use the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sed&lt;/code&gt; command to clean it up a bit.&lt;/p&gt;
&lt;p&gt;The syntax is like so: &lt;code class=&quot;highlighter-rouge&quot;&gt;select/somepattern/replacewith/global&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;The syntax is like so: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;select/somepattern/replacewith/global&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;So the following command is: &lt;code class=&quot;highlighter-rouge&quot;&gt;s/[&amp;lt;&amp;gt;]//g&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;So the following command is: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;s/[&amp;lt;&amp;gt;]//g&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Select any characters that are either &amp;lt; or &amp;gt;.
Replace with nothing.
@ -530,7 +530,7 @@ TaterTheTot
&lt;p&gt;Now what about that pesky message?&lt;/p&gt;
&lt;h3 id=&quot;more-grep-more-sed&quot;&gt;more &lt;code class=&quot;highlighter-rouge&quot;&gt;grep&lt;/code&gt;; more &lt;code class=&quot;highlighter-rouge&quot;&gt;sed&lt;/code&gt;&lt;/h3&gt;
&lt;h3 id=&quot;more-grep-more-sed&quot;&gt;more &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;grep&lt;/code&gt;; more &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sed&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;Simple: capture everything after the &amp;gt;. Leaving the users message entirely in tact.&lt;/p&gt;
@ -553,11 +553,11 @@ And, we have a way to respond.&lt;/p&gt;
&lt;p&gt;Remember to checkout the git repository to see what I did with it: &lt;a href=&quot;https://github.com/TTWNO/termcraft&quot;&gt;https://github.com/TTWNO/termcraft&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Happy hacking!&lt;/p&gt;</content><author><name></name></author><summary type="html">So recently I had problem. I run a Minecraft server on a big Linux computer I have running in my room. Now, as a system administrator it is very helpful to be able to run some simple commands without needing to login with my key, password, TFA, etc. It is, frankly, a lot of work. Especially when I really just want to be playing games but I just need to check something quickly.</summary></entry><entry><title type="html">Site Update</title><link href="http://192.168.1.101:4000/2020/06/04/site-update.html" rel="alternate" type="text/html" title="Site Update" /><published>2020-06-04T00:00:00+00:00</published><updated>2020-06-04T00:00:00+00:00</updated><id>http://192.168.1.101:4000/2020/06/04/site-update</id><content type="html" xml:base="http://192.168.1.101:4000/2020/06/04/site-update.html">&lt;p&gt;I updated the site with some easier to identify information about me and my projects :)&lt;/p&gt;
&lt;p&gt;Happy hacking!&lt;/p&gt;</content><author><name></name></author><summary type="html">So recently I had problem. I run a Minecraft server on a big Linux computer I have running in my room. Now, as a system administrator it is very helpful to be able to run some simple commands without needing to login with my key, password, TFA, etc. It is, frankly, a lot of work. Especially when I really just want to be playing games but I just need to check something quickly.</summary></entry><entry><title type="html">Site Update</title><link href="http://localhost:4000/2020/06/04/site-update.html" rel="alternate" type="text/html" title="Site Update" /><published>2020-06-04T00:00:00+00:00</published><updated>2020-06-04T00:00:00+00:00</updated><id>http://localhost:4000/2020/06/04/site-update</id><content type="html" xml:base="http://localhost:4000/2020/06/04/site-update.html">&lt;p&gt;I updated the site with some easier to identify information about me and my projects :)&lt;/p&gt;
&lt;p&gt;Also, Clue has been delayed due to my partner in crime on the project wokring too many hours.&lt;/p&gt;
&lt;p&gt;I also posted a new project called &lt;em&gt;&lt;a href=&quot;https://github.com/TTWNO/caesar-cipher&quot;&gt;Caesar Cipher&lt;/a&gt;&lt;/em&gt; in C. It will be an intermediate example of how to use build systems like &lt;code class=&quot;highlighter-rouge&quot;&gt;make&lt;/code&gt;.&lt;/p&gt;</content><author><name></name></author><summary type="html">I updated the site with some easier to identify information about me and my projects :)</summary></entry><entry><title type="html">New Game: Clue (coming soon)</title><link href="http://192.168.1.101:4000/2020/05/19/clue-announcement.html" rel="alternate" type="text/html" title="New Game: Clue (coming soon)" /><published>2020-05-19T00:00:00+00:00</published><updated>2020-05-19T00:00:00+00:00</updated><id>http://192.168.1.101:4000/2020/05/19/clue-announcement</id><content type="html" xml:base="http://192.168.1.101:4000/2020/05/19/clue-announcement.html">&lt;p&gt;Ooo! Exciting!
&lt;p&gt;I also posted a new project called &lt;em&gt;&lt;a href=&quot;https://github.com/TTWNO/caesar-cipher&quot;&gt;Caesar Cipher&lt;/a&gt;&lt;/em&gt; in C. It will be an intermediate example of how to use build systems like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;make&lt;/code&gt;.&lt;/p&gt;</content><author><name></name></author><summary type="html">I updated the site with some easier to identify information about me and my projects :)</summary></entry><entry><title type="html">New Game: Clue (coming soon)</title><link href="http://localhost:4000/2020/05/19/clue-announcement.html" rel="alternate" type="text/html" title="New Game: Clue (coming soon)" /><published>2020-05-19T00:00:00+00:00</published><updated>2020-05-19T00:00:00+00:00</updated><id>http://localhost:4000/2020/05/19/clue-announcement</id><content type="html" xml:base="http://localhost:4000/2020/05/19/clue-announcement.html">&lt;p&gt;Ooo! Exciting!
Today I want to announce a new project Ill be working on which should be live within the month of May:
Clue.&lt;/p&gt;

@ -38,7 +38,7 @@
<p><strong>Dartmouth College (Open Corseware)</strong>—Professional Certificate / <em>C Programming with Linux</em> (2020)</p>
<p>A certification in C programming, the <code class="highlighter-rouge">gcc</code> compiler, and the <code class="highlighter-rouge">make</code> compilation system.</p>
<p>A certification in C programming, the <code class="language-plaintext highlighter-rouge">gcc</code> compiler, and the <code class="language-plaintext highlighter-rouge">make</code> compilation system.</p>
<h3 id="projects">Projects</h3>

@ -1 +1 @@
Sitemap: http://192.168.1.101:4000/sitemap.xml
Sitemap: http://localhost:4000/sitemap.xml

@ -1,112 +1,112 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>http://192.168.1.101:4000/2020/01/22/padding-and-margin.html</loc>
<loc>http://localhost:4000/2020/01/22/padding-and-margin.html</loc>
<lastmod>2020-01-22T00:00:00+00:00</lastmod>
</url>
<url>
<loc>http://192.168.1.101:4000/2020/01/26/rsa1.html</loc>
<loc>http://localhost:4000/2020/01/26/rsa1.html</loc>
<lastmod>2020-01-26T00:00:00+00:00</lastmod>
</url>
<url>
<loc>http://192.168.1.101:4000/2020/02/19/rsa2.html</loc>
<loc>http://localhost:4000/2020/02/19/rsa2.html</loc>
<lastmod>2020-02-19T00:00:00+00:00</lastmod>
</url>
<url>
<loc>http://192.168.1.101:4000/2020/04/02/rsa3.html</loc>
<loc>http://localhost:4000/2020/04/02/rsa3.html</loc>
<lastmod>2020-04-02T00:00:00+00:00</lastmod>
</url>
<url>
<loc>http://192.168.1.101:4000/2020/04/06/rsa4.html</loc>
<loc>http://localhost:4000/2020/04/06/rsa4.html</loc>
<lastmod>2020-04-06T00:00:00+00:00</lastmod>
</url>
<url>
<loc>http://192.168.1.101:4000/2020/04/12/nas1.html</loc>
<loc>http://localhost:4000/2020/04/12/nas1.html</loc>
<lastmod>2020-04-12T00:00:00+00:00</lastmod>
</url>
<url>
<loc>http://192.168.1.101:4000/2020/04/21/rfi.html</loc>
<loc>http://localhost:4000/2020/04/21/rfi.html</loc>
<lastmod>2020-04-21T00:00:00+00:00</lastmod>
</url>
<url>
<loc>http://192.168.1.101:4000/2020/04/25/xss.html</loc>
<loc>http://localhost:4000/2020/04/25/xss.html</loc>
<lastmod>2020-04-25T00:00:00+00:00</lastmod>
</url>
<url>
<loc>http://192.168.1.101:4000/2020/05/01/nginx-socket-io-projects.html</loc>
<loc>http://localhost:4000/2020/05/01/nginx-socket-io-projects.html</loc>
<lastmod>2020-05-01T00:00:00+00:00</lastmod>
</url>
<url>
<loc>http://192.168.1.101:4000/2020/05/19/clue-announcement.html</loc>
<loc>http://localhost:4000/2020/05/19/clue-announcement.html</loc>
<lastmod>2020-05-19T00:00:00+00:00</lastmod>
</url>
<url>
<loc>http://192.168.1.101:4000/2020/06/04/site-update.html</loc>
<loc>http://localhost:4000/2020/06/04/site-update.html</loc>
<lastmod>2020-06-04T00:00:00+00:00</lastmod>
</url>
<url>
<loc>http://192.168.1.101:4000/2020/06/25/tmux-minecraft.html</loc>
<loc>http://localhost:4000/2020/06/25/tmux-minecraft.html</loc>
<lastmod>2020-06-25T00:00:00+00:00</lastmod>
</url>
<url>
<loc>http://192.168.1.101:4000/2020/07/12/independence.html</loc>
<loc>http://localhost:4000/2020/07/12/independence.html</loc>
<lastmod>2020-07-12T00:00:00+00:00</lastmod>
</url>
<url>
<loc>http://192.168.1.101:4000/2020/07/19/multicraft-php-gentoo.html</loc>
<loc>http://localhost:4000/2020/07/19/multicraft-php-gentoo.html</loc>
<lastmod>2020-07-19T00:00:00+00:00</lastmod>
</url>
<url>
<loc>http://192.168.1.101:4000/2020/07/30/canadian-parliament.html</loc>
<loc>http://localhost:4000/2020/07/30/canadian-parliament.html</loc>
<lastmod>2020-07-30T00:00:00+00:00</lastmod>
</url>
<url>
<loc>http://192.168.1.101:4000/2020/08/15/openbsd1.html</loc>
<loc>http://localhost:4000/2020/08/15/openbsd1.html</loc>
<lastmod>2020-08-15T00:00:00+00:00</lastmod>
</url>
<url>
<loc>http://192.168.1.101:4000/2020/08/18/django-deployment.html</loc>
<loc>http://localhost:4000/2020/08/18/django-deployment.html</loc>
<lastmod>2020-08-18T00:00:00+00:00</lastmod>
</url>
<url>
<loc>http://192.168.1.101:4000/2020/09/09/lamegames.html</loc>
<loc>http://localhost:4000/2020/09/09/lamegames.html</loc>
<lastmod>2020-09-09T00:00:00+00:00</lastmod>
</url>
<url>
<loc>http://192.168.1.101:4000/2020/09/12/minesweeper.html</loc>
<loc>http://localhost:4000/2020/09/12/minesweeper.html</loc>
<lastmod>2020-09-12T00:00:00+00:00</lastmod>
</url>
<url>
<loc>http://192.168.1.101:4000/2020-04-27-quiz-your-friends-xss.html</loc>
<loc>http://localhost:4000/2020-04-27-quiz-your-friends-xss.html</loc>
</url>
<url>
<loc>http://192.168.1.101:4000/blog/</loc>
<loc>http://localhost:4000/blog/</loc>
</url>
<url>
<loc>http://192.168.1.101:4000/tutoring/</loc>
<loc>http://localhost:4000/tutoring/</loc>
</url>
<url>
<loc>http://192.168.1.101:4000/cover-letters/bloombase/</loc>
<loc>http://localhost:4000/cover-letters/bloombase/</loc>
</url>
<url>
<loc>http://192.168.1.101:4000/resume/</loc>
<loc>http://localhost:4000/resume/</loc>
</url>
<url>
<loc>http://192.168.1.101:4000/links/</loc>
<loc>http://localhost:4000/links/</loc>
</url>
<url>
<loc>http://192.168.1.101:4000/cover-letter-vcc/</loc>
<loc>http://localhost:4000/cover-letter-vcc/</loc>
</url>
<url>
<loc>http://192.168.1.101:4000/contact/</loc>
<loc>http://localhost:4000/contact/</loc>
</url>
<url>
<loc>http://192.168.1.101:4000/about/</loc>
<loc>http://localhost:4000/about/</loc>
</url>
<url>
<loc>http://192.168.1.101:4000/scholarships/2020/cnib/</loc>
<loc>http://localhost:4000/scholarships/2020/cnib/</loc>
</url>
<url>
<loc>http://192.168.1.101:4000/</loc>
<loc>http://localhost:4000/</loc>
</url>
</urlset>

Loading…
Cancel
Save