<?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="https://mrpowerscripts.com/feed.xml" rel="self" type="application/atom+xml" /><link href="https://mrpowerscripts.com/" rel="alternate" type="text/html" /><updated>2021-11-18T01:22:49+00:00</updated><id>https://mrpowerscripts.com/feed.xml</id><title type="html">MrPowerScripts</title><subtitle>Learn. Code. Grow.</subtitle><entry><title type="html">Github Actions Deadman’s switch to publish your final GitHub Pages post</title><link href="https://mrpowerscripts.com/github-actions-dead-man-switch/" rel="alternate" type="text/html" title="Github Actions Deadman’s switch to publish your final GitHub Pages post" /><published>2021-10-26T00:00:00+00:00</published><updated>2021-11-18T01:15:44+00:00</updated><id>https://mrpowerscripts.com/github-actions-dead-man-switch</id><content type="html" xml:base="https://mrpowerscripts.com/github-actions-dead-man-switch/">&lt;p&gt;Well, in our ever-inclusive world, this would probably be better titled as dead persons switch. It’s for anyone who wants to make an eerie final blog post after some point in the future. It doesn’t only have to be because you’re dead! Many things could happen that prevent your blogging activities. Comas, life sentence in jail, leaving society to live in the woods. I’m sure there’s more that I’m not thinking of… hmmm, alien abduction, maybe?&lt;/p&gt;

&lt;p&gt;Whatever the reason, here’s a cute little script I threw together that can make a post to your GitHub pages after some date. This mechanism is an active process in that you must continually update a date value in your repo. There may be some passive means to do it, but this felt like a good place to start.&lt;/p&gt;

&lt;p&gt;First off, this only works if you’re letting GitHub itself generate your page. It works using a GitHub action to create the new post and then commits it back to the GitHub repo. But it only makes that new post if the current date is after a date value set in a file called &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;canary.sh&lt;/code&gt; in the repo’s root.&lt;/p&gt;

&lt;p&gt;In the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;canary.sh&lt;/code&gt; file, I have the sole value &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;KILLCANARY=2021-10-23&lt;/code&gt;. Simple variable assignment with a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;yyy-mm-dd&lt;/code&gt; date value. You’ll see where this comes into play within the script. With that file in the repo’s root, all you need to do is create a GitHub action yml file. I named my file &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.github/workflows/canary-workflow.yml&lt;/code&gt; and you can find the full script at the bottom of the page. Most of the bilerplace GitHub Action code is from another Action that makes it easier to push changes back to your repo and you can &lt;a href=&quot;https://github.com/ad-m/github-push-action&quot;&gt;see that action on their repo here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;So let’s just break down the actual bash that makes this action work:&lt;/p&gt;

&lt;div class=&quot;language-bash 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;nb&quot;&gt;.&lt;/span&gt; canary.sh &lt;span class=&quot;c&quot;&gt;# Source all the envars from our canary.sh file for access&lt;/span&gt;

&lt;span class=&quot;nv&quot;&gt;currentdate&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;date&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'+%Y-%m-%d'&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# Get current day&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;postdate&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;date&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$KILLCANARY&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; - 2 days&quot;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'+%Y-%m-%d'&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# convert dates to seconds for math&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;currentdateseconds&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;date&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$currentdate&lt;/span&gt; +%s&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;deadcanaryseconds&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;date&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$KILLCANARY&lt;/span&gt; +%s&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# If the current date is past the kill canary date &lt;/span&gt;
&lt;span class=&quot;c&quot;&gt;# then create the new github pages post with the release date&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$currentdateseconds&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-ge&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$deadcanaryseconds&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;# check if the dead.canary exists - so this doesn't run multiple times&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-f&lt;/span&gt; dead.canary &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;# create a dead.canary file, so that we don't run our dead canary code&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;# on any further scheduled github action runs&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;CANARY IS DEAD&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; dead.canary
    &lt;span class=&quot;c&quot;&gt;# create a post with a date from two days ago&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;# this will assure that github pages publishes it&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;printf&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;--&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;---&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;layout: post&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;img: someimage.jpg&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;title: This is the article title&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;tags: []&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;---&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\n\n&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;This is some content for the article&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;_posts/&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;postdate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;//[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;$'&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\t\r\n&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;-last-post.md&quot;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;fi
fi&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;That’s pretty much the guts of how it works. At the top, we have &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;. canary.sh&lt;/code&gt;. Notice the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.&lt;/code&gt; in front of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;canary.sh&lt;/code&gt;. That’s the same as calling &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;source canary.sh&lt;/code&gt;. All this does is absorb the values into the current shell. Since I defined a variable with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;KILLCANARY=2021-10-23&lt;/code&gt;, that variable is now available in the bash shell of the GitHub Action.&lt;/p&gt;

&lt;p&gt;Next we’re using that variable we absorbed, and defining some other variables to use:&lt;/p&gt;

&lt;div class=&quot;language-bash 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;nv&quot;&gt;currentdate&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;date&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'+%Y-%m-%d'&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c&quot;&gt;# Get current day&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;postdate&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;date&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;+&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;$((&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$KILLCANARY&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;))&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; days&quot;&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'+%Y-%m-%d'&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# convert dates to seconds for math&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;currentdateseconds&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;date&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$currentdate&lt;/span&gt; +%s&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nv&quot;&gt;deadcanaryseconds&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;date&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$KILLCANARY&lt;/span&gt; +%s&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The first two are human-readable dates in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;yyyy-mm-dd&lt;/code&gt; format. The first one is simply the current date, which will be when the Action is running. The second date is the date used for naming the post. In my situation, it’s a GitHub Page built with Jekyll, and any new blog posts in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;_posts&lt;/code&gt; folder need to start with a date. You’ll notice that I subtract two days from the post date. Setting the date well in the past to make sure Jekyll builds the post when we trigger the site rebuild. Jekyll won’t publish posts in the future, and this helps to avoid any weird timezone issues.  The next set of date variables is simply converting those dates to epoch timestamps to make comparison easier.&lt;/p&gt;

&lt;p&gt;Once we have those we can run the checks that decide if the post should be published.&lt;/p&gt;

&lt;div class=&quot;language-yml 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;c1&quot;&gt;# If the current date is past the kill canary date &lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# then create the new github pages post with the release date&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;if [ $currentdateseconds -ge $deadcanaryseconds ]; then&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;# check if the dead.canary exists - so this doesn't run multiple times&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;if [ ! -f dead.canary ]; then&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;# create a dead.canary file, so that we don't run our dead canary code&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;# on any further scheduled github action runs&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;echo &quot;CANARY IS DEAD&quot; &amp;gt; dead.canary&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;# create a post with a date from two days ago&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;# this will assure that github pages publishes it&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;printf -- &quot;---\nlayout&lt;/span&gt;&lt;span class=&quot;err&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;post\nimg&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;someimage.jpg\ntitle&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;This is the article title\ntags&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pi&quot;&gt;[]&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;\n---\n\nThis is some content for the article&quot; &amp;gt; &quot;_posts/${postdate//[$'\t\r\n']}-last-post.md&quot;&lt;/span&gt;
    &lt;span class=&quot;s&quot;&gt;fi&lt;/span&gt;
&lt;span class=&quot;s&quot;&gt;fi&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The first thing that happens is checking to see if &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$currentdateseconds&lt;/code&gt; is greater than &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$deadcanaryseconds&lt;/code&gt;. If we’ve arrived at the date that the canary dies, then we should try to create the post. We’ll also create a file called &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dead.canary&lt;/code&gt; in the root of the repo. There’s another &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;if&lt;/code&gt; statement that checks to see if the file exists. If the canary is already dead, then we won’t rerun this. Doing so will prevent the Action from repeating any of this code in the future.&lt;/p&gt;

&lt;p&gt;From that point, it’s about doing whatever you want the switch to do once the canary is dead. As a straightforward example, I’m using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;printf&lt;/code&gt; to generate a new post in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;_posts&lt;/code&gt; folder using the date calculated from two days prior.&lt;/p&gt;

&lt;p&gt;From there we quickly configure git, add all the files and create a new commit.&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;git config &lt;span class=&quot;nt&quot;&gt;--local&lt;/span&gt; user.email &lt;span class=&quot;s2&quot;&gt;&quot;41898282+github-actions[bot]@users.noreply.github.com&quot;&lt;/span&gt;
git config &lt;span class=&quot;nt&quot;&gt;--local&lt;/span&gt; user.name &lt;span class=&quot;s2&quot;&gt;&quot;github-actions[bot]&quot;&lt;/span&gt;
git add &lt;span class=&quot;nt&quot;&gt;-A&lt;/span&gt;
git commit &lt;span class=&quot;nt&quot;&gt;-m&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Add changes &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$KILLCANARY&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-a&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;There won’t be anything to commit to the repo if we haven’t reached the kill canary date. So the git code is skipped, and nothing is pushed back to the repo. If this runs after the date, the new files will be created and pushed back to the repo triggering GitHub Pages to generate the latest site version with the final post.&lt;/p&gt;

&lt;p&gt;You may notice that i’ve triggered this specific workflow to always fail.&lt;/p&gt;

