<?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: Mike Buyco</title>
    <description>The latest articles on DEV Community by Mike Buyco (@mbuyco).</description>
    <link>https://dev.to/mbuyco</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%2F352108%2F8735f078-1482-4977-affd-06f86a99225f.png</url>
      <title>DEV Community: Mike Buyco</title>
      <link>https://dev.to/mbuyco</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mbuyco"/>
    <language>en</language>
    <item>
      <title>Building a Lua docker environment</title>
      <dc:creator>Mike Buyco</dc:creator>
      <pubDate>Sat, 30 Mar 2024 08:48:14 +0000</pubDate>
      <link>https://dev.to/mbuyco/building-a-lua-docker-environment-4h2e</link>
      <guid>https://dev.to/mbuyco/building-a-lua-docker-environment-4h2e</guid>
      <description>&lt;h2&gt;
  
  
  Intro
&lt;/h2&gt;

&lt;p&gt;I have a keen interest in containerization, a practice that has significantly streamlined my development workflow. Reflecting on my early days in programming around 2011-2012, I recall encountering a common issue when setting up local development environments. Specifically, during the installation of WAMP, I faced an error indicating that port 3306 (MySQL) was already in use. Upon investigation, I discovered that a previous installation of MySQL for a school project was the culprit, highlighting the challenges of managing dependencies and conflicting software configurations.&lt;/p&gt;

&lt;h2&gt;
  
  
  Motivation
&lt;/h2&gt;

&lt;p&gt;Currently, I am embarking on a journey to learn Lua scripting to complement my son's endeavors in 3D modeling within the Roblox platform. This motivation stems from a desire to actively engage and support his interests, although finding the time amidst other responsibilities remains a challenge. Nevertheless, I am enthusiastic about delving into Lua scripting to enhance our collaborative projects.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installation
&lt;/h2&gt;

&lt;p&gt;To facilitate my exploration of Lua, I adopt a pragmatic approach by leveraging containerization with Docker to create a dedicated development environment. This method ensures isolation from existing system dependencies and simplifies setup and management.&lt;/p&gt;

&lt;p&gt;First, let's build the project structure:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir ~/learn-lua
cd ~/learn-lua
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, create a &lt;code&gt;Dockerfile&lt;/code&gt; and our &lt;code&gt;main.lua&lt;/code&gt; script:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;touch Dockerfile
touch main.lua
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Dockerfile:&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Use a base image with Lua installed
FROM alpine:latest

# Install Lua and LuaRocks
RUN apk --update add lua5.3 lua5.3-dev luarocks5.3

# Optionally, you can install additional Lua packages using LuaRocks
# For example, to install LuaSocket:
# RUN luarocks-5.3 install luasocket

# Set the working directory
WORKDIR /app

# Copy your Lua scripts into the container
COPY . .

