paritybit.ca

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 7b3e1901398473a191c521f306c1654ff3903de1
parent 9bddf2a50b9aa5871739a5fd51ec19c0fd275def
Author: Jake Bauer <jbauer@paritybit.ca>
Date:   Mon,  8 Jun 2020 23:20:37 -0400

Pubish new blog post

Diffstat:
Mpages/blog.md | 1+
Apages/blog/scripting-my-way-to-success.md | 77+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mpages/home.md | 4++--
Mpublic/feeds/sitewide-feed.xml | 19+++++++++++++++++++
Mpublic/sitemap.xml | 1+
5 files changed, 100 insertions(+), 2 deletions(-)

diff --git a/pages/blog.md b/pages/blog.md @@ -20,6 +20,7 @@ href="https://social.paritybit.ca/@jbauer">Mastodon</a>. ### 2020 <ul> + <li>2020-06-08 <a href="blog/scripting-my-way-to-success">Scripting My Way to Success</a></li> <li>2020-06-07 <a href="blog/curating-my-blogroll">Curating My Blogroll</a></li> <li>2020-06-07 <a href="blog/why-email-is-the-best-discussion-platform">Why Email is the Best Discussion Platform</a></li> <li>2020-06-02 <a href="blog/toggling-between-indentation-styles-in-vim">Toggling Between Indentation Styles in Vim</a></li> diff --git a/pages/blog/scripting-my-way-to-success.md b/pages/blog/scripting-my-way-to-success.md @@ -0,0 +1,77 @@ +## Scripting My Way to Success + +[//]: # "How I solve almost all my problems with scripting." + +[//]: # "main.min.css" + +[//]: # + +<div class="byline"> +<b>Written By:</b> Jake Bauer | + <b>Posted:</b> 2020-06-08 | + <b>Last Updated:</b> 2020-06-08 +</div> + +Something that I love about *nix systems is the composability of all of the +different available tools allowing for very quick prototyping, fast and easy +one-liners, and efficient text processing. I thoroughly (ab)use this to get +nearly everything done. + +Yesterday, when I was curating my blogroll, I needed a way to update the list of +blogs and feeds I follow on my [links page](/links#blogroll). Of course I didn't +want to do this manually since that would be a huge pain. Instead, like whenever +I encounter a problem, I turned to scripting. I came up with a script I call +`generate-blogroll.sh` ([view the script +here](https://git.sr.ht/~jbauer/paritybit.ca/tree/master/generate-blogroll.sh)) +which composes the export functionality of `newsboat`, the standard `awk`, +`cut`, `tr`, `sort`, and `sed` utilities along with `vim`/`nvim`'s scripting +abilities and `rsync` for uploading the changed files. + +The script basically goes through the exported OPML file from Newsboat, breaks +each line up into a title, html URL, and feed URL, and then replaces the content +of my blogroll page with the new, auto-generated list. Once that's done, it +uploads the exported `blogroll.opml` file and the newly compiled `links.html` +page. It's not portable to other websites but that doesn't matter at all because +it's not supposed to be. I'm not creating a tool for someone else to use, I'm +hacking out a script to perform a simple, repeatable function which would +otherwise be a pain to do manually. + +I created and refined the script over the course of about 30-60 minutes of +actual work and, in doing so, learned about how to properly use `vim`'s +scripting abilities, practiced my POSIX shell scripting skills, and had a bunch +of fun. + +That's the beauty of scripting and the *nix environment. Any time I encounter a +similar problem, I write a script to handle it for me. Need to parse stats from +a log file? Script it. Need a way to download the content of an entire website? +Script it. Need to test how fast a program runs, then average the runtimes? +Script it. Need to generate an entire website from markdown files? Script it (I +did for this site!). + +In addition to the blogroll script, I have a [script to compile this +website](https://git.sr.ht/~jbauer/paritybit.ca/tree/master/generate-blogroll.sh), +a [script to publish new blog +posts](https://git.sr.ht/~jbauer/paritybit.ca/tree/master/publish), a [script to +update the site's uptime +display](https://git.sr.ht/~jbauer/paritybit.ca/tree/master/tuptime-update.pl), +and even a [script to handle uploading files to my +webserver](https://git.sr.ht/~jbauer/paritybit.ca/tree/master/uploadwatch.sh). +Those are just the scripts for this website! Some of them need to be rewritten +for portability to other *nix systems, and some are from when I first started +this site so they're not as good as my more recently-written scripts, but that's +alright because they do the thing they're supposed to do and haven't failed me +yet. + +Scripting is also great for saving time at work; the more time saved doing +menial tasks, the more time can be spent doing interesting things. Plus, you get +to show off in front of your co-workers and that's always a bonus. + +The next time you have a menial task to do, even if it's just a small one, give +scripting a shot. It doesn't matter whether or not it saves you time in the long +run (unless this is a critical task, then you should probably care), do it for +the fun of it! + +_This is my thirty-ninth post for the +[#100DaysToOffload](https://social.paritybit.ca/tags/100DaysToOffload) +challenge. You can learn more about this challenge over at +[https://100daystooffload.com](https://100daystooffload.com)._ diff --git a/pages/home.md b/pages/home.md @@ -20,6 +20,8 @@ extent)! Access through `gopher://paritybit.ca` or `gemini://paritybit.ca`. src="/img/feed-icon.png" width="15" height="15" alt="Click for RSS Feed"/> </a> </div> +2020-06-08 <a class="feed-item" href="blog/scripting-my-way-to-success">Scripting My Way to Success</a> + 2020-06-07 <a class="feed-item" href="blog/curating-my-blogroll">Curating My Blogroll</a> 2020-06-07 <a class="feed-item" href="blog/why-email-is-the-best-discussion-platform">Why Email is the Best Discussion Platform</a> @@ -37,8 +39,6 @@ extent)! Access through `gopher://paritybit.ca` or `gemini://paritybit.ca`. 2020-05-27 <a class="feed-item" href="blog/i-like-perl">I Like Perl</a> 2020-05-26 <a class="feed-item" href="blog/choosing-a-self-hosted-git-service">Choosing a Self-Hosted Git Service</a> - -2020-05-25 <a class="feed-item" href="blog/going-from-user-to-contributor-with-foss">Going From User to Contributor With FOSS</a> ### What is a Parity Bit? It is a bit (in the 1's and 0's sense) used in checking for errors in digital diff --git a/public/feeds/sitewide-feed.xml b/public/feeds/sitewide-feed.xml @@ -7,6 +7,25 @@ <description>The feed that covers all notable additions, updates, announcements, and other changes for the entire paritybit.ca website.</description> <item> + <title>Scripting My Way to Success</title> + <link>https://www.paritybit.ca/blog/scripting-my-way-to-success</link> + <guid>https://www.paritybit.ca/blog/scripting-my-way-to-success</guid> + <pubDate>Mon, 08 Jun 2020 18:24:46 -0400</pubDate> +<description><![CDATA[<h2 id="scripting-my-way-to-success">Scripting My Way to Success</h2> +<div class="byline"> +<p><b>Written By:</b> Jake Bauer | <b>Posted:</b> 2020-06-08 | <b>Last Updated:</b> 2020-06-08</p> +</div> +<p>Something that I love about *nix systems is the composability of all of the different available tools allowing for very quick prototyping, fast and easy one-liners, and efficient text processing. I thoroughly (ab)use this to get nearly everything done.</p> +<p>Yesterday, when I was curating my blogroll, I needed a way to update the list of blogs and feeds I follow on my <a href="/links#blogroll">links page</a>. Of course I didn’t want to do this manually since that would be a huge pain. Instead, like whenever I encounter a problem, I turned to scripting. I came up with a script I call <code>generate-blogroll.sh</code> (<a href="https://git.sr.ht/~jbauer/paritybit.ca/tree/master/generate-blogroll.sh">view the script here</a>) which composes the export functionality of <code>newsboat</code>, the standard <code>awk</code>, <code>cut</code>, <code>tr</code>, <code>sort</code>, and <code>sed</code> utilities along with <code>vim</code>/<code>nvim</code>’s scripting abilities and <code>rsync</code> for uploading the changed files.</p> +<p>The script basically goes through the exported OPML file from Newsboat, breaks each line up into a title, html URL, and feed URL, and then replaces the content of my blogroll page with the new, auto-generated list. Once that’s done, it uploads the exported <code>blogroll.opml</code> file and the newly compiled <code>links.html</code> page. It’s not portable to other websites but that doesn’t matter at all because it’s not supposed to be. I’m not creating a tool for someone else to use, I’m hacking out a script to perform a simple, repeatable function which would otherwise be a pain to do manually.</p> +<p>I created and refined the script over the course of about 30-60 minutes of actual work and, in doing so, learned about how to properly use <code>vim</code>’s scripting abilities, practiced my POSIX shell scripting skills, and had a bunch of fun.</p> +<p>That’s the beauty of scripting and the *nix environment. Any time I encounter a similar problem, I write a script to handle it for me. Need to parse stats from a log file? Script it. Need a way to download the content of an entire website? Script it. Need to test how fast a program runs, then average the runtimes? Script it. Need to generate an entire website from markdown files? Script it (I did for this site!).</p> +<p>In addition to the blogroll script, I have a <a href="https://git.sr.ht/~jbauer/paritybit.ca/tree/master/generate-blogroll.sh">script to compile this website</a>, a <a href="https://git.sr.ht/~jbauer/paritybit.ca/tree/master/publish">script to publish new blog posts</a>, a <a href="https://git.sr.ht/~jbauer/paritybit.ca/tree/master/tuptime-update.pl">script to update the site’s uptime display</a>, and even a <a href="https://git.sr.ht/~jbauer/paritybit.ca/tree/master/uploadwatch.sh">script to handle uploading files to my webserver</a>. Those are just the scripts for this website! Some of them need to be rewritten for portability to other *nix systems, and some are from when I first started this site so they’re not as good as my more recently-written scripts, but that’s alright because they do the thing they’re supposed to do and haven’t failed me yet.</p> +<p>Scripting is also great for saving time at work; the more time saved doing menial tasks, the more time can be spent doing interesting things. Plus, you get to show off in front of your co-workers and that’s always a bonus.</p> +<p>The next time you have a menial task to do, even if it’s just a small one, give scripting a shot. It doesn’t matter whether or not it saves you time in the long run (unless this is a critical task, then you should probably care), do it for the fun of it!</p> +<p><em>This is my thirty-ninth post for the <a href="https://social.paritybit.ca/tags/100DaysToOffload">#100DaysToOffload</a> challenge. You can learn more about this challenge over at <a href="https://100daystooffload.com" class="uri">https://100daystooffload.com</a>.</em></p>]]></description> +</item> +<item> <title>Curating My Blogroll</title> <link>https://www.paritybit.ca/blog/curating-my-blogroll</link> <guid>https://www.paritybit.ca/blog/curating-my-blogroll</guid> diff --git a/public/sitemap.xml b/public/sitemap.xml @@ -3,6 +3,7 @@ <url><loc>https://www.paritybit.ca</loc></url> <url><loc>https://www.paritybit.ca/home</loc></url> <url><loc>https://www.paritybit.ca/blog</loc></url> + <url><loc>https://www.paritybit.ca/blog/scripting-my-way-to-success</loc></url> <url><loc>https://www.paritybit.ca/blog/curating-my-blogroll</loc></url> <url><loc>https://www.paritybit.ca/blog/why-email-is-the-best-discussion-platform</loc></url> <url><loc>https://www.paritybit.ca/blog/toggling-between-indentation-styles-in-vim</loc></url>