<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Marx Marvelous</title>
    <description>The latest articles on DEV Community by Marx Marvelous (@ludicrousgibs).</description>
    <link>https://dev.to/ludicrousgibs</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F810382%2F496332e4-3923-4a6a-957a-616213ea3eba.png</url>
      <title>DEV Community: Marx Marvelous</title>
      <link>https://dev.to/ludicrousgibs</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ludicrousgibs"/>
    <language>en</language>
    <item>
      <title># Hello [DEV] World; I'm Bashing in, but All in One Bite!</title>
      <dc:creator>Marx Marvelous</dc:creator>
      <pubDate>Sun, 27 Feb 2022 00:22:53 +0000</pubDate>
      <link>https://dev.to/ludicrousgibs/-hello-dev-world-im-bashing-in-but-all-in-one-bite-a46</link>
      <guid>https://dev.to/ludicrousgibs/-hello-dev-world-im-bashing-in-but-all-in-one-bite-a46</guid>
      <description>&lt;p&gt;Here I share a modest addition I made to a tool I found that makes it more useful for me in my desktop Manjaro Linux.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Borrow&lt;/em&gt; and improve, right? &lt;/p&gt;

&lt;p&gt;First, I was looking for a bash script that would allow me to use a function in my &lt;code&gt;bash&lt;/code&gt; terminal, calling the name as an alias to create a post in Hugo for the static website blog I am in the process of designing and creating.  While I have no complaints about the &lt;a href="https://gohugo.io/getting-started/quick-start/#step-4-add-some-content"&gt;normal way it is done&lt;/a&gt;, it just seems kinda clunky, no? &lt;/p&gt;

&lt;p&gt;&lt;code&gt;hugo new posts/your-new-post.md&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Instead of two words, why not one? And instead of a path each time, can't we  &lt;em&gt;DRY&lt;/em&gt; that? The &lt;code&gt;.md&lt;/code&gt; extension too, while we are at it? Since hyphens are common in markdown posts, can't we &lt;em&gt;automagically&lt;/em&gt; make those sandwich where needed too? I think so. &lt;/p&gt;

&lt;p&gt;What I had in mind was something like &lt;code&gt;hugpost my new post&lt;/code&gt; And I would, assuming I am in the base of my Hugo instance, expect it to create a new &lt;code&gt;markdown&lt;/code&gt; file, in this case, &lt;code&gt;my-new-post.md&lt;/code&gt; in the &lt;code&gt;/content&lt;/code&gt; directory of the that instance and open &lt;em&gt;vscode&lt;/em&gt; in said directory with the file I just created in one short line. Why not?&lt;/p&gt;

&lt;p&gt;I found a post in &lt;a href="https://onebite.dev/create-new-hugo-post-faster-with-bash/"&gt;this&lt;/a&gt; blog post that nearly gets me there. And it is very helpful too inasmuch as  the anonymous author bothers to explain the bash syntax and credits and links to their source of inspiration. Still, I wanted to be able to not just create the new post, but also &lt;del&gt;push&lt;/del&gt; &lt;code&gt;pipe&lt;/code&gt; it into the present working directory and &lt;code&gt;pipe&lt;/code&gt; it again to open it in my editor of choice: &lt;em&gt;vscode&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Credit where it is due, here is their script from their post, &lt;a href="https://onebite.dev/create-new-hugo-post-faster-with-bash/??mode=bitesize"&gt;Create New Hugo Post Faster With Bash&lt;/a&gt; :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="k"&gt;function &lt;/span&gt;hugonp&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="nv"&gt;str&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$*&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
    hugo new posts/&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$str&lt;/span&gt; | &lt;span class="nb"&gt;sed&lt;/span&gt; &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="s1"&gt;'s/[^[:alnum:]]/-/g'&lt;/span&gt; | &lt;span class="nb"&gt;tr&lt;/span&gt; &lt;span class="nt"&gt;-s&lt;/span&gt; &lt;span class="s1"&gt;'-'&lt;/span&gt; | &lt;span class="nb"&gt;tr &lt;/span&gt;A-Z a-z.md&lt;span class="si"&gt;)&lt;/span&gt;.md
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Aside: And how about that &lt;code&gt;bitesize&lt;/code&gt; &lt;em&gt;mode&lt;/em&gt; they use in the blogpost too, eh? Cool tool there, I think.&lt;/p&gt;

&lt;p&gt;Here is my ever so modest extended version, using 2 &lt;code&gt;|&lt;/code&gt;'s, two calls (one with a switch),  and &lt;em&gt;Voila&lt;/em&gt;!:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# example:  $:&amp;gt;&amp;gt; hugpost my new post&lt;/span&gt;
&lt;span class="k"&gt;function &lt;/span&gt;hugpost&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="nv"&gt;str&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$*&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
    hugo new post/&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="nv"&gt;$str&lt;/span&gt; | &lt;span class="nb"&gt;sed&lt;/span&gt; &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="s1"&gt;'s/[^[:alnum:]]/-/g'&lt;/span&gt; | &lt;span class="nb"&gt;tr&lt;/span&gt; &lt;span class="nt"&gt;-s&lt;/span&gt; &lt;span class="s1"&gt;'-'&lt;/span&gt; | &lt;span class="nb"&gt;tr &lt;/span&gt;A-Z a-z.md&lt;span class="si"&gt;)&lt;/span&gt;.md | &lt;span class="nb"&gt;pwd&lt;/span&gt; | code &lt;span class="nt"&gt;-n&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;KA-Chow! Modest indeed. But it works, folks...at least on my laptop. &lt;/p&gt;

&lt;p&gt;For those unfamiliar with bash scripting, the above would, typically, be put in the &lt;code&gt;.bashrc&lt;/code&gt; file found as a hidden file in the base your home directory, depending on which version of Linux you are using.  Once there I can simply type the following in the terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;hugpost my new post
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Teaser- My next post will be about my new favorite amazing learning tool: &lt;a href="https://youtu.be/L2ViB6jbLzU"&gt;Lurnby&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;Stay tuned...&lt;/p&gt;

</description>
      <category>firstpost</category>
      <category>bash</category>
      <category>scripting</category>
      <category>hugo</category>
    </item>
    <item>
      <title>Can't reset my password?</title>
      <dc:creator>Marx Marvelous</dc:creator>
      <pubDate>Sun, 13 Feb 2022 17:58:24 +0000</pubDate>
      <link>https://dev.to/ludicrousgibs/cant-reset-my-password-4bjl</link>
      <guid>https://dev.to/ludicrousgibs/cant-reset-my-password-4bjl</guid>
      <description>&lt;p&gt;It says something about the token being invalid?&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
