You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

694 lines
59 KiB

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<?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>2021-03-12T11:43:42-07:00</updated><id>http://localhost:4000/feed.xml</id><entry><title type="html">Lichess Accessibility</title><link href="http://localhost:4000/2021/01/31/lichess/" rel="alternate" type="text/html" title="Lichess Accessibility" /><published>2021-01-31T00:00:00-07:00</published><updated>2021-01-31T00:00:00-07:00</updated><id>http://localhost:4000/2021/01/31/lichess</id><content type="html" xml:base="http://localhost:4000/2021/01/31/lichess/">&lt;p&gt;I wanted to play chess with somebody who used a screen reader, without requiring a screen reader myself;
some sites, like QuintenCs Playroom have a rather poor visual interface for anyone who would like the play the game visually.
&lt;a href=&quot;https://lichess.org&quot;&gt;Lichess&lt;/a&gt; is an free and open-source website for chess players;
it bridges this gap by having two “modes” on the site:
standard mode and accessibility mode.&lt;/p&gt;
&lt;h2 id=&quot;accessibility-mode&quot;&gt;Accessibility Mode&lt;/h2&gt;
&lt;p&gt;Accessibility mode is far from perfect on lichess.org.
That said, the idea to separate the sites into different modes was a good call.
It stops the inevitable “this would work well for screen readers but cause visual issues” shenanigans,
or, vice-verse “this looks great but it might be weird with a screen reader”.
This way all the things which affect the visual interface are in one place,
and all things which affect the non-visual user interface (NVUI) are written in another.&lt;/p&gt;
&lt;p&gt;In my quest to play chess with visual and non-visual players with both having optimal experiences, I tried Lichess with my friend from &lt;a href=&quot;https://melly.tech/&quot;&gt;melly.tech&lt;/a&gt;.
She pointed out that the method to interface with the board previously was rather poor.
This is because it required an “enter” at the end of each command and the commands tended to read out a row or column of a chessboard not just an individual square.&lt;/p&gt;
&lt;p&gt;For example, to list all pieces (or lack thereof) on the e file, I would type the command:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;s e
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Although this seems good in theory, and its great when you need an entire file, there was no way to get only one square.
In addition, imagine typing to navigate around the board:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;s e1
s f1
s e2
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;For the inexperienced player, it seems to be more convenient to bind some keys and have the user bounce to various buttons, which they can push to say “I want to move this piece”.
This is what I was told anyway.
So I want to work making a system so you could use the following basic keys:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;left/right/up/down arrow: move on the board.&lt;/li&gt;
&lt;li&gt;k/q/r/b/n/p: move to next piece represented by its character in chess notation.&lt;/li&gt;
&lt;li&gt;shift + k/q/r/b/n/p: move back to the last piece represented by its character in chess notation.&lt;/li&gt;
&lt;li&gt;click/enter/space: select piece to move.&lt;/li&gt;
&lt;li&gt;click/enter/space again: move piece here.&lt;/li&gt;
&lt;li&gt;m: show where I can move with this piece.&lt;/li&gt;
&lt;li&gt;shift+m: show where I can capture with this piece.&lt;/li&gt;
&lt;li&gt;1-8: move to rank 1-8; stay on same file.&lt;/li&gt;
&lt;li&gt;shift + 1-8: move to file a-h; stay on same rank.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This gives a pretty solid basis for playing the game.
One caveat is after you have moved a pawn all the way to the farthest rank, only the destination tile will accept your promotion choice.
Therefore, all the other keys still work on other square, but if you are on the destination square of a promotion q/r/b/n will promote your piece, not jump you to the next/previous one.&lt;/p&gt;
&lt;p&gt;This pull request was merged earlier this month:&lt;/p&gt;
&lt;h2 id=&quot;more-to-come&quot;&gt;More To Come&lt;/h2&gt;
&lt;p&gt;Next thing I want to do is implement the analysis board.
Right now it is not accessible whatsoever.&lt;/p&gt;
&lt;h2 id=&quot;help-me&quot;&gt;Help Me&lt;/h2&gt;
&lt;p&gt;If you are a screen reader user or know about accessibility and want to help make Lichess an awesome chess site for sighted and unsighted players alike,
then send me an email at &lt;a href=&quot;mailto:tait@tait.tech&quot;&gt;tait@tait.tech&lt;/a&gt; and Ill BCC you once I start testing the analysis board.&lt;/p&gt;
&lt;p&gt;Happy hacking, yall!&lt;/p&gt;</content><author><name></name></author><summary type="html">I wanted to play chess with somebody who used a screen reader, without requiring a screen reader myself; some sites, like QuintenCs Playroom have a rather poor visual interface for anyone who would like the play the game visually. Lichess is an free and open-source website for chess players; it bridges this gap by having two “modes” on the site: standard mode and accessibility mode.</summary></entry><entry><title type="html">How to Deploy Lichesss Lila With Nginx</title><link href="http://localhost:4000/2020/12/20/deploy-lichess/" rel="alternate" type="text/html" title="How to Deploy Lichesss Lila With Nginx" /><published>2020-12-20T00:00:00-07:00</published><updated>2020-12-20T00:00:00-07:00</updated><id>http://localhost:4000/2020/12/20/deploy-lichess</id><content type="html" xml:base="http://localhost:4000/2020/12/20/deploy-lichess/">&lt;p&gt;I was getting ready to have a public test of some changes I made to &lt;a href=&quot;https://lichess.org&quot;&gt;lichess.org&lt;/a&gt;s &lt;a href=&quot;https://lichess.org/source&quot;&gt;open source chess platform&lt;/a&gt;.
In preperation, I got my Lets Encrypt certificates and nginx configurations setup…
and it wouldnt work.
Here are some tips for myself and future Lichess developers.&lt;/p&gt;
&lt;h2 id=&quot;reasoning&quot;&gt;Reasoning&lt;/h2&gt;
&lt;p&gt;My pull request involves accessibility.
It will extend Lichesss NVUI (Non-Visual User Interface) to be more accessible to beginner level chess players.
At the time of writing this, Lichesss NVUI only supports searching pieces by type, rank and file.
It does not support any kind of interactive board.&lt;/p&gt;
&lt;p&gt;I wanted to play chess with a friend of mine who uses a screen reader.
Even though Lichess does indeed have a separate rendering of the page for visually impaired users,
I have heard from a few people that it is not the best.&lt;/p&gt;
&lt;p&gt;I dont use a screen reader myself, so I thought having a public latest changes deployed server would work better for testing.
It would certainly work better than getting some of my less computer literate friends to connect to me via VSCode/VPN and view my local repository.&lt;/p&gt;
&lt;p&gt;So here is how to deploy it:&lt;/p&gt;
&lt;h2 id=&quot;setup-a-development-environment&quot;&gt;Setup a development environment&lt;/h2&gt;
&lt;p&gt;This is described &lt;a href=&quot;https://github.com/ornicar/lila/wiki/Lichess-Development-Onboarding&quot;&gt;in Lichesss documentation itself&lt;/a&gt;.
I will not elaborate further as it is not necessary.&lt;/p&gt;
&lt;h2 id=&quot;setup-nginx&quot;&gt;Setup nginx&lt;/h2&gt;
&lt;p&gt;This is the part that stumps most people.
Getting a local development server usually works alright, but once you want to reverse proxy it for security and professionalism purposes, it get more interesting.&lt;/p&gt;
&lt;p&gt;Here is the relevant portion of my nginx configuration for lila:&lt;/p&gt;
&lt;pre class=&quot;file&quot;&gt;
server_name chess.tait.tech;
location / {
proxy_pass http://127.0.0.1:9663;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
proxy_set_header X-Real-IP $remote_addr;
}
&lt;/pre&gt;
&lt;p&gt;This is the config for the lila-ws websocket subdomain:&lt;/p&gt;
&lt;pre class=&quot;file&quot;&gt;
server_name ws.chess.tait.tech;
location / {
proxy_pass http://127.0.0.1:9664;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection &quot;upgrade&quot;;
}
&lt;/pre&gt;
&lt;p&gt;You will need to deploy these on two virtual hosts.&lt;/p&gt;
&lt;h2 id=&quot;lila&quot;&gt;Lila&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/ornicar/lila/&quot;&gt;Lila&lt;/a&gt; is the name for the main chess server, we need to change a few settings. Here is my git diff for the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;conf/base.conf&lt;/code&gt; file:&lt;/p&gt;
&lt;pre class=&quot;file&quot;&gt;
- domain = &quot;localhost:9663&quot;
- socket.domains = [ &quot;localhost:9664&quot; ]
+ domain = &quot;chess.tait.tech&quot;
+ socket.domains = [ &quot;ws.chess.tait.tech&quot; ]
asset.domain = ${net.domain}
- asset.base_url = &quot;http://&quot;${net.asset.domain}
+ asset.base_url = &quot;https://&quot;${net.asset.domain}
asset.minified = false
- base_url = &quot;http://&quot;${net.domain}
+ base_url = &quot;https://&quot;${net.domain}
&lt;/pre&gt;
&lt;h3 id=&quot;lila-ws&quot;&gt;Lila-ws&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/ornicar/lila-ws/&quot;&gt;Lila-ws&lt;/a&gt; is the websocket component of Lila.&lt;/p&gt;
&lt;p&gt;The most common complaint amongst aspiring Lichess developers is websockets not working.
They constantly get these 101 responses from the websocket,
and it also seems that the websocket returns instead of staying in the pending state as it should be.&lt;/p&gt;
&lt;p&gt;Here is how to fix that (in diff format):&lt;/p&gt;
&lt;pre class=&quot;file&quot;&gt;
-csrf.origin = &quot;http://127.0.0.1:9000&quot;
+csrf.origin = &quot;https://chess.tait.tech&quot;
&lt;/pre&gt;
&lt;p&gt;You need to tell lila-ws where the websocket requests will be coming from. This is how to do that.&lt;/p&gt;
&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;This is not a long article, but just some notes for future me and Lila developers.&lt;/p&gt;</content><author><name></name></author><summary type="html">I was getting ready to have a public test of some changes I made to lichess.orgs open source chess platform. In preperation, I got my Lets Encrypt certificates and nginx configurations setup… and it wouldnt work. Here are some tips for myself and future Lichess developers.</summary></entry><entry><title type="html">Getting Pacaur Working on a Raspberry Pi 4 with Manjaro ARM or Arch Linux</title><link href="http://localhost:4000/2020/12/01/pacaur-rpi/" rel="alternate" type="text/html" title="Getting Pacaur Working on a Raspberry Pi 4 with Manjaro ARM or Arch Linux" /><published>2020-12-01T00:00:00-07:00</published><updated>2020-12-01T00:00:00-07:00</updated><id>http://localhost:4000/2020/12/01/pacaur-rpi</id><content type="html" xml:base="http://localhost:4000/2020/12/01/pacaur-rpi/">&lt;p&gt;I recently installed Manjaro ARM (based on Arch Linux ARM) on a Raspberry Pi 4.
I used some standard commands to start to add the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pacaur&lt;/code&gt; package so I can easily retrieve &lt;a href=&quot;https://wiki.archlinux.org/index.php/Arch_User_Repository&quot;&gt;AUR packages&lt;/a&gt; without needing to do it manually.
Unfortunately, there is a small problem with compiling this on ARM.&lt;/p&gt;
&lt;h2 id=&quot;always_inline&quot;&gt;always_inline&lt;/h2&gt;
&lt;p&gt;To setup the install for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pacaur&lt;/code&gt;, I first needed to download &lt;a href=&quot;https://aur.archlinux.org/packages/auracle-git&quot;&gt;auracle-git&lt;/a&gt; AUR package manually.
I ran into an error when compiling this package.&lt;/p&gt;
&lt;p&gt;But first, my setup:&lt;/p&gt;
&lt;pre class=&quot;terminal&quot;&gt;
$ git clone https://aur.archlinux.org/auracle-git
$ cd auracle-git
$ makepkg -sri
&lt;/pre&gt;
&lt;p&gt;Around half way through compiling this project, I got this cryptic message telling me there was a “target specific option mismatch”…Whatever that means.
The full error is below, hopefully that helps my chances on the search engines.&lt;/p&gt;
&lt;pre class=&quot;terminal&quot;&gt;
In file included from ../subprojects/abseil-cpp-20200225.2/absl/random/internal/randen_hwaes.cc:225:
/usr/lib/gcc/aarch64-unknown-linux-gnu/9.3.0/include/arm_neon.h: In function 'Vector128 {anonymous}::AesRound(const Vector128&amp;amp;, const Vector128&amp;amp;)':
/usr/lib/gcc/aarch64-unknown-linux-gnu/9.3.0/include/arm_neon.h:12452:1: error: inlining failed in call to always_inline 'uint8x16_t vaesmcq_u8(uint8x16_t)': target specific option mismatch
12452 | vaesmcq_u8 (uint8x16_t data)
&lt;/pre&gt;
&lt;p&gt;Luckily, there is a very easy fix for this.
The user redfish &lt;a href=&quot;https://aur.archlinux.org/packages/auracle-git#comment-762117&quot;&gt;helpfully pointed out&lt;/a&gt;
on the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;auracle-git&lt;/code&gt; package page that you need to add a special make option to your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/make.conf&lt;/code&gt; file to make this work.&lt;/p&gt;
&lt;p&gt;His solution, as commented is like so:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;If you get this error when building for ARM aarch64:&lt;/p&gt;
&lt;p&gt;(insert error message from before)&lt;/p&gt;
&lt;p&gt;Then check that in /etc/makepkg.conf CFLAGS and CXXFLAGS have the +crypto suffix in -march flag, like -march=armv8-a+crypto (the base identifier may very depending on your hardware)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Basically, there is a file on Linux: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/makepkg.conf&lt;/code&gt; which tells your computer how to compile &lt;em&gt;all&lt;/em&gt; programs on the system.
By default the Manjaro ARM (RPi4) edition has the following relevant lines in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;makepkg.conf&lt;/code&gt;.&lt;/p&gt;
&lt;pre class=&quot;file&quot;&gt;
CFLAGS=&quot;-march=armv8-a -O2 -pipe -fstack-protector-strong -fno-plt&quot;
CXXFLAGS=&quot;-march=armv8-a -O2 -pipe -fstack-protector-strong -fno-plt&quot;
&lt;/pre&gt;
&lt;p&gt;What Mr. redfish is telling us is that we must add +crypto to the end of the -march compiler flag so that our compiler will know how to inline that pesky vaesmcq_u8 function.&lt;/p&gt;
&lt;p&gt;So in the end, your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;makepkg.conf&lt;/code&gt;s relevant lines will look like so:&lt;/p&gt;
&lt;pre class=&quot;file&quot;&gt;
CFLAGS=&quot;-march=armv8-a+crypto -O2 -pipe -fstack-protector-strong -fno-plt&quot;
CXXFLAGS=&quot;-march=armv8-a+crypto -O2 -pipe -fstack-protector-strong -fno-plt&quot;
&lt;/pre&gt;
&lt;h2 id=&quot;why&quot;&gt;Why?&lt;/h2&gt;
&lt;p&gt;Redfish continues:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Build of abseil-cpp package works because it uses CMake which adds the correct -march flag regardless of makepkg.conf, whereas when abseil-cpp is build as a subproject within this package, it uses meson, which does not add the flag and thus fails with the above error.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;In other words, one of the dependencies pulled in with auracle is not compiling without this special compiler flag enabled.&lt;/p&gt;
&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;Thanks to redfish for posting this solution to the forums!
Wouldve been quite the rabbit hole for me to figure out how to do that.
In fact, it is very likely I would have never figured that one out.&lt;/p&gt;
&lt;p&gt;After this issue is resolved, the installation of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pacaur&lt;/code&gt; goes as expected. Nice and easy!
Pacuar will compile on any architecture so its smooth sailing from here.&lt;/p&gt;
&lt;p&gt;Happy hacking!&lt;/p&gt;</content><author><name></name></author><summary type="html">I recently installed Manjaro ARM (based on Arch Linux ARM) on a Raspberry Pi 4. I used some standard commands to start to add the pacaur package so I can easily retrieve AUR packages without needing to do it manually. Unfortunately, there is a small problem with compiling this on ARM.</summary></entry><entry><title type="html">ZFS NAS Box, Part 2</title><link href="http://localhost:4000/2020/11/15/nas2/" rel="alternate" type="text/html" title="ZFS NAS Box, Part 2" /><published>2020-11-15T00:00:00-07:00</published><updated>2020-11-15T00:00:00-07:00</updated><id>http://localhost:4000/2020/11/15/nas2</id><content type="html" xml:base="http://localhost:4000/2020/11/15/nas2/">&lt;p&gt;Back in &lt;a href=&quot;/2020/04/12/nas1/&quot;&gt;part one of my NAS project&lt;/a&gt; I discussed how I wanted to set up my hardware.
Today, I set up the NAS (almost).&lt;/p&gt;
&lt;p&gt;There were some hiccup along the way, like learning that M.2 slots can disable some of your SATA ports or waiting a month for a host bus adapter to come in from China.&lt;/p&gt;
&lt;h2 id=&quot;why-did-it-take-so-long&quot;&gt;Why Did It Take So Long&lt;/h2&gt;
&lt;p&gt;So it turns out I was going to spend a lot more on this project than I originally anticipated.
I ended up getting a server machine instead of a sleek NAS box.
Here are some of the quick specs:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Standard ATX case by Thermaltake.&lt;/li&gt;
&lt;li&gt;LSI 9211-8i.&lt;/li&gt;
&lt;li&gt;The cheapest HDMI graphics card I could find on Kijiji.&lt;/li&gt;
&lt;li&gt;6x 3TB Segate HDDs.&lt;/li&gt;
&lt;li&gt;1x 250G Kingston SSD.&lt;/li&gt;
&lt;li&gt;AMD Ryzen 5 3600.&lt;/li&gt;
&lt;li&gt;MSI B450 Gaming Plus Max.&lt;/li&gt;
&lt;li&gt;2x 8GB FlareX 3200Mhz RAM.&lt;/li&gt;
&lt;li&gt;1x 16GB Kingston 3200Mhz RAM.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;zfs&quot;&gt;ZFS&lt;/h2&gt;
&lt;p&gt;This is how I decided to configure my storage pools.
In hindsight, this was not the best choice for upgrading.
I may change it in the future to a 0+1 setup, but it works for now.&lt;/p&gt;
&lt;p&gt;I have 5x 3TB in a RAIDZ2 with one drive not attached for redundancys sake.
How does one setup a ZFS pool. Check this out:&lt;/p&gt;
&lt;pre class=&quot;terminal&quot;&gt;
# zpool create poolname raidz2 \
/dev/by-id/blahblahblah1 \
/dev/by-id/blahblahblah2 \
/dev/by-id/blahblahblah3 \
/dev/by-id/blahblahblah4 \
/dev/by-id/blahblahblah5
&lt;/pre&gt;
&lt;p&gt;And zippidy-doo! Weve got a ZFS pool!
We can check its status with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;zpool status&lt;/code&gt;.&lt;/p&gt;
&lt;pre class=&quot;terminal&quot;&gt;
$ zfs status
pool: raid
state: ONLINE
scan: scrub in progress since Wed Nov 18 18:41:41 2020
1.84T scanned at 8.51G/s, 121G issued at 562M/s, 1.84T total
0B repaired, 6.45% done, 0 days 00:53:25 to go
config:
NAME STATE READ WRITE CKSUM
raid ONLINE 0 0 0
raidz2-0 ONLINE 0 0 0
ata-HGST_HUS724030ALA640_PN2234P8JTNMYY ONLINE 0 0 0
ata-HGST_HUS724030ALA640_PN2234P8JVSXTY ONLINE 0 0 0
ata-HGST_HUS724030ALA640_PN2234P8JXAS8Y ONLINE 0 0 0
ata-HGST_HUS724030ALA640_PN2234P8JXBARY ONLINE 0 0 0
ata-HGST_HUS724030ALA640_PN2234P8JXP77Y ONLINE 0 0 0
errors: No known data errors
&lt;/pre&gt;
&lt;p&gt;I had run a scrub right before this, so theres some extra detail in that.
This is really fun! I will be doing more home storage projects soon.
Perhaps Raspberry Pi NAS using all 4 USB ports to load SATA drives on it.
Now that would be fun!&lt;/p&gt;
&lt;h2 id=&quot;so-i-kinda-have-a-nas-now&quot;&gt;So I Kinda Have A NAS Now…?&lt;/h2&gt;
&lt;p&gt;So right now I can only copy files with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;rsync&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;scp&lt;/code&gt; and moving data via a physical drive.
The one major disadvantage this has is speed.&lt;/p&gt;
&lt;p&gt;Due to this machine being connected directly outside my network and pulling DHCP like a normal router would, I need to send my data through the WAN connection to get my files to it.
This is rather unfortunate as my upload speed is capped at 20 megabits per second, despite my upload being in the 300+ range.&lt;/p&gt;
&lt;p&gt;Part 3 will involve a LAN card so I can connect both to the DHCP server of my ISP and my local router.
This way my transfer speeds should be in the range of 1 gigabit per second.
This will make my life much easier, at least on the local network.&lt;/p&gt;
&lt;h2 id=&quot;fun-fact&quot;&gt;Fun Fact!&lt;/h2&gt;
&lt;p&gt;Do not try to use the M.2 slot on a consumer motherboard where you are also using all the SATA ports.
On my consumer gaming motherboard, the SATA ports next to the M.2 slot became &lt;em&gt;disabled&lt;/em&gt; when I attached the M.2 SSD.
I found this out form my motherboard documentation, which I read only after a week of thinking my motherboard itself was defective, and sending it in for repairs that did absolutely nothing.&lt;/p&gt;
&lt;h2 id=&quot;thoughts&quot;&gt;Thoughts&lt;/h2&gt;
&lt;p&gt;I like having all this space. I plan on using it up pretty fast, so Im already looking at how to expand.
Hopefully that gives a decent overview of how I set up my drives.&lt;/p&gt;
&lt;p&gt;Happy hacking!&lt;/p&gt;</content><author><name></name></author><summary type="html">Back in part one of my NAS project I discussed how I wanted to set up my hardware. Today, I set up the NAS (almost).</summary></entry><entry><title type="html">Curiosity</title><link href="http://localhost:4000/2020/10/26/curiosity/" rel="alternate" type="text/html" title="Curiosity" /><published>2020-10-26T00:00:00-06:00</published><updated>2020-10-26T00:00:00-06:00</updated><id>http://localhost:4000/2020/10/26/curiosity</id><content type="html" xml:base="http://localhost:4000/2020/10/26/curiosity/">&lt;p&gt;Curiosity is fundamental to a deep understanding of any subject.
Masters, Ph.Ds, and other fancy name suffixes will never help you
if you dont have the spirit of curiosity burning inside of you.&lt;/p&gt;
&lt;p&gt;I was speaking to someone from a journalism major at my school when the subject of hacking arose.
I expected her to know nothing about it, being a journalism student and all, but surprisingly she had something to say about it:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;“The best hackers are the ones who are curious.”&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;That struck a cord with me.
It seems to me she has nailed down the difference between the students who care about grades,
and those who want to learn.
These are not necessarily mutually exclusive, but in my experience they often are due to the way education is structured.&lt;/p&gt;
&lt;h2 id=&quot;my-anecdote&quot;&gt;My Anecdote&lt;/h2&gt;
&lt;p&gt;In my second semester at SAIT Polytechnic, I took a class entitled &lt;em&gt;Emerging Trends In Technology&lt;/em&gt;.
This class was probably the best class I have ever taken.
We had to combine two things:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Hard skills&lt;/strong&gt;: learning a new hard skill like Angular, Django, or GPG encryption.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Soft skills&lt;/strong&gt;: public speaking and presentation of our ideas.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Soft skills are not usually my area, but I can do public speaking.
I grew up quite religious, so public speaking was drilled into me young.
I liked to go off script and talk about interesting things I found along the way to the actual point.
My creativity was not usually encouraged.
That said, going off script is useful when teaching and presenting ideas;
it gives a natural air to your breath and an unquestionable confidence in your speech.&lt;/p&gt;
&lt;p&gt;This is how we learn: in relationships.
Try explaining ancient Japanese history to a computer science major, or UNIX sockets to an English major and youll see what I mean.
If there is nothing for us to connect the knowledge to, it dissipates.&lt;/p&gt;
&lt;p&gt;So why did I do so well in this class?&lt;/p&gt;
&lt;p&gt;Our task for the semester was as follows:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Learn a new subject (any &lt;em&gt;emerging trend in technology&lt;/em&gt;) which you find fascinating.&lt;/li&gt;
&lt;li&gt;Give a one minute introduction by week three.&lt;/li&gt;
&lt;li&gt;Give a 10 minute non-technical overview by week 8.&lt;/li&gt;
&lt;li&gt;Give a 20 minute technical explaination and demo by week 13.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;This is the only course I have ever taken which lets students imagination run wild.
Their presentation, their rules.
They treated the students like adults who know what they are doing.
What happened? Everyone stopped coming because “Oh no! Presentations!”?&lt;/p&gt;
&lt;p&gt;No, exactly the opposite.
There was never more than one student missing.
Every single presentation was at least moderately interesting,
and most students were excited to come to that class.
You could see it in their faces, the way they carried themselves.
Every student picked something unique to their tastes, leaving every student more educated than before.&lt;/p&gt;
&lt;p&gt;This class, unlike many others, encouraged the curiosity of the students.
It rewarded those who had unique interests and an ability to sell others on their ideas.&lt;/p&gt;
&lt;p&gt;The curiosity and the grades were one.&lt;/p&gt;
&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;Although its nice to have a course where these goals align here and there, anyone who has been to collage or university can tell you that is far from the norm.&lt;/p&gt;
&lt;p&gt;On the other hand, I never would have started this site if it wasnt for that class alone.
So I thank you, Kitty Wong, for getting me started running my own “research blog” (?)&lt;/p&gt;</content><author><name></name></author><summary type="html">Curiosity is fundamental to a deep understanding of any subject. Masters, Ph.Ds, and other fancy name suffixes will never help you if you dont have the spirit of curiosity burning inside of you.</summary></entry><entry><title type="html">Minesweeper Bomb Generation And Tile Revealing</title><link href="http://localhost:4000/2020/09/12/minesweeper/" rel="alternate" type="text/html" title="Minesweeper Bomb Generation And Tile Revealing" /><published>2020-09-12T00:00:00-06:00</published><updated>2020-09-12T00:00:00-06:00</updated><id>http://localhost:4000/2020/09/12/minesweeper</id><content type="html" xml:base="http://localhost:4000/2020/09/12/minesweeper/">&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;
&lt;h2 id=&quot;bomb-generation&quot;&gt;Bomb Generation&lt;/h2&gt;
&lt;p&gt;When I started this project I attempted to use a random bomb generator.
By this I mean on each square, before it gets generated, give it a one in 15 change of being a bomb.
Personally, Im not sure why this never looked right.
Something about the layout of the bombs did not mimic the classic Minesweeper game.&lt;/p&gt;
&lt;p&gt;After looking at some open source Minesweeper examples, I started to get the idea.
I wrote some mathematical statements describing the generation of bombs and how to get their x,y position from an appropriate number.
For those non-mathy people, dont leave just yet;
there will be code equivalents to the math.&lt;/p&gt;
&lt;p&gt;W and H are the width and height of the board respectively.&lt;/p&gt;
&lt;p&gt;&lt;span class=&quot;katex-display&quot;&gt;&lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mn mathvariant=&quot;italic&quot;&gt;0&lt;/mn&gt;&lt;mo&gt;&lt;/mo&gt;&lt;mi&gt;r&lt;/mi&gt;&lt;mo&gt;&lt;/mo&gt;&lt;mtext&gt;W&lt;/mtext&gt;&lt;mo&gt;×&lt;/mo&gt;&lt;mtext&gt;H&lt;/mtext&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;
\it 0 \leq r \leq \text W \times \text H
&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;span class=&quot;katex-html&quot; aria-hidden=&quot;true&quot;&gt;&lt;span class=&quot;base&quot;&gt;&lt;span class=&quot;strut&quot; style=&quot;height:0.8193em;vertical-align:-0.13597em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;mord&quot;&gt;&lt;span class=&quot;mord mathit&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;mspace&quot; style=&quot;margin-right:0.2777777777777778em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;mrel&quot;&gt;&lt;/span&gt;&lt;span class=&quot;mspace&quot; style=&quot;margin-right:0.2777777777777778em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;mord mathit&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;mspace&quot; style=&quot;margin-right:0.2777777777777778em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;mrel&quot;&gt;&lt;/span&gt;&lt;span class=&quot;mspace&quot; style=&quot;margin-right:0.2777777777777778em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;mord text&quot;&gt;&lt;span class=&quot;mord&quot;&gt;W&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;mspace&quot; style=&quot;margin-right:0.2222222222222222em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;mbin&quot;&gt;×&lt;/span&gt;&lt;span class=&quot;mspace&quot; style=&quot;margin-right:0.2222222222222222em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;mord text&quot;&gt;&lt;span class=&quot;mord&quot;&gt;H&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;katex-display&quot;&gt;&lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;x&lt;/mi&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mi&gt;r&lt;/mi&gt;&lt;mtext&gt;&lt;/mtext&gt;&lt;mo lspace=&quot;0.22em&quot; rspace=&quot;0.22em&quot;&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;m&lt;/mi&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;o&lt;/mi&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;d&lt;/mi&gt;&lt;/mrow&gt;&lt;/mo&gt;&lt;mtext&gt;&lt;/mtext&gt;&lt;mtext&gt;W&lt;/mtext&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;
\it x = r \bmod \text W
&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;span class=&quot;katex-html&quot; aria-hidden=&quot;true&quot;&gt;&lt;span class=&quot;base&quot;&gt;&lt;span class=&quot;strut&quot; style=&quot;height:0.69444em;vertical-align:0em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;mord&quot;&gt;&lt;span class=&quot;mord mathit&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;mspace&quot; style=&quot;margin-right:0.2777777777777778em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;mrel&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mspace&quot; style=&quot;margin-right:0.2777777777777778em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;mord mathit&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;mspace&quot; style=&quot;margin-right:0.2222222222222222em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;mspace&quot; style=&quot;margin-right:0.05555555555555555em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;mbin&quot;&gt;&lt;span class=&quot;mord&quot;&gt;&lt;span class=&quot;mord mathrm&quot;&gt;m&lt;/span&gt;&lt;span class=&quot;mord mathrm&quot;&gt;o&lt;/span&gt;&lt;span class=&quot;mord mathrm&quot;&gt;d&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;mspace&quot; style=&quot;margin-right:0.2222222222222222em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;mspace&quot; style=&quot;margin-right:0.05555555555555555em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;mord text&quot;&gt;&lt;span class=&quot;mord&quot;&gt;W&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;katex-display&quot;&gt;&lt;span class=&quot;katex&quot;&gt;&lt;span class=&quot;katex-mathml&quot;&gt;&lt;math xmlns=&quot;http://www.w3.org/1998/Math/MathML&quot;&gt;&lt;semantics&gt;&lt;mrow&gt;&lt;mi&gt;y&lt;/mi&gt;&lt;mo&gt;=&lt;/mo&gt;&lt;mrow&gt;&lt;mo fence=&quot;true&quot;&gt;&lt;/mo&gt;&lt;mfrac&gt;&lt;mi&gt;r&lt;/mi&gt;&lt;mtext&gt;H&lt;/mtext&gt;&lt;/mfrac&gt;&lt;mo fence=&quot;true&quot;&gt;&lt;/mo&gt;&lt;/mrow&gt;&lt;/mrow&gt;&lt;annotation encoding=&quot;application/x-tex&quot;&gt;
\it y = \left\lfloor\frac{r}{\text H}\right\rfloor
&lt;/annotation&gt;&lt;/semantics&gt;&lt;/math&gt;&lt;/span&gt;&lt;span class=&quot;katex-html&quot; aria-hidden=&quot;true&quot;&gt;&lt;span class=&quot;base&quot;&gt;&lt;span class=&quot;strut&quot; style=&quot;height:1.8359999999999999em;vertical-align:-0.686em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;mord&quot;&gt;&lt;span class=&quot;mord mathit&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;mspace&quot; style=&quot;margin-right:0.2777777777777778em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;mrel&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mspace&quot; style=&quot;margin-right:0.2777777777777778em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;minner&quot;&gt;&lt;span class=&quot;mopen delimcenter&quot; style=&quot;top:0em;&quot;&gt;&lt;span class=&quot;delimsizing size2&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;mord&quot;&gt;&lt;span class=&quot;mopen nulldelimiter&quot;&gt;&lt;/span&gt;&lt;span class=&quot;mfrac&quot;&gt;&lt;span class=&quot;vlist-t vlist-t2&quot;&gt;&lt;span class=&quot;vlist-r&quot;&gt;&lt;span class=&quot;vlist&quot; style=&quot;height:1.10756em;&quot;&gt;&lt;span style=&quot;top:-2.314em;&quot;&gt;&lt;span class=&quot;pstrut&quot; style=&quot;height:3em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;mord&quot;&gt;&lt;span class=&quot;mord text&quot;&gt;&lt;span class=&quot;mord&quot;&gt;H&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;top:-3.23em;&quot;&gt;&lt;span class=&quot;pstrut&quot; style=&quot;height:3em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;frac-line&quot; style=&quot;border-bottom-width:0.04em;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;top:-3.677em;&quot;&gt;&lt;span class=&quot;pstrut&quot; style=&quot;height:3em;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;mord&quot;&gt;&lt;span class=&quot;mord mathit&quot;&gt;r&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;vlist-s&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;vlist-r&quot;&gt;&lt;span class=&quot;vlist&quot; style=&quot;height:0.686em;&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;mclose nulldelimiter&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;mclose delimcenter&quot; style=&quot;top:0em;&quot;&gt;&lt;span class=&quot;delimsizing size2&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;The code equivalent to this in Python is below:&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;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;
&lt;span class=&quot;c1&quot;&gt;# y = floor(r/H); note the special syntax python has for this operation
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;y&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;H&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;So thats that, we can put this in a big ol for loop and generate an arbitrary &lt;em&gt;n&lt;/em&gt; number of bombs given a width and height of a Minesweeper board.&lt;/p&gt;
&lt;h2 id=&quot;cascading-tile-revealing&quot;&gt;Cascading Tile Revealing&lt;/h2&gt;
&lt;p&gt;This one is hard to describe;
I am adapting this from &lt;a href=&quot;https://leetcode.com/problems/minesweeper/&quot;&gt;leetcode.com&lt;/a&gt;.
Whenever a player clicks a tile, the following logic should be used:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;If a mine is revealed, the game is over. (obviously)&lt;/li&gt;
&lt;li&gt;If a tile with &lt;em&gt;no&lt;/em&gt; adjacent mines is revealed, recursively reveal all eight adjacent tiles.&lt;/li&gt;
&lt;li&gt;If a tile with one or more adjacent mines is revealed, display the number of mines next to it.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Here is the code in Python for this algorithm.&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;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;reveal_square&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;board&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;alread_revealed&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# if already checked
&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&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;k&quot;&gt;return&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# if it's a bomb
&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;board&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;][&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;y&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;s&quot;&gt;'B'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&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;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;
&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;yd&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;
&lt;span class=&quot;c1&quot;&gt;# skip if it is this the center tile
&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;if&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;xd&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;and&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;yd&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;continue&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# recursively check the adjacent square
&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;reveal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&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;xd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;+&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;yd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;board&lt;/span&gt;&lt;span class=&quot;p&quot;&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;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;already_revealed&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;This has no checks for valid squares, but its the general idea.
This function returns an array of tile coordinates which should be revealed.&lt;/p&gt;
&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;I wrote this because in the first place because I was writing my own Minesweeper game.
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://localhost:4000/2020/09/09/lamegames/" rel="alternate" type="text/html" title="lamegames.tait.tech" /><published>2020-09-09T00:00:00-06:00</published><updated>2020-09-09T00:00:00-06:00</updated><id>http://localhost:4000/2020/09/09/lamegames</id><content type="html" xml:base="http://localhost:4000/2020/09/09/lamegames/">&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;
&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://localhost:4000/2020/08/18/django-deployment/" rel="alternate" type="text/html" title="How to Solve The Django Deployment Puzzle" /><published>2020-08-18T00:00:00-06:00</published><updated>2020-08-18T00:00:00-06: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/">&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;
&lt;h3 id=&quot;asgi-servers&quot;&gt;ASGI Servers&lt;/h3&gt;
&lt;p&gt;Because my project used the ASGI (Asynchronous webServer Gateway Interface),
I needed to find a good production ASGI server to handle all the incoming requests.
The best thing I found was &lt;a href=&quot;http://www.uvicorn.org/&quot;&gt;uvicorn&lt;/a&gt;.
It focuses on speed, which is a priority, especially when using the ASGI protocol.&lt;/p&gt;
&lt;p&gt;To run uvicorn on the command line for testing purposes, use something like the following:&lt;/p&gt;
&lt;pre class=&quot;terminal&quot;&gt;
$ uvicorn --reload myapp.asgi:application
&lt;/pre&gt;
&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;
&lt;h3 id=&quot;workload-managers&quot;&gt;Workload Managers&lt;/h3&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;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,
then shift and new connections to the new deployment.
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;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;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;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]
Description=Gunicorn/Uvicorn (lamegames.io)
[Service]
WorkingDirectory=/home/lame/lamegames.io
Type=simple
RemainAfterExit=yes
ExecStart=/home/lame/lamegames.io/env/bin/gunicorn lamegames.asgi:application -w 2 -k uvicorn.workers.UvicornWorker
ExecStop=/bin/kill -HUP $MAINPID
Restart=always
[Install]
WantedBy=multi-user.target
&lt;/pre&gt;
&lt;h3 id=&quot;nginx&quot;&gt;nginx&lt;/h3&gt;
&lt;p&gt;NGINX (pronounced engine-X) is a performance web server designed for speed and simplicity.
For the front facing side of the site, I do need a production web server like nginx.
Gunicorn simply doesnt need all the features that nginx provides, but I do.
To configure my nginx installation, I used the following few directives to:&lt;/p&gt;
&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;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;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;
&lt;p&gt;This is the important part of my nginx config.&lt;/p&gt;
&lt;pre class=&quot;file&quot;&gt;
server {
location / {
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# these two lines ensure that WebSocket, and HTTP2 connection are forwarded correctly
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection &quot;Upgrade&quot;;
proxy_redirect off;
proxy_buffering off;
# this forwards all traffic to the local server on port 8000
proxy_pass http://localhost:8000;
}
# This forwards all static requests to Django's STATIC_ROOT set in settings.py; it is generated using the collectstatic command.
location /static {
autoindex on;
alias /home/lame/lamegames.io/static_generated;
}
}
&lt;/pre&gt;
&lt;h3 id=&quot;setup&quot;&gt;Setup&lt;/h3&gt;
&lt;p&gt;After all that, I was able to do the following:&lt;/p&gt;
&lt;pre class=&quot;terminal&quot;&gt;
# systemctl enable lamegames
&lt;/pre&gt;
&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;
&lt;h4 id=&quot;notes&quot;&gt;Notes&lt;/h4&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://localhost:4000/2020/08/15/openbsd1/" rel="alternate" type="text/html" title="BSD Journey, Part 1" /><published>2020-08-15T00:00:00-06:00</published><updated>2020-08-15T00:00:00-06:00</updated><id>http://localhost:4000/2020/08/15/openbsd1</id><content type="html" xml:base="http://localhost:4000/2020/08/15/openbsd1/">&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;
&lt;p&gt;Now, my interest in OpenBSD has been going on for a long time.
I started poking around for Linux alternatives way back a few years ago when Linus Torvalds decided to leave after he got in trouble for some
&lt;a href=&quot;https://arstechnica.com/information-technology/2013/07/linus-torvalds-defends-his-right-to-shame-linux-kernel-developers/&quot;&gt;unprofessional behaviour&lt;/a&gt;.
That said, Linus did come back to Linux development,
but I knew that his abrasive style is what brought good code to the Linux kernel.
I also knew that his ability to be critical would be hurt by the new
&lt;a href=&quot;https://itsfoss.com/linux-code-of-conduct/&quot;&gt;code of conduct&lt;/a&gt;.
It would become a tool for the SJW types to hammer on Linus for being a “white male, et al.”;
It would become a tool for the easily offended to use to get their dumb code into Linux;
It would become a tool for the corporatization, the HR-ification of Linux.
Frankly, this does not interest me.&lt;/p&gt;
&lt;p&gt;Now Im sure that OpenBSD has its own internal policies that I disagree with.
That said, Theo De Raadt is still at least known for calling Firefox an “amorphous peace of garbage” due to its lack of privilege separation.
And, in their &lt;a href=&quot;https://openbsd.org/goals.html&quot;&gt;project goals&lt;/a&gt; page, they specifically mention:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Be as politics-free as possible; solutions should be decided on the basis of technical merit.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Now thats something I can get behind!
Bet you thats not in the Linux COC?&lt;/p&gt;
&lt;p&gt;He also went to university in my hometown, so thats pretty cool!
I can support a local madman who thinks he can make a better operating system than all those corporations.
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://localhost:4000/2020/07/30/canadian-parliament/" rel="alternate" type="text/html" title="Know How Your Representative Votes In Parliament" /><published>2020-07-30T00:00:00-06:00</published><updated>2020-07-30T00:00:00-06: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/">&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;
&lt;h3 id=&quot;1-find-your-representative&quot;&gt;1. Find Your Representative&lt;/h3&gt;
&lt;p&gt;The first step in this process is to find who your representative is.
To do so, go to the governments own website
&lt;a href=&quot;https://www.ourcommons.ca/Members/en&quot;&gt;ourcommons.cas search tool&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Simply type in your postal code in the search box to find out who your MP is.&lt;/p&gt;
&lt;h3 id=&quot;2-their-voting-record&quot;&gt;2. Their Voting Record&lt;/h3&gt;
&lt;p&gt;Every MPs voting record is public knowledge,
and it is available nice and simple in a table on that MPs page.
For example, this is a link to
&lt;a href=&quot;https://www.ourcommons.ca/Members/en/pierre-poilievre(25524)/votes&quot;&gt;Pierre Poilievres voting record&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;To find your MPs voting record, do step one, then:
After the &lt;strong&gt;Overview&lt;/strong&gt;, and &lt;strong&gt;Seat in The House&lt;/strong&gt; sections,
there are three tabs, &lt;strong&gt;Roles&lt;/strong&gt;, &lt;strong&gt;Work&lt;/strong&gt;, and &lt;strong&gt;Contact&lt;/strong&gt;.
Click on work.
At the bottom of that tab is a link which says &lt;strong&gt;Chamber Votes&lt;/strong&gt;.
This will open a small window with some recent votes by this politician.
If you want to see all their votes, there is a button at the bottom named &lt;strong&gt;All Votes by This Member&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Tada! You can now keep your local MP accountable for anything you do or do not support.&lt;/p&gt;
&lt;h3 id=&quot;3-bill-details&quot;&gt;3. Bill Details&lt;/h3&gt;
&lt;p&gt;If you want to get into the nitty gritty,
once you open a specific bill, you can actually find out the status of said bill,
or read the actual text by clicking the &lt;strong&gt;View this Bill on LEGISinfo&lt;/strong&gt; button.&lt;/p&gt;
&lt;p&gt;Both the status of the bill, and a link to a PDF document containing the bilingual text of the bill are visible in the main body of the page.&lt;/p&gt;
&lt;h4 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h4&gt;
&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></feed>