# Set the command to run your Lua script when the container starts
CMD ["lua5.3", "main.lua"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;main.lua:&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;print("Hello, Lua!")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now to run the &lt;code&gt;lua&lt;/code&gt; script:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker build -t game-lua .
docker run -it --rm game-lua
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Time to learn more &lt;code&gt;lua&lt;/code&gt;! I will update again soon :D&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Creating a simple CLI note app using a shell alias</title>
      <dc:creator>Mike Buyco</dc:creator>
      <pubDate>Sun, 30 Oct 2022 14:11:33 +0000</pubDate>
      <link>https://dev.to/mbuyco/creating-a-simple-cli-note-app-using-a-shell-alias-3go5</link>
      <guid>https://dev.to/mbuyco/creating-a-simple-cli-note-app-using-a-shell-alias-3go5</guid>
      <description>&lt;h2&gt;
  
  
  Overview
&lt;/h2&gt;

&lt;p&gt;I've been using the terminal for my work as a software engineer for several years now and really love the idea of doing most of my tasks in the terminal. I mainly use &lt;code&gt;vim&lt;/code&gt; as my IDE and have spent lots of time configuring it to my work style and to improve my productivity over the years. &lt;/p&gt;

&lt;p&gt;Don't get me wrong, I love tools like VSCode (especially the &lt;a href="https://vscode.dev" rel="noopener noreferrer"&gt;web version&lt;/a&gt;) and I started out using text editors like Notepad++ and Sublime Text 2. But when I learned how to use &lt;code&gt;vim&lt;/code&gt; and configure it to become a full-fledged IDE for everyday use, I fell in love with it. Back then I was really looking into how I can write code with minimal overhead as possible.&lt;/p&gt;

&lt;p&gt;Some might say, I'm an old school kind of guy and I'd happily take it as a compliment! &lt;/p&gt;

&lt;p&gt;Enough with the backstory, let's see how we can take note-taking capabilities into the terminal...&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Vim 8+ or Neovim 0.5+&lt;/li&gt;
&lt;li&gt;Unix shell&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Creating an alias
&lt;/h2&gt;

&lt;p&gt;If you're using bash, add this line to your &lt;code&gt;.bashrc&lt;/code&gt; file:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

# Quickly create a note file for today
NOTES_FILENAME="notes-$(date +%Y%m%d).txt"
alias notes="mkdir ~/notes &amp;amp;&amp;gt; /dev/null; touch ~/notes/$NOTES_FILENAME; cd ~/notes; vim ~/notes/$NOTES_FILENAME"


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Let's explain the script above...&lt;/p&gt;

&lt;p&gt;First off, we create a &lt;code&gt;NOTES_FILENAME&lt;/code&gt; variable with the current date formatted into the filename. So for example, today is October 10, 2022, then the file &lt;code&gt;notes-20221010.txt&lt;/code&gt; would be created.&lt;/p&gt;

&lt;p&gt;Second, we pass that variable to the &lt;code&gt;alias notes=&lt;/code&gt; declaration. To learn more about aliases, check out &lt;a href="https://www.geeksforgeeks.org/alias-command-in-linux-with-examples/" rel="noopener noreferrer"&gt;this article&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;alias notes=&lt;/code&gt; declaration is like a shortcut for a shell command. So instead of running the actual commands, you save it into a command named &lt;code&gt;notes&lt;/code&gt;. In this case, this command does 4 things:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;It creates a folder named notes, into the current user's home directory (&lt;code&gt;~/notes&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;It creates a file with the name based on the &lt;code&gt;NOTES_FILENAME&lt;/code&gt; variable we created earlier.&lt;/li&gt;
&lt;li&gt;It cds into the &lt;code&gt;~/notes&lt;/code&gt; directory.&lt;/li&gt;
&lt;li&gt;Runs the &lt;code&gt;vim&lt;/code&gt; text editor for the file we created.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Notes environment
&lt;/h3&gt;

&lt;p&gt;Now we can access our notes by just running the &lt;code&gt;notes&lt;/code&gt; command in the terminal.&lt;/p&gt;

&lt;p&gt;If you have configured &lt;code&gt;vim&lt;/code&gt; to have a fuzzy search for project files or live grepping action, you should be able to search through your notes. And given the date format we mentioned earlier, you can search by file for a specific date. Simple enough yeah? LGTM!&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;The steps we did above is a very simple example of how we can  quickly create notes in the terminal and focus on writing what's on our mind fast without leaving the terminal. If you're like me and you mostly work on the terminal and use &lt;code&gt;vim&lt;/code&gt; as your text editor, this is a very handy tool, simple and practical.&lt;/p&gt;

&lt;p&gt;Let me know your thoughts about this. Cheers!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1ok3j7gp3ezfvcgwzz7c.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1ok3j7gp3ezfvcgwzz7c.gif" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>terminal</category>
      <category>tutorial</category>
      <category>bash</category>
      <category>linux</category>
    </item>
  </channel>
</rss>