&lt;div class=&quot;language-yml 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;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Fail to notify&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;run&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;exit &lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;By default, GitHub Actions only sends a notification for failures. I didn’t want to turn on notifications for successful workflows in case I added others. Then I start getting spammed with these e-mails for every successful workflow. This way, any time the workflow runs, I’ll get a notification without changing anything.  The push still occurs and the site gets updated regardless.&lt;/p&gt;

&lt;div class=&quot;language-yml 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;na&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;schedule&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
   &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;cron&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;30&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;1,15&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;*'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I’ve set the workflow to run every two weeks. It’ll perform that date check, and if the date passes, the content will get posted. The site is updated and published live. If it’s not that date yet, the workflow will fail, and I’ll get a reminder in my e-mail to keep pushing the date forward. All I need to do is edit the date in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;canary.sh&lt;/code&gt; file. Pretty simple.&lt;/p&gt;

&lt;p&gt;You never know what could happen to you, but at least you can have the final say in it all.&lt;/p&gt;

&lt;p&gt;Full GitHub Action code is available below.&lt;/p&gt;

&lt;div class=&quot;language-yml 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;na&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;schedule&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
   &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;cron&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;30&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;1,15&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;*'&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;jobs&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;build&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;runs-on&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;ubuntu-latest&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;steps&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;uses&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;actions/checkout@v2&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;with&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;persist-credentials&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;false&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;fetch-depth&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# otherwise, there would be errors pushing refs to the destination repository.&lt;/span&gt;
    &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Create local changes&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;run&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pi&quot;&gt;|&lt;/span&gt;

        &lt;span class=&quot;s&quot;&gt;. canary.sh # Source all the envars from our canary.sh file for access&lt;/span&gt;

        &lt;span class=&quot;s&quot;&gt;currentdate=$(date '+%Y-%m-%d') # Get current day&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;postdate=date -d &quot;+$(($KILLCANARY -2)) days&quot; '+%Y-%m-%d'&lt;/span&gt;
        
        &lt;span class=&quot;s&quot;&gt;# convert dates to seconds for math&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;currentdateseconds=$(date -d $currentdate +%s)&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;deadcanaryseconds=$(date -d $KILLCANARY +%s)&lt;/span&gt;
        
        &lt;span class=&quot;s&quot;&gt;# If the current date is past the kill canary date &lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;# then create the new github pages post with the release date&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;if [ $currentdateseconds -ge $deadcanaryseconds ]; then&lt;/span&gt;
          &lt;span class=&quot;s&quot;&gt;# check if the dead.canary exists - so this doesn't run multiple times&lt;/span&gt;
          &lt;span class=&quot;s&quot;&gt;if [ ! -f dead.canary ]; then&lt;/span&gt;
            &lt;span class=&quot;s&quot;&gt;# create a dead.canary file, so that we don't run our dead canary code&lt;/span&gt;
            &lt;span class=&quot;s&quot;&gt;# on any further scheduled github action runs&lt;/span&gt;
            &lt;span class=&quot;s&quot;&gt;echo &quot;CANARY IS DEAD&quot; &amp;gt; dead.canary&lt;/span&gt;
            &lt;span class=&quot;s&quot;&gt;# create a post with a date from two days ago&lt;/span&gt;
            &lt;span class=&quot;s&quot;&gt;# this will assure that github pages publishes it&lt;/span&gt;
            &lt;span class=&quot;s&quot;&gt;printf -- &quot;---\nlayout: post\nimg: someimage.jpg\ntitle: This is the article title\ntags: []\n---\n\nThis is some content for the article&quot; &amp;gt; &quot;_posts/${postdate//[$'\t\r\n']}-last-post.md&quot;&lt;/span&gt;
          &lt;span class=&quot;s&quot;&gt;fi&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;fi &lt;/span&gt;

    &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Commit files&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;run&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;pi&quot;&gt;|&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;git config --local user.email &quot;41898282+github-actions[bot]@users.noreply.github.com&quot;&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;git config --local user.name &quot;github-actions[bot]&quot;&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;git add -A&lt;/span&gt;
        &lt;span class=&quot;s&quot;&gt;git commit -m &quot;Add changes $KILLCANARY&quot; -a&lt;/span&gt;
    &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Push changes&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;uses&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;ad-m/github-push-action@master&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;with&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;github_token&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;$&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;branch&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;$&lt;/span&gt;
    &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Fail to notify&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;run&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;exit &lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;</content><author><name>MrPowerScripts</name></author><category term="deadman" /><category term="mrpowerscripts" /><summary type="html">Well, in our ever-inclusive world, this would probably be better titled as dead persons switch. It’s for anyone who wants to make an eerie final blog post after some point in the future. It doesn’t only have to be because you’re dead! Many things could happen that prevent your blogging activities. Comas, life sentence in jail, leaving society to live in the woods. I’m sure there’s more that I’m not thinking of… hmmm, alien abduction, maybe?</summary></entry><entry><title type="html">NFTs are dumb, and they’re going to change the world, and there’s nothing you can do about it</title><link href="https://mrpowerscripts.com/nfts-are-dumb/" rel="alternate" type="text/html" title="NFTs are dumb, and they’re going to change the world, and there’s nothing you can do about it" /><published>2021-10-07T00:00:00+00:00</published><updated>2021-10-08T15:43:30+00:00</updated><id>https://mrpowerscripts.com/nfts-are-dumb</id><content type="html" xml:base="https://mrpowerscripts.com/nfts-are-dumb/">&lt;p&gt;Every time I hear people talking about NFTs, the first opinion is usually how dumb they are. And you know what? They are dumb. People are creating pixel art of &lt;a href=&quot;https://opensea.io/collection/cryptopunks&quot; target=&quot;_blank&quot;&gt;CryptoPunks&lt;/a&gt;, &lt;a href=&quot;https://opensea.io/collection/anonymice&quot; target=&quot;_blank&quot;&gt;Anonymice&lt;/a&gt;, or even less pixely &lt;a href=&quot;https://www.deeznfts.org/&quot; target=&quot;_blank&quot;&gt;Deez Nuts&lt;/a&gt;. Which are all digital pieces of art that you can buy as a Non-Fungible Token with your rights to that art stored on a blockchain. You can’t hold it. IT’S NOT REAL. It’s just pixels on a screen. What’s the point of “ownership” of something I can easily copy and paste into my folder of stolen internet images. We all have one. Admit it. CryptoPunks pixel art has generated over $2 million in transactions already. With many of the pixel art pieces selling for several thousand dollars. WHAT!?&lt;/p&gt;

&lt;p&gt;They’re dumb, right? Like &lt;a href=&quot;https://www.marketwatch.com/story/bitcoin-pizza-day-laszlo-hanyecz-spent-3-8-billion-on-pizzas-in-the-summer-of-2010-using-the-novel-crypto-11621714395&quot; target=&quot;_blank&quot;&gt;paying 10,000 Bitcoins for a pizza&lt;/a&gt;, right? There’s something unique about the Bitcoin example. Many considered it dumb then, and it would surely still be dumb now. Well, unless that pizza consists of platinum, cocaine, and printer ink. It might still be a few billion short, but it would be a pretty unique pizza. Uniqueness is really easy to facilitate in the real world, but it’s the digital world where uniqueness proposes a challenge.&lt;/p&gt;

&lt;p&gt;Alright, but you might think crypto, in general, is dumb. Maybe, that’s not going to slice through your cynicism, but what about cars? NFTs are as dumb as cars, right? Oh, no? Does that feel a bit off? Deriding the most common form of transportation on the planet is a bit more challenging to agree with, I bet. Well, unless you were around &lt;a href=&quot;https://www.saturdayeveningpost.com/2017/01/get-horse-americas-skepticism-toward-first-automobiles/0&quot; target=&quot;_blank&quot;&gt;when cars were entering into the world&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;See, everyone thought cars were dumb. Do you know why cars were dumb? Because people had horses. Why the hell would they need a car? And you need to fill it with gas? That sounds dangerous as fuck. That’s so dumb. How many gas stations were there? Probably like one. For the whole country. And the roads were likely dirt or cobbled. Do you think those stiff tires and no suspension were enjoyable to drive on? And the streets were filled with people all up in the way. There were no sidewalks because there was no need to be on the side. They built roads for horses and people. It must have been so frustrating to use these things. What a dumb idea. Why would anyone spend so much money on these things? Get a horse, nerd.&lt;/p&gt;

&lt;p&gt;But then, the environment changed.&lt;/p&gt;

&lt;p&gt;Roads became better, gas stations were more common, and cars improved in their safety and features. All of these changes over time made cars more friendly and accessible to the average person. And you know what happened after that? Cars were cool. The utility of it finally outweighs the inconveniences. It’s the very same thing that happened with all kinds of breakthrough technology. It was the same for the internet.&lt;/p&gt;

&lt;p&gt;Dial-up internet sucked, and only large institutions had access to broadband speeds. Wi-fi wasn’t even a thing, and nobody had mobile phones. Media sharing was a painful experience for the average person. And guess what the average person cares about more than anything? Content and convenience. Why would they care about this dumb technology that’s slow and doesn’t do anything? You couldn’t book hotels or reserve flights. You couldn’t buy tickets to anything. But now, you can do cool stuff like buy tickets to your favorite concert on your cell phone while lying back at the beach. Pretty impressive, right? Well, it WAS until technology also brought a lot of new problems.&lt;/p&gt;

&lt;p&gt;It’s challenging to build a platform that manages all the gears and cogs needed to provide those services. And those challenges often lead to market consolidation or simply poor services because those services don’t need to worry about competition. Companies can get lazy and stop giving a shit about you, is what I’m trying to say, especially when they control a marketspace. So what used to be a fantastic refreshing experience &lt;a href=&quot;https://www.reddit.com/r/Music/comments/7ogtkr/ticketmaster_im_trying_to_buy_a_25_ticket_to/&quot; target=&quot;_blank&quot;&gt;ends up becoming a painful and soul-crushing expereince&lt;/a&gt;. Buying tickets online is like paying someone to punch you in the face so you can go enjoy something you like. It wasn’t like that before. Then there are the scalpers who automate buying up thousands of tickets before you can even get one. So now you have to get them off another site marked up even further. This evolution of the experience is hell, and it doesn’t need to be this way.&lt;/p&gt;

&lt;p&gt;But don’t worry because that’s going to change. And there’s nothing these lazy-ass exploitive companies can do about it. Because NFTs are going to change the world. And &lt;a href=&quot;https://medium.com/javarevisited/nfts-in-ticketing-ea861bda4a1&quot; target=&quot;_blank&quot;&gt;tickets to events is one of the spaces that’s prime for disruption&lt;/a&gt;. Yes, big companies will always look for opportunities to take advantage. But blockchain tech allows for so much automation around the most problematic gears and cogs managed by services like TicketMaster. Specifically around managing contracts, money, and logistics.&lt;/p&gt;

&lt;p&gt;There will be a future where a venue can directly negotiate contracts for a performance with a performer and plug the specifics of that negotiation into an app. After digitally signing the contract with both parties on the blockchain, NFT tickets for the event become available on the market. Smart contracts take care of everyone getting their cut of the sales.&lt;/p&gt;

&lt;p&gt;Most of the people at these legacy ticket gatekeepers don’t need to exist. Dapps will need to compete to provide the best and most efficient experience because they can’t simply take over the whole market or make it difficult for others to enter into the space and provide these services. The environment isn’t suited for it yet, but it’s once again evolving.&lt;/p&gt;

&lt;p&gt;Tickets are a single example, but it’s a real example that you’ll experience sooner than later. For now, NFTs are dumb, stupid, uninteresting pieces of pixel art. But tomorrow, they might be the coolest thing you’ve ever experienced. It would be cool to have a horse, though.&lt;/p&gt;</content><author><name>MrPowerScripts</name></author><category term="NFTs" /><category term="mrpowerscripts" /><summary type="html">Every time I hear people talking about NFTs, the first opinion is usually how dumb they are. And you know what? They are dumb. People are creating pixel art of CryptoPunks, Anonymice, or even less pixely Deez Nuts. Which are all digital pieces of art that you can buy as a Non-Fungible Token with your rights to that art stored on a blockchain. You can’t hold it. IT’S NOT REAL. It’s just pixels on a screen. What’s the point of “ownership” of something I can easily copy and paste into my folder of stolen internet images. We all have one. Admit it. CryptoPunks pixel art has generated over $2 million in transactions already. With many of the pixel art pieces selling for several thousand dollars. WHAT!?</summary></entry><entry><title type="html">MrPowerScripts 2020 Review</title><link href="https://mrpowerscripts.com/mrpowerscripts-2020-review/" rel="alternate" type="text/html" title="MrPowerScripts 2020 Review" /><published>2021-01-04T00:00:00+00:00</published><updated>2021-01-04T21:57:11+00:00</updated><id>https://mrpowerscripts.com/mrpowerscripts-2020-review</id><content type="html" xml:base="https://mrpowerscripts.com/mrpowerscripts-2020-review/">&lt;p&gt;Well, 2020 was… interesting — what a challenging year for personal development and growth for everyone. Many people were forced into habit changes. Many had to learn how to be productive working remotely. Fortunately, I have been working remotely for around eight years, so it wasn’t much of a change for me. I do enjoy spending time inside, so even the quarantines we’re THAT unusual. Okay, my life didn’t change much in 2020, as it turns out. I spent a lot of time stuck inside working from home.&lt;/p&gt;

&lt;p&gt;But many people suffered, and that was probably the most challenging part for me. Watching people around me struggle, lose their jobs, business, or have to make other significant lifestyle changes. It wasn’t a cakewalk for me either. There were some terrifying moments and times where things could have shifted in the wrong direction. But I have to recognize how fortunate I was overall. I spent as much time and energy as I could supporting friends and family in need. There isn’t really much else to do with the current situation. Sometimes just being there for someone to chat with is the best way to help.&lt;/p&gt;

&lt;p&gt;This is a time where being annoying positive can be a benefit. Like, ya know, when the entire world is falling apart. Might as well play that violin while the ship is sinking.&lt;/p&gt;

&lt;p&gt;I wanted to create a lot more content in 2020, and I would say I did a fair job compared to 2019. LET”S LOOK AT THE RUNDOWN.&lt;/p&gt;

&lt;h3 id=&quot;2019&quot;&gt;2019&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;19 blog posts&lt;/li&gt;
  &lt;li&gt;3 podcasts&lt;/li&gt;
  &lt;li&gt;15 youtube videos&lt;/li&gt;
  &lt;li&gt;0 twitch streams&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;2020&quot;&gt;2020&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;18 blog posts&lt;/li&gt;
  &lt;li&gt;11 podcasts&lt;/li&gt;
  &lt;li&gt;8 youtube videos&lt;/li&gt;
  &lt;li&gt;2 twitch streams&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So 2020 was the introduction of more new kinds of content. Spending a bit more time trying to podcast and less time YouTubing. I started a twitch channel so all the kids on my discord could heckle me as I struggle to learn things I worked to learn over 15 years ago. Math, Math never changes.&lt;/p&gt;

&lt;p&gt;The youtube channel didn’t grow all that much—almost the same views and growth of 2019. But from what you can see above, the channel didn’t get a whole lot of love. Only eight youtube videos. Two of which were twitch stream exports. Ah well.&lt;/p&gt;

&lt;div&gt;
  &lt;img style=&quot;object-fit: contain&quot; src=&quot;/images/2020-youtube-stats.jpg&quot; alt=&quot;image&quot; /&gt;
&lt;/div&gt;

&lt;p&gt;The blog, however, had its moments of growth. I spent a lot more time learning about SEO in 2019 and improving my writing around those bits of knowledge in 2020. This led me to write a few fun articles that quickly ranked on google searches leading to more site traffic. They weren’t exactly tech, but I definitely found some niche things I thought were interesting to write about. And it seems other people were searching for it. So I got a bit of a boost in the middle of the year a few weeks after writing them. Overall the site improved and rebounded from an early-year slump.&lt;/p&gt;

&lt;h3 id=&quot;google-analytics&quot;&gt;Google Analytics&lt;/h3&gt;

&lt;div&gt;
  &lt;img style=&quot;object-fit: contain&quot; src=&quot;/images/2020-website-stats.jpg&quot; alt=&quot;image&quot; /&gt;
&lt;/div&gt;

&lt;h3 id=&quot;google-search-console&quot;&gt;Google Search Console&lt;/h3&gt;

&lt;div&gt;
  &lt;img style=&quot;object-fit: contain&quot; src=&quot;/images/2020-google-stats.jpg&quot; alt=&quot;image&quot; /&gt;
&lt;/div&gt;

&lt;p&gt;I’m going to keep on writing, podcasting, and hopefully make some more youtube videos.&lt;/p&gt;

&lt;p&gt;I also spent a tremendous effort on some other personal side projects. They’re a bit outside the scope of MrPowerScripts stuff, so I’ll save the details.&lt;/p&gt;

&lt;p&gt;And I manage to push out version 3 of the Reddit Karma Farming bot. Then right before the year ended, I completed an entire re-write of the app and shared version 4 with the community.&lt;/p&gt;

&lt;p&gt;Speaking of community.&lt;/p&gt;

&lt;p&gt;A massive thank you to everyone on the Discord server who helped out and motivated me to keep producing content. The server stats only started to show in September, so I only have four months of data to display. But in that time, the server grew from 643 to 896 members.&lt;/p&gt;

&lt;div&gt;
  &lt;img style=&quot;object-fit: contain&quot; src=&quot;/images/2020-discord-stats.jpg&quot; alt=&quot;image&quot; /&gt;
&lt;/div&gt;

&lt;p&gt;2021 is here. 2020 was full of challenges. It looks like many of them will continue to exist this year, but I’m going to give it my best shot to deal-with-it and improve where I can. I might have to put the annoying positive attitude on steroids and turn it into rabid optimism. Everything is going to be okay.&lt;/p&gt;</content><author><name>MrPowerScripts</name></author><category term="2020 review" /><category term="mrpowerscripts" /><summary type="html">Well, 2020 was… interesting — what a challenging year for personal development and growth for everyone. Many people were forced into habit changes. Many had to learn how to be productive working remotely. Fortunately, I have been working remotely for around eight years, so it wasn’t much of a change for me. I do enjoy spending time inside, so even the quarantines we’re THAT unusual. Okay, my life didn’t change much in 2020, as it turns out. I spent a lot of time stuck inside working from home.</summary></entry><entry><title type="html">JSON command line tools</title><link href="https://mrpowerscripts.com/json-shell-tools/" rel="alternate" type="text/html" title="JSON command line tools" /><published>2020-11-29T00:00:00+00:00</published><updated>2020-11-29T09:57:15+00:00</updated><id>https://mrpowerscripts.com/json-shell-tools</id><content type="html" xml:base="https://mrpowerscripts.com/json-shell-tools/">&lt;p&gt;So you want to manipulate JSON from the command line? Well, you’re in luck! It’s 2020, and there are several ways to do this. Also, you’re super unlucky. It’s 2020, and the entire world is falling apart. But we can still learn about JSON at the command line!&lt;/p&gt;

&lt;h2 id=&quot;what-is-json&quot;&gt;What is JSON&lt;/h2&gt;

&lt;p&gt;JSON stands for Javascript Object Notation. It has nothing to do with javascript, even though the name makes it sound related. It’s a standard way for formatting data using key-value pairs with various value types. Such as strings, integers, arrays, and objects. JSON has become the defacto format for transmitting structured data between web services. You will likely encounter it when using any web API on the internet.&lt;/p&gt;

&lt;h2 id=&quot;why-would-you-use-json-from-the-command-line&quot;&gt;Why would you use JSON from the command line&lt;/h2&gt;

&lt;p&gt;JSON is a general-purpose data format. While predominantly used for communication between web services, it has many other use cases. If you’ve ever created a nodejs project, you’ve likely configured your package.json file, which is JSON. Many programming languages like Python and Javascript can parse JSON into native objects of the respective language, but it’s not convenient to write a script to work with JSON all the time. There are times where you may want to curl data from a web service and inspect or manipulate it from the command line. It’s much more convenient this way. Also, maybe you’re writing a bash script where native command-line tools are preferable to calling additional scripts. There are probably many other examples of reasons to work with JSON from the command line - but the biggest question is: What is the best way to do it?&lt;/p&gt;

&lt;h2 id=&quot;how-to-work-with-json-at-the-command-line-with-powershell&quot;&gt;How to work with JSON at the command line with Powershell&lt;/h2&gt;

&lt;p&gt;If you have Powershell installed on Windows or Linux, this is the easiest way to work with JSON at the command line. Powershell has a cmdlet called &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ConvertFrom-Json&lt;/code&gt; to turn JSON data into a Powershell object, which you can then interact with from the command line like any other Powershell object. Here’s a oneliner to try it yourself &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$json = Invoke-WebRequest https://reddit.com/.json | select -ExpandProperty content | ConvertFrom-Json&lt;/code&gt;. In this example, we’re downloading the Reddit front page data as JSON, which then converts to a Powershell object and stored in the $json variable. Now you can inspect the data in the variable quickly like this: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$json.data.children[0].data&lt;/code&gt;, which will output the first post on the front page.&lt;/p&gt;

&lt;h2 id=&quot;how-to-work-with-json-at-the-command-in-linux&quot;&gt;How to work with JSON at the command in Linux&lt;/h2&gt;

&lt;p&gt;The Linux shell handles data as strings, making it awkward to work with structured data like JSON. All sorts of command-line tools are needed to interact with string data like sed, awk, and cut. But even with these tools, it’s still tricky to efficiently interact with JSON on the Linux shell. A downloadable command called &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jq&lt;/code&gt; comes to the rescue for working with JSON at Linux’s command line.&lt;/p&gt;

&lt;h2 id=&quot;the-jq-tool-helps-you-work-with-json-data-on-a-linux-command-line&quot;&gt;The jq tool helps you work with JSON data on a Linux command line&lt;/h2&gt;

&lt;p&gt;The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jq&lt;/code&gt; command is like a function. You give it a JSON input, and based on a string filter, it converts that JSON to the desired output. Let’s look at the same example above but using the Linux command line. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;json=$(curl -s -L https://reddit.com/.json -H &quot;Accept: application/json&quot; -H &quot;User-Agent: avoid-rate-limit&quot;)&lt;/code&gt;. If you &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;echo&lt;/code&gt; the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$json&lt;/code&gt; variable, you’ll see a large string output of the JSON data. Scary! How will we get the same post output as easily as we could with the Powershell object? We can do it with a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jq&lt;/code&gt; filter that looks very much like the Powershell object’s notation. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;printf '%s' &quot;$json&quot; | jq '.data.children[0].data'&lt;/code&gt;. Rather than echo the contents to the pipeline, we use `printf ‘%s’ “$json” which will not accidentally interpret any newlines in the JSON because it breaks the structure.&lt;/p&gt;

&lt;p&gt;After running this &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jq&lt;/code&gt; command, you’ll see the same output as we did when we accessed the Powershell object properties. But it’s important to remember the Powershell example is an actual object which can be combined with other cmdlets to loop through values, perform arithmetic, or anything else we can do with Powershell objects. In &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jq&lt;/code&gt;, the string filter we provide has incredible flexibility far beyond the simple example.&lt;/p&gt;

&lt;p&gt;For instance, you can use a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;,&lt;/code&gt; to combine filters within the filter string. Consider this filter &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;printf '%s' &quot;$json&quot; | jq '.data.children[0].data,.data.children[4].data.stickied'&lt;/code&gt;. This will output our original top post value as well as one property from the 5th post. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jq&lt;/code&gt; also supports basic arithmetic operators. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;printf '%s' &quot;$json&quot; | jq '.data.children[4].data.num_comments+1'&lt;/code&gt;. In this example, we’re telling &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jq&lt;/code&gt; to access a single property and add one to the outputted value. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jq&lt;/code&gt; also has built-in functions to help with many tasks. For instance let’s say we want to get all of the keys for a certain object in a list. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;printf '%s' &quot;$json&quot; | jq '.data.children[4].data | keys'&lt;/code&gt;. Like most shells, you can pipeline values using the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;|&lt;/code&gt; character. In this example, we’re pipelining the 5th post object to the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jq&lt;/code&gt; function called &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;keys&lt;/code&gt;, which will output a list of the object’s keys.&lt;/p&gt;

&lt;h2 id=&quot;which-tools-should-you-use-to-work-with-json-at-the-command-line&quot;&gt;Which tools should you use to work with JSON at the command line&lt;/h2&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jq&lt;/code&gt; is an incredible tool for working with JSON data at the command line. While Powershell might be more comfortable, it’s not as readily available as a simple command-line tool, which you can install pretty much anywhere like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jq&lt;/code&gt;. Check out the &lt;a href=&quot;https://stedolan.github.io/jq/manual&quot;&gt;jq documentation&lt;/a&gt; for all the goodies.&lt;/p&gt;</content><author><name>MrPowerScripts</name></author><category term="JSON" /><category term="mrpowerscripts" /><summary type="html">So you want to manipulate JSON from the command line? Well, you’re in luck! It’s 2020, and there are several ways to do this. Also, you’re super unlucky. It’s 2020, and the entire world is falling apart. But we can still learn about JSON at the command line!</summary></entry><entry><title type="html">Damn it, he was right about 3d printing cars</title><link href="https://mrpowerscripts.com/3d-printed-cars/" rel="alternate" type="text/html" title="Damn it, he was right about 3d printing cars" /><published>2020-10-17T00:00:00+00:00</published><updated>2020-10-17T16:11:17+00:00</updated><id>https://mrpowerscripts.com/3d-printed-cars</id><content type="html" xml:base="https://mrpowerscripts.com/3d-printed-cars/">&lt;p&gt;My very first tech job was working at a local Mom &amp;amp; Pop computer repair and retail shop. And Pop, the owner, was eccentric. He had all kinds of catchphrases he would repeat over the years. “A business without a sign is a sign of no business!”. Is it coincidence that the shop also sold signs?&lt;/p&gt;

&lt;p&gt;“Everything in the store is for sale except the wife.” Indeed, he would regularly sell equipment that colleagues and I relied on to do our jobs. I would show up some days, and monitors would be missing from the tech bench area. To his credit, he always managed to get more equipment in for us to use. And true to his word, Moms managed to survive the daily fire sales. I wouldn’t have be surprised if I came in one day and he traded me to the Indiana Pacers for cash considertions.  It was always something with the dude.&lt;/p&gt;

&lt;p&gt;And this guy had so many stories—wild ones. “Back in the day, we developed a driver and almost sold it to HP for a million dollars.” I was young, and it was my first real “office” job, so I didn’t question too much. I was there to learn. But every once in a while we would be alone in the office, and he was a bit different. He liked to put on a show around people, but alone we’d get into deeper stuff. And one day he came back from a client to pick up a large printout of a fancy looking car. I already mentioned the shop made signs right? Well, they were all printed on large format printers. On paper, vinyl, everything. So he’s prepping this huge car poster to take to the client when he says “you know they’re going to print these one day?”&lt;/p&gt;

&lt;p&gt;“print what?”, I replied.&lt;/p&gt;

&lt;p&gt;“The cars. They’re going to print the cars”, he said assuredly.&lt;/p&gt;

&lt;p&gt;“That’s not possible.”, I responded even more assuredly.&lt;/p&gt;

&lt;p&gt;I’m not sure why I took up a stance here, but you have to understand at the time 3D printing was not a thing. At all. Even in basic forms or as a concept. If it was, it was happening in a really fancy lab somewhere. Cue a debate on whether it would ever happen. And despite his best efforts he couldn’t convince me.&lt;/p&gt;

&lt;p&gt;“You see this printer here? It uses ink, but they’ll do the same thing for the car. Build up the car printing layer by layer.”&lt;/p&gt;

&lt;p&gt;I really thought this man lost his god damn mind. For whatever reason I remembered that discussion over the years. And I thought about it a lot more as hobby 3d printers become commonplace. Maybe he was right, and I was wrong? It turns out he had a bit more vision than I did. And it didn’t take that long.&lt;/p&gt;

&lt;p&gt;Almost exactly ten years later &lt;a href=&quot;https://www.popularmechanics.com/cars/a16726/local-motors-strati-roadster-test-drive/&quot;&gt;the worlds first “mostly” 3d printed car&lt;/a&gt; was released.&lt;/p&gt;

&lt;p&gt;Damn it. How the hell did he know that? That realization changed me a lot. I was so smugly against the possibility of the idea. Only four years after the first we’re finally seeing prototypes for &lt;a href=&quot;https://local12.com/news/around-the-web/german-3d-company-creates-prototype-of-fully-3d-printed-car&quot;&gt;fully 3D printed cars&lt;/a&gt;. This technology isn’t going to slow down.&lt;/p&gt;

&lt;p&gt;What else is out there on the horizon that i’m missing? Where will new and old technologies coverge to create something different that seemed impossible before? I try to stay more open and let my mind wander more these days.&lt;/p&gt;

&lt;p&gt;Weekend trips to Mars? why not. Free energy systems? sure. Communication with other species. of course.&lt;/p&gt;

&lt;p&gt;Nothing great ever happened because a bunch of people got together and decided it’s not possible. So why even start there?&lt;/p&gt;</content><author><name>MrPowerScripts</name></author><category term="3d printing" /><category term="mrpowerscripts" /><summary type="html">My very first tech job was working at a local Mom &amp;amp; Pop computer repair and retail shop. And Pop, the owner, was eccentric. He had all kinds of catchphrases he would repeat over the years. “A business without a sign is a sign of no business!”. Is it coincidence that the shop also sold signs?</summary></entry><entry><title type="html">Shout out to the community</title><link href="https://mrpowerscripts.com/shout-out-community/" rel="alternate" type="text/html" title="Shout out to the community" /><published>2020-10-10T00:00:00+00:00</published><updated>2020-10-10T19:24:20+00:00</updated><id>https://mrpowerscripts.com/shout-out-community</id><content type="html" xml:base="https://mrpowerscripts.com/shout-out-community/">&lt;p&gt;So this MrPowerScripts thing is still rolling. Longer than I ever thought it would. There were large gaps in time between uploading videos when I was only making content on youtube. Then trying to blog to be a better writer, and learn more about SEO. Again, large gaps in content creation there. Then I made a freaking podcast - and I’m the least talkative person ever. So, per usual, large gaps in content. I’ll admit I can run my mouth on and on about subjects I’m fond of, but I can’t have a podcast entirely based around cheese, basketball, and Python. Or can I?&lt;/p&gt;

&lt;p&gt;Despite the gaps, eventually, I always fall back to creating something. And the biggest reason for this is all of the comments, e-mails, and most importantly - &lt;a href=&quot;https://bit.ly/mrps-discord&quot;&gt;the Discord community&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;When I first started the discord server, I wasn’t quite sure why I was making it, but it was easy. You click the + sign, enter in some information, and boom - you have a Discord server. And I’ve always admired Discord as a company that knows how to develop fantastic software, even when I was only using it to chat with friends during games. I wanted to know more about the app and creating a server fulfilled the natural curiosity to learn what else it can do. Tons. So much stuff. Roles, Bots, Permissions, Channels, Categories, AHHHHHHHHHHHH. It was a bit too much for me to learn at the time. Many buttons. Very scary.&lt;/p&gt;

&lt;p&gt;Still, despite not going all out customizing the server, I did manage to get it working enough to create some channels and invite links. I added the invite link to everything: all the youtube videos, the blog, and wherever else I could place it. And then, I pretty much forgot about it because that place was empty.&lt;/p&gt;

&lt;p&gt;After some time, random people would trickle in here and there. Mostly silent, but some people were far more engaging. And they banded together and hung out to chat in the server, which is weird because it’s the Seinfeld of Discord Servers. It’s not really about anything. It’s people just hanging around. And the server existed for a long time as a small community of people sharing their technical achievements, and memes, and of course, the occasional troll.&lt;/p&gt;

&lt;p&gt;Until a few of the early members told me the server sucks and I should make it better. I wasn’t using the server to its potential. All those things that scared me: The Roles, bots, and other settings were just too much for me to deal with, but they all knew how to set that stuff up. And they not only inspired me to clean up the place - but they also wanted to help. From that point on, the server had its first (and currennt) mods, and they’re why the server has grown to 800 users from the few we had chillen there for so long.&lt;/p&gt;

&lt;p&gt;We organized channels, made info easier to find, added roles, added a bunch of bots. I learned more about making Discord bots myself. If it weren’t for their support, I would have never taken the initiative to build out the server we have today. With bots that let you run code right in the discord chat, and tons of roles to let people identify their skills, and channels with fun/educational/odd purposes. They’ve also helped maintain a respectful culture for everyone to hang out, with the use of fancy moderation tools.&lt;/p&gt;

&lt;p&gt;I didn’t build the community. The community built itself. All I did was make the server and share the link. Watching that happen is the most memorable part for me. As the community grew, more people helped work on projects like the &lt;a href=&quot;https://github.com/MrPowerScripts/reddit-karma-farming-bot&quot;&gt;Reddit Karma Farming bot&lt;/a&gt;. There was more exciting stuff to talk about when people had great results from it. Seriously, &lt;a href=&quot;https://discord.gg/d8JkpNM&quot;&gt;check the pins in this channel&lt;/a&gt;. All the discussions and things people shared inspired me to code more and create new kinds of content. I remember a couple of weeks where everyone was making blogs. One person made a blog, and then everyone wanted blogs. So, naturally, everyone made blogs :D. People started making and sharing other things like bots, apps and Discord Servers themselves.&lt;/p&gt;

&lt;p&gt;The server has it’s ups and downs with activity, and that’s okay. The important thing for me is the culture of knowledge sharing, creating things, and inspiring each other. So I wanna shout out to everyone who helped make the server what it is today and share some of the projects created and shared there.&lt;/p&gt;

&lt;p&gt;IF I FORGOT ANYONE’S PROJECTS OR LINKS, TELL ME, AND I’LL ADD IT. It was kinda tough searching through lots of old discord chats.&lt;/p&gt;

&lt;p&gt;An exciting project from one of the first members is &lt;a href=&quot;https://disease.sh&quot;&gt;disease.sh&lt;/a&gt;, which may be the most widely used COVID-19 API for statistics about the disease. You can learn more about it &lt;a href=&quot;https://elitedamyth.xyz/2020-06-30-How-I-started-disease-sh/&quot;&gt;on his blog post&lt;/a&gt;. It’s kinda wild to watch what a simple Node app that was shared in the server has turned into. I hope more peoples projects grow into awesome creations, and that’s why it’s so important to encourage people to create.&lt;/p&gt;

&lt;p&gt;A bunch of blogs have been made:
https://elitedamyth.xyz/
https://zegs.site/
https://cosmicice.xyz/
https://taiten.de/&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;energy_sync&lt;/code&gt; &lt;a href=&quot;https://discordapp.com/channels/510821302773219331/535242083385212948/752701553269407815&quot;&gt;made a LED strip&lt;/a&gt; that syncs to the overall color display of his monitor.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;hallowed&lt;/code&gt; &lt;a href=&quot;https://discordapp.com/channels/510821302773219331/535242083385212948/754441530705707069&quot;&gt;made a oneliner strawpoll bot&lt;/a&gt; in Python&lt;/p&gt;

&lt;p&gt;I’m probably forgetting a lot more stuff, but I’ll treat this as a living blog post and keep adding more later. Huge thank you to everyone for inspiring me to do more!&lt;/p&gt;</content><author><name>MrPowerScripts</name></author><category term="shout out" /><category term="mrpowerscripts" /><summary type="html">So this MrPowerScripts thing is still rolling. Longer than I ever thought it would. There were large gaps in time between uploading videos when I was only making content on youtube. Then trying to blog to be a better writer, and learn more about SEO. Again, large gaps in content creation there. Then I made a freaking podcast - and I’m the least talkative person ever. So, per usual, large gaps in content. I’ll admit I can run my mouth on and on about subjects I’m fond of, but I can’t have a podcast entirely based around cheese, basketball, and Python. Or can I?</summary></entry><entry><title type="html">Inspiration, motivation, education</title><link href="https://mrpowerscripts.com/inspiration-motivation-education/" rel="alternate" type="text/html" title="Inspiration, motivation, education" /><published>2020-09-28T00:00:00+00:00</published><updated>2020-09-28T21:39:17+00:00</updated><id>https://mrpowerscripts.com/inspiration-motivation-education</id><content type="html" xml:base="https://mrpowerscripts.com/inspiration-motivation-education/">&lt;p&gt;I don’t talk a whole lot about my personal life because it’s not that amazing. But it’s far better than it started, and that didn’t change overnight. It’s the result of learning from many great people I’ve met over the years. And pushing myself to achieve goals that I would never have thought possible, of course, with many failures along the way.&lt;/p&gt;

&lt;p&gt;The past couple of years have been a whirlwind of achieving goals that have improved my life, and I attribute them to having a better understanding of how to the knowledge I’ve picked up over the years. Little by little. Brick by brick. You can make a stable foundation for yourself, no matter where you started. I’ve found the best place to start is from within yourself.&lt;/p&gt;

&lt;p&gt;I didn’t get here on my own, and I’ve never met a great person who did. Surrounding yourself with great people and learning from them is key to becoming a great person yourself. But knowing what to do isn’t as crucial as actually applying what you know. Many people have access to knowledge without ever attempting to use it. Taking information and turning it into steps that lead you to positive results is a skill, and nobody can do that or you. Okay, I suppose they can. That’s what life coaches do. But not everyone can afford those services.&lt;/p&gt;

&lt;p&gt;However, t’s possible to learn those skills on your own if you’re willing to try and fail until you find what works for you. Meaning, it’s an active process that you have to develop. And anyone can do this with the right mindset. It takes time and effort to develop the mentality for self-improvement. And our past experiences can undoubtedly impact the ease of adapting to the right attitude.&lt;/p&gt;

&lt;p&gt;If I were to describe how dysfunctional my household was growing up, most people would not believe it. And like most rough starts, it didn’t prepare me for my teenage years, when you’re supposed to grow in autonomy and find your path in life. I had some outstanding teachers that helped nudge me in the right direction, but exposure to their efforts was limited to when I was at school. And I didn’t always make the best efforts to show up. It was difficult for me to take the knowledge they shared and find ways to apply it to my life.&lt;/p&gt;

&lt;p&gt;Your behaviors, all of them, build upon each other. Every little thing you do adds up year after year. Are you even thinking about how you invest your time? If not, you should start.&lt;/p&gt;

&lt;p&gt;It wasn’t until I got my foot in the door working in offices with educated people with stable backgrounds where I could pick up the knowledge AND see it applied.&lt;/p&gt;

&lt;p&gt;Before that, I was working jobs like Domino’s pizza, surrounded by many people like myself. People were meandering through life without any intention to improve it. It was like seeing my friends at the time fast forward to their adult lives. There was nothing inspirational about that environment. It was mostly a sad deflating experience. It didn’t take long before I realized I needed to get the fuck out of there.&lt;/p&gt;

&lt;p&gt;But I had no good grades, no real accomplishments to show, no money, no family/friend connections. How was I supposed to get out of this place and surround myself with great people? I was about to turn eighteen when I started to get in a lot of trouble, and I realized I NEEDED to do something. The path I was headed on with the people I was hanging out with only lead me to do bad things that had terrible outcomes. How can I get out of this mess? How can I find myself around people who had the attitudes for success?&lt;/p&gt;

&lt;p&gt;I wanted to work in offices. That’s where all the talented people were, in those tall buildings with big shiny entrances. Full of well-dressed characters carrying their fancy briefcases headed to their nice cars. It seems silly to describe it that way, but I was very much on the outside of that life. I came up with immigrant parents who had tough, blue-collar jobs, and dysfunctional behaviors that prevented them from improving themselves. They had no way to advise me on how to rise out of their troubles as they couldn’t even do it themselves.&lt;/p&gt;

&lt;p&gt;How the fuck was I going to get into one of these places? I had nothing to offer besides a shitty attitude and a poor outlook on life. I had taken a couple of programming classes in school, and I enjoyed trying to fix my computer after all the times I broke it. I liked technology, and that’s the field I wanted to find myself in. How was I supposed to do that from scratch with no one to help me? I walked in the door and asked.&lt;/p&gt;

&lt;p&gt;I searched the internet for every single technology-related office near my house. I spent hours building a list of places with their names and addresses. Remember, this isn’t a time when everything was on the internet. Internet searching wasn’t what it is today. It wasn’t easy, and I think I only managed to find around five to seven suitable options. I printed out multiple copies of my “resume,” which I believe was barely a half-page document. It listed some tech classes I took in high school and my experience making pizzas. I even wore some dress clothes that didn’t quite fit right, the ones I wore to court for all the trouble I found myself in.&lt;/p&gt;

&lt;p&gt;I went to the first place on the list, the one closest to my house. It wasn’t one of the big shiny offices. It was a mom &amp;amp; pop computer repair store that also sold refurbished laptops and computers. A gentleman greeted me moments after walking in the door, to which I asked him if I could speak with the manager. And guess who he happened to be? I explained that I was looking for an internship. I was willing to work for free, and I wanted to learn more about computers. I gave him my resume, which he looked over and asked a couple more questions. “Come in tomorrow after school.”, he told me. And so I did.&lt;/p&gt;

&lt;p&gt;The next day he taught me how to install Windows 98 from scratch on a system with no operating system. I was elated to learn that. I couldn’t wait to go back and learn more. And that knowledge significantly changed my life in the first week. We had an extra broken computer at home, and I could never get it fixed. And I told the manager about it. He let me borrow their Windows 98 CD, and I performed a clean install using the Windows key sticker on the broken computer. IT WORKED, and now I had my very own computer. No more waiting hours for other family members to finish using the sole computer in the house. It happened when those “free” internet services popped up that showed advertisements while you browse.  One day with this guy helped me improve my situation at home and enabled me unfettered access to one of the most useful tools on the planet—my very own computer connected to the internet.&lt;/p&gt;

&lt;p&gt;It’s hard to express how life-changing that opportunity was. He and other amazingly talented people who worked there continued to mentor me over the following years. I went from installing software to refurbishing machines. Learning how to diagnose issues and search for solutions on the internet. To building servers, networking systems together. But he didn’t just give me the knowledge. He helped give me the mindset. As the company progressed, it moved into providing on-site technical services.&lt;/p&gt;

&lt;p&gt;I was no longer stuck at the office performing duties. Remember those big fancy offices, with all the well-dressed people and their nice cars? They were now our customers. And I had the opportunity to see what happens on the inside of a lot of these places. I was only there to help, but I had the chance to listen in on discussions with business owners, managers, and workers about all parts of their business. Remember, Information Technology touches every aspect of a business. So as we were designing systems or performing updates, people would have to explain HOW they do everything to implement strategies that supported their processes.&lt;/p&gt;

&lt;p&gt;Every day was an opportunity to be around great successful people and learn how they grew and made their businesses successful. I was able to identify and pick up values that I would never know otherwise. I cherish all of those memories and the opportunities to be around so many great people. I was able to see what it took to be successful. And it took enormous effort to work against the wrongs ways I had learned before.&lt;/p&gt;

&lt;p&gt;I’ll never forget one defining moment when my manager and I had finished installing a brand new complete network rack full of servers I had to build from scratch. It was beautiful. But some of the services weren’t communicating with each other, and we were struggling for some time. I started to get nervous that I screwed something up, and we weren’t going to fix it. There was a lot of money invested in this setup, and they would not be able to run their business the next day unless we got this working. It was a huge client. My manager heard the desperation in my voice, turned to me and said, “MrPowerScripts, it doesn’t matter if we have to re-install all the systems, change out all the hardware, re-cable everything. We will replace everything if we have to, and we will make it work.” And we did make it work. It took a bit longer than expected, but we made it work, and it felt amazing.&lt;/p&gt;

&lt;p&gt;I don’t think he realized it, but that day he planted a seed in me that grew over the years. I learned to develop that attitude further. And we went on to complete many more jobs together. And we both understood that no matter what challenges we face - we will overcome them. And that’s a powerful idea to carry with you.&lt;/p&gt;

&lt;p&gt;I worked incredibly hard from that point on. I had so much ground to cover in changing the way I think and moved through life. He set me on a path to encounter many more great people as I grew and took on more technology jobs. Eventually making it into and working for many of those companies with the big shiny buildings. And this lead to learning many more significant bits of wisdom and recognizing traits and attitudes of success.&lt;/p&gt;

&lt;p&gt;I don’t usually compare myself to other people, but I always try to compare who I am today against who I was yesterday, a week ago, a month ago, a year ago. And despite all my faults, I can say for sure I’ve improved year after year. And I will continue to do so. It doesn’t matter if I have to change all of my habits, change the people around me, change jobs, or anything else. I will do whatever it takes to improve, and I won’t give up.&lt;/p&gt;

&lt;p&gt;And my favorite part of all of this is becoming that person that inspires others to do the same. I didn’t try to do that, but I noticed it when weird things started happening. I remember when I was sharing some thoughts out loud at work many years ago when a colleague I didn’t know that well stopped me mid-sentence to ask - “were you a teacher in the past?” um… no, why? “I think you should be,” he replied. Then more colleagues and friends started reaching out to ME for advice. About work and life.&lt;/p&gt;

&lt;p&gt;The kid who always made all the wrong decisions evolved into the guy many people relied on to make the right ones.&lt;/p&gt;

&lt;p&gt;Woah.&lt;/p&gt;

&lt;p&gt;Am I a perfect person? Fuck no. Far from it. I still have to drag my past with me in many ways. But I’ve become stronger, and I’m able to handle the load better. And I will continue to improve myself and hopefully inspire others to do the same.&lt;/p&gt;

&lt;p&gt;Every day is an opportunity to be a better you. Please don’t waste it. You can do this.&lt;/p&gt;</content><author><name>MrPowerScripts</name></author><category term="inspiration" /><category term="mrpowerscripts" /><summary type="html">I don’t talk a whole lot about my personal life because it’s not that amazing. But it’s far better than it started, and that didn’t change overnight. It’s the result of learning from many great people I’ve met over the years. And pushing myself to achieve goals that I would never have thought possible, of course, with many failures along the way.</summary></entry><entry><title type="html">I fell through my bed the other day</title><link href="https://mrpowerscripts.com/broken-bed/" rel="alternate" type="text/html" title="I fell through my bed the other day" /><published>2020-09-22T00:00:00+00:00</published><updated>2020-09-22T00:03:48+00:00</updated><id>https://mrpowerscripts.com/broken-bed</id><content type="html" xml:base="https://mrpowerscripts.com/broken-bed/">&lt;p&gt;I fell THROUGH my fucking bed the other day. It was already a tough day. A Saturday afternoon, that should be time to chill and decompress from a hectic workweek. But no, chores. And I did like every — laundry, cleaning my room, common areas, the fridge, bathroom. I went wild and washed everything.  And after all of that, I was exhausted. I didn’t get a lot of sleep the night before, either, which added to the whole lovely exhaustive moment I marinated myself in. I needed to lay down. So I did. And it did not end well, at first.&lt;/p&gt;

&lt;p&gt;I’m a minimalist. My bed isn’t extravagant. It’s simple, easy to move around, and is more comfortable than the floor. Good enough for me. It’s one of those cheap single IKEA beds with the wooden strips that go across the frame. The wood is quite flexible, so it has a nice bounce to it. But over time, the wood starts to bend, and the bed sinks in. it’s not as comfortable anymore, but a new bed isn’t the biggest priority at the moment. The focus at the time was to lay down and enjoy a moment of uninterrupted rest after a long week. I was so exhausted I let myself fall to the bed with a bit more force than usual. As soon as I hit the bed, half the wood planks slipped out from their plastic sockets, which held them in place, and I plummeted to the floor.&lt;/p&gt;

&lt;p&gt;Half my bed is now on the floor below the frame. My legs were hanging over the bed frame like some clothes waiting to dry. And I’m sitting there as if I was kicking back in my favorite La-Z-Boy chair, wondering what exactly I did to deserve this. But I didn’t think about that too long because I just started laughing. After all the work I did, I couldn’t believe all I needed was a bit of support from my bed, and even that gave up on me. Usually, I would get quite upset. It might even ruin my afternoon. But today it didn’t&lt;/p&gt;

&lt;p&gt;I laughed at it.&lt;/p&gt;

&lt;p&gt;I sat there for a bit to enjoy this new view I’ve never had the opportunity to take in before, and then I got up to survey the damage. Thoughts of buying a new bed were swirling my mind, but I wanted to avoid that. I DID NOT NEED MORE STRESS IN THIS MOMENT, BUT LIFE WANTED TO SERVE IT UP TO ME ON THIS DAY. Or did it? When I looked around at the situation’s results, I noticed nothing had broken, which was good. That’s when I saw how bent the wood planks had become, which made it very easy for them to slide out of their plastic sockets.&lt;/p&gt;

&lt;p&gt;Then I had an idea - rotate the bent planks so that the bend protruded up instead of down. It took a bit of work to bend the planks for enough to slide into place, and I was nervous. I thought I was going to break the plastic, but it worked! I put them all into place and got the mattress back on top, which allowed me to enjoy some rest finally—even better rest than I had expected.&lt;/p&gt;

&lt;p&gt;Now that the planks were bending up instead of down, they provided much better support than before. I never even thought to try rotating them, and the fall is what triggered me to have the thought. What I believed to be the worst thing that could happen at the moment became a callout for an opportunity I didn’t even know was right under me all along.&lt;/p&gt;

&lt;p&gt;In times past, I may have gotten furious and threw everything out the window. Okay, maybe not that bad, but It may have bothered me so much  I would have missed the new opportunity that was right in front of me. Staying calm and evaluating the situation led to a better outcome than I had expected despite it happening at the worst possible time. I still need a new bed, but I managed to get even better support, better rest, and on top of it, a good laugh.&lt;/p&gt;</content><author><name>MrPowerScripts</name></author><category term="broken bed" /><category term="mrpowerscripts" /><summary type="html">I fell THROUGH my fucking bed the other day. It was already a tough day. A Saturday afternoon, that should be time to chill and decompress from a hectic workweek. But no, chores. And I did like every — laundry, cleaning my room, common areas, the fridge, bathroom. I went wild and washed everything. And after all of that, I was exhausted. I didn’t get a lot of sleep the night before, either, which added to the whole lovely exhaustive moment I marinated myself in. I needed to lay down. So I did. And it did not end well, at first.</summary></entry><entry><title type="html">Battle Nation Live</title><link href="https://mrpowerscripts.com/battle-nation-live/" rel="alternate" type="text/html" title="Battle Nation Live" /><published>2020-09-06T00:00:00+00:00</published><updated>2020-09-06T17:38:39+00:00</updated><id>https://mrpowerscripts.com/battle-nation-live</id><content type="html" xml:base="https://mrpowerscripts.com/battle-nation-live/">&lt;p&gt;Battle Nation Live is a discord variety show bot that I wrote a few years ago. It was the first real discord bot that I built. I was using Discord.js, and the code is atrocious. But it still works! And I’ve set it up to run on the MrPowerScripts discord server so that people can try it out any time.&lt;/p&gt;

&lt;h2 id=&quot;battle-nation-live-overview&quot;&gt;Battle Nation Live Overview&lt;/h2&gt;

&lt;p&gt;You can get the quickest overview of how it works by checking out &lt;a href=&quot;https://bnl.mrpowerscripts.com/&quot;&gt;https://bnl.mrpowerscripts.com/&lt;/a&gt;, the original website.&lt;/p&gt;

&lt;h2 id=&quot;how-does-battle-nation-live-work&quot;&gt;How does Battle Nation Live work&lt;/h2&gt;

&lt;p&gt;So how does the bot work? Join “The Show” voice channel and then run the&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;!signup&lt;/code&gt; command, which adds you to the queue for the show. Once it is your turn, you will automatically get the “Live” discord role, which allows you to use the mic.&lt;/p&gt;

&lt;p&gt;Everyone else remains muted, and it’s your turn to shine! Except there’s one catch. Everyone else gets to vote on whether you get to keep the mic or not using emoji during the performance. If you lose the vote at the end of the round, it goes to the next person! Rounds last 15 seconds, so you need to keep everyone entertained if you want to keep the mic.&lt;/p&gt;

&lt;p&gt;And this whole process of users signing up,  changing the role of who can use the mic, rotating people through the queue., and doing the emoji vote counts are managed by the bot. It’s pretty neat. I like to think of it as American Idol for discord, or some other singing or variety contest. Americas Got Talent for discord? I don’t know I never really watched those shows. But it’s possible to have these kinds of contests on discord as well!&lt;/p&gt;

&lt;h2 id=&quot;battle-nation-live-source-code&quot;&gt;Battle Nation Live source code&lt;/h2&gt;

&lt;p&gt;The code is super terrible. I was learning a lot of stuff about node and js at the time, as I still am. But I’m going to share it anyway. &lt;a href=&quot;https://github.com/MrPowerScripts/battle-nation-live-discord-bot&quot;&gt;https://github.com/MrPowerScripts/battle-nation-live-discord-bot&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And if you want to test your skills, joins the MrPowerScripts Discord server (&lt;a href=&quot;https://bit.ly/mrps-discord&quot;&gt;https://bit.ly/mrps-discord&lt;/a&gt;) where the bot is running 24/7. You can always hop on the mic at the Battle Nation Live show. lol I should never be allowed to name things.&lt;/p&gt;</content><author><name>MrPowerScripts</name></author><category term="battle nation live" /><category term="mrpowerscripts" /><summary type="html">Battle Nation Live is a discord variety show bot that I wrote a few years ago. It was the first real discord bot that I built. I was using Discord.js, and the code is atrocious. But it still works! And I’ve set it up to run on the MrPowerScripts discord server so that people can try it out any time.</summary></entry><entry><title type="html">Why the name MrPowerScripts?</title><link href="https://mrpowerscripts.com/why-mrpowerscripts/" rel="alternate" type="text/html" title="Why the name MrPowerScripts?" /><published>2020-08-15T00:00:00+00:00</published><updated>2020-08-15T01:20:02+00:00</updated><id>https://mrpowerscripts.com/why-mrpowerscripts</id><content type="html" xml:base="https://mrpowerscripts.com/why-mrpowerscripts/">&lt;p&gt;So why did I choose to name all of this…. stuff, MrPowerScripts? The youtube channel, the blog, the podcast. Everything is MrPowerscripts. The reality is that I fucked up, and I haven’t been a massive fan of it for a long time. I lacked the foresight to see that it would grow into more… stuff. I had to pick something unless I wanted some long-ass garbled string as my youtube URL. Subscribe to my channel youtube.com/sdfJIOfdsafhHJdshafo yeah, okay. But the fact it was a video platform had a considerable influence on why I chose this name instead of something cool like Tech Warriors, or Scriptiverse. Hmmm, I guess It could have been a lot worse. I shouldn’t be allowed to name anything. But it was inspired by someone else who made educational videos.&lt;/p&gt;

&lt;h2 id=&quot;the-internet-is-amazing&quot;&gt;The. internet is amazing&lt;/h2&gt;

&lt;p&gt;See, there was this time before the internet. It was fucking terrible. I lived years of my life without access to all the world’s knowledge. If you wanted to know some weird facts about a random building in Italy, you had to read it in a book, know someone from Italy, or go to Italy. Which is all fine and dandy unless you’re a fucking five-year-old. Or however old I was. Do you know what it’s like looking through an encyclopedia as a child? They’re thick and wordy. Are you a visual learner? Get fucked kiddo. There were no random youtube videos by vacationers with six views about some obscure building in the middle fuck all nowhere, Italy.&lt;/p&gt;

&lt;h2 id=&quot;encyclopedia-bricktanica&quot;&gt;Encyclopedia bricktanica&lt;/h2&gt;

&lt;p&gt;And that’s if you were lucky enough to have an encyclopedia set full of random info. Look up how much those big encyclopedia sets used to cost. Hell, they’re still like $800 on Amazon. They would sell them on TV at odd hours, and you would have to pay with installments of $19.99 a month for the rest of your damn life.  I’m not even exaggerating &lt;a href=&quot;https://slate.com/technology/2012/03/the-encyclopedia-britannica-was-expensive-useless-and-exploitative-im-glad-its-gone.html&quot;&gt;people on major publications have written happily about the demise of one of the major brands of the day Encyclopedia Britanica&lt;/a&gt;. TL;DR Massive paperweights, and not as cool as Mr. cool dude in their advertisements leads us to think.&lt;/p&gt;

&lt;!-- (1) video wrapper --&gt;
&lt;div class=&quot;youtube-video&quot; data-embed=&quot;SbQFXWlVpIU&quot;&gt; 
 
    &lt;!-- (2) the &quot;play&quot; button --&gt;
    &lt;div class=&quot;play-button&quot;&gt;&lt;/div&gt; 
     
&lt;/div&gt;

&lt;p&gt;Okay, okay, the world’s knowledge wasn’t just within those overpriced organic bricks, but wow, I hated those things. I needed a moment for some retro-hate. I was so excited to find an article bashing them! There is something far far better that served as a crucial role in information exchange. Libraries!&lt;/p&gt;

&lt;h2 id=&quot;i-loved-the-library&quot;&gt;I loved the library&lt;/h2&gt;

&lt;p&gt;The library was AMAZING, and an endless supply of information was available. They were always changing as new books came and went. I have the best memories of hanging out at libraries. I would spend hours poking through books looking for the ones I wanted to read late into the night. I sometimes left with my backpack full.&lt;/p&gt;

&lt;p&gt;If I was lucky, I could find excellent illustrations in books about really complicated stuff that I wanted to learn. And being more of a visual learner, understanding advanced or sophisticated ideas through reading was a challenge. Reading comprehension is a fundamental skill, and thankfully I had access to an infinite number of books to keep me curious and challenged at a young age. But my brain is probably a bit broken because I found television programs with graphics and animations accelerated my understanding of the subject matter much faster. Books I love you, but sometimes video is better. A picture can be worth a thousand words and good luck fitting a thousand words into a concise paragraph with neat transitions and sound effects. Maybe I just like powerpoints?&lt;/p&gt;

&lt;h2 id=&quot;the-rise-of-the-science-giants&quot;&gt;The Rise of the Science Giants&lt;/h2&gt;

&lt;p&gt;Educational science programs made the “hard” stuff seem more straightforward and did so in an entertaining way. Television shows I grew up with like “Bill Nye the Science Guy” and” Beakmans World” exploded in popularity during the ’90s. They were so popular we had days in school where we watched episodes to give students an overview of subjects before covering them more in-depth using the book materials. Video-based education was a booming segment in visual media throughout the decade, growing along with the internet. And these faces happened to pop up in the right place at the right now. But there was someone making science education videos waaaaay before Bill and Beakman brought their quirky personalities to the TV screens. Someone who was pretty much the complete opposite of them. Mr. Wizard&lt;/p&gt;

&lt;h2 id=&quot;mr-wizard-doesnt-have-time-for-your-shit-kid&quot;&gt;Mr. Wizard doesn’t have time for your shit, kid&lt;/h2&gt;

&lt;p&gt;Mr. Wizard had two science educations shows. One from 1951-1965 (71-72) in black &amp;amp; white called “Watch Mr. Wizard.” And he later returned to TV with a second show called “Mr. Wizards World” that ran from 1983-1990. Very original name, Mr. Beakman. Mr. Wizard was there teaching simple science concepts on TV with real examples that you could watch while having someone talk through the explanation with you. Like you had a personal teacher that you could pause and rewind. I remember watching the show in passing at a very young age. I didn’t know how scheduled worked at the time. I don’t even think there was a TV channel for schedules at the time. You had to buy a TV guide at the grocery store. I realize now kids are going to have no fucking clue what any of that means, and I’m starting to realize just how barbaric the ’90s were.&lt;/p&gt;

&lt;h2 id=&quot;play-with-fire-and-youre-gonna-get-learned&quot;&gt;Play with fire, and you’re gonna get learned&lt;/h2&gt;

&lt;p&gt;Anyway, It would happen to be on TV sometimes, and I was lucky to catch it playing. And the thing I loved most about it is that I clearly remember understanding that this stuff was REAL. You could mix things and make them explode! He was always lighting things on fire, and I generally found that to be incredibly cool at the time. I was not the brightest lightbulb. He regularly taught us that the materials in the world we live in interact with each other in neat ways, and we have tools and techniques to detect and measure it all. Well, not all of it. Still a whole lot of “hmm, that’s fucky” when it comes to the sciences. But through the persistence of experimentation and iteration, we discover new things that make us go “hmm, that’s fucky”. And then sometimes, penicillin, because “whoops.” The world is magical.&lt;/p&gt;

&lt;h2 id=&quot;mr-wizard-helped-make-mrpowerscripts&quot;&gt;Mr Wizard helped make MrPowerScripts&lt;/h2&gt;

&lt;p&gt;So as I was trying to figure out a name for this new youtube channel that I needed to name, I thought of the first video educator that I encountered. Someone I’ll never meet, but who had a significant impact in sparking my curiosity about the world and sharing it in a fun, simple, and engaging way in a time where access to information was limited compared to today. The channel was only going to be about Powershell scripts at the time, and so MrPowerScripts became the channel name.&lt;/p&gt;

&lt;p&gt;I always remembered him as a bit of a hard-nosed teacher, and it was funny to find the video below of Mr. Wizard being a jerk while trying to help kids learn. That… explains a lot now that I think about it.&lt;/p&gt;

&lt;!-- (1) video wrapper --&gt;
&lt;div class=&quot;youtube-video&quot; data-embed=&quot;QWGjjw0ZwXk&quot;&gt; 
 
    &lt;!-- (2) the &quot;play&quot; button --&gt;
    &lt;div class=&quot;play-button&quot;&gt;&lt;/div&gt; 
     
&lt;/div&gt;</content><author><name>MrPowerScripts</name></author><category term="MrWizard" /><category term="mrpowerscripts" /><summary type="html">So why did I choose to name all of this…. stuff, MrPowerScripts? The youtube channel, the blog, the podcast. Everything is MrPowerscripts. The reality is that I fucked up, and I haven’t been a massive fan of it for a long time. I lacked the foresight to see that it would grow into more… stuff. I had to pick something unless I wanted some long-ass garbled string as my youtube URL. Subscribe to my channel youtube.com/sdfJIOfdsafhHJdshafo yeah, okay. But the fact it was a video platform had a considerable influence on why I chose this name instead of something cool like Tech Warriors, or Scriptiverse. Hmmm, I guess It could have been a lot worse. I shouldn’t be allowed to name anything. But it was inspired by someone else who made educational videos.</summary></entry></feed>