<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Filipe Macêdo on Medium]]></title>
        <description><![CDATA[Stories by Filipe Macêdo on Medium]]></description>
        <link>https://medium.com/@fmacedoo?source=rss-884d39cda552------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*vbHs3KB5O7480nLmoGz1Sg.jpeg</url>
            <title>Stories by Filipe Macêdo on Medium</title>
            <link>https://medium.com/@fmacedoo?source=rss-884d39cda552------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 14 Nov 2026 12:08:00 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@fmacedoo/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to set GitBash as the default NPM script runner on Windows]]></title>
            <link>https://fmacedoo.medium.com/how-to-set-gitbash-as-the-default-npm-script-runner-on-windows-50d6bd670715?source=rss-884d39cda552------2</link>
            <guid isPermaLink="false">https://medium.com/p/50d6bd670715</guid>
            <dc:creator><![CDATA[Filipe Macêdo]]></dc:creator>
            <pubDate>Fri, 14 Jan 2022 15:24:25 GMT</pubDate>
            <atom:updated>2022-01-14T15:32:08.566Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3kk2hmD9uFB2eH3RiAOA0g.png" /></figure><h3>The issue</h3><p>As a Windows user, you may face some issues trying to run NPM scripts that contain shell syntax.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/317/1*UgwHSZsqjfUwUDv-EAb03w.png" /></figure><p>Even if you try to use PowerShell, you may face syntax errors.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/179/1*6zp48S5rcNEjn79fTRwo7A.png" /></figure><p>Ok, we know the CMD is legacy and it’s not able to run any code written in shell-script, <strong>but</strong> how about Powershell?</p><h3>The “but”</h3><p>Isn’t Powershell able to run shell-script properly? The answer is YES. But, there are some tricky details about how NPM runs its scripts.</p><p>Internally NPM runs your scripts on the default command terminal, independently from where you are triggering the scripts.</p><blockquote>This fact could confuse you a lot. You may think once you are running the script from PowerShell you will be able to run shell-script syntax. 💥</blockquote><p>On Windows, it means it runs every script on CMD, and as I said before it’s not compatible with shell-script syntax.</p><h3>The solution</h3><p>The solution for it is pretty simple, you just need to set a shell-script syntax compatible terminal as the default NPM script runner.</p><p>I know I am talking about Powershell since the beginning, but I will personally recommend you to use GitBash, so check below how to set it as your default NPM script runner.</p><p>Open your cmd and run:</p><pre>npm config set script-shell &quot;C:\\Program Files (x86)\\git\\bin\\bash.exe&quot;</pre><p>For x64 installations</p><pre>npm config set script-shell &quot;C:\\Program Files\\git\\bin\\bash.exe&quot;</pre><blockquote>With this solution, I am considering you have GitBash installed at these locations. Always check before if it’s the location your GitBash is installed. Otherwise, you must change the path used on these examples by your current GitBash directory path.</blockquote><h3>Need to revert?</h3><p>If you need to revert the configuration presented before, don’t worry. Run the following command to accomplish it.</p><pre>npm config delete script-shell</pre><h4>That’s all folks.</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=50d6bd670715" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Oh, My ZSH! with Powerline Fonts. Pretty simple as you deserve!]]></title>
            <link>https://fmacedoo.medium.com/oh-my-zsh-with-powerline-fonts-pretty-simple-as-you-deserve-fbe7f6d23723?source=rss-884d39cda552------2</link>
            <guid isPermaLink="false">https://medium.com/p/fbe7f6d23723</guid>
            <category><![CDATA[mac-os-x]]></category>
            <category><![CDATA[terminal]]></category>
            <category><![CDATA[zsh]]></category>
            <category><![CDATA[oh-my-zsh]]></category>
            <category><![CDATA[powerline]]></category>
            <dc:creator><![CDATA[Filipe Macêdo]]></dc:creator>
            <pubDate>Sun, 17 Jan 2021 13:25:04 GMT</pubDate>
            <atom:updated>2021-09-24T03:56:28.977Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/337/1*EHjw8IcEy7KWymemWXXsCg.png" /></figure><p>I don’t know you but I like to see my terminal with colors and icons that help me to see where and what I am doing.</p><p>I use to refer ZSH to my friends who just arrive at the Mac OS X dev environment. Also, I use to hear from them that they didn’t get something next to my own terminal configuration.</p><p>That’s why I decide to write this simple article to help you guide through the steps to get an Oh My ZSH! terminal with Monokai theme and Powerline fonts.</p><h3>Let’s get to the point!</h3><p><strong>Install Oh My ZSH! via curl</strong></p><pre>$ sh -c &quot;$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)&quot;</pre><p><strong>Install Powerline fonts</strong></p><p>Clone powerline fonts repo:</p><pre>git clone <a href="https://github.com/powerline/fonts.git">https://github.com/powerline/fonts.git</a> --depth=1</pre><p>Install them:</p><pre>cd fonts<br>./install.sh</pre><p>Don’t mess up your folders! Recycle the stuff you don’t need anymore:</p><pre>cd ..<br>rm -rf fonts</pre><p><strong>Finally, set a theme up.</strong></p><p><a href="https://github.com/lysyi3m/macos-terminal-themes">lysyi3m/macos-terminal-themes</a></p><p>I personally use the “Monokai Pro (Filter Spectrum)” one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/636/1*QbFho0uvX69-9oa_68jU5Q.png" /></figure><p>Once downloaded a theme, open it with terminal, and it gets installed to your local themes automatically.</p><ul><li>To set the theme, open terminal preferences, choose the theme you installed, and check it as default.</li><li>To set the fonts, still, at terminal preferences, click on the <em>Change…</em> button in the <strong>Font</strong> section.</li><li>I suggest the <strong>Meslo LG M DZ for Powerline, Regular, 11px</strong>! It fits very well on the terminal.</li><li>Doing the steps above, you will be able to see the colors and icons when for example, inside a git folder.</li></ul><h3>Bonus</h3><p><strong>Cleaning up the terminal context.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/323/1*ujyNYRLWzd8LVaIUPFWffg.png" /></figure><p>Use your preferred editor to edit the <em>.zshrc</em> file:</p><pre>code .zshrc</pre><p>Set the ZSH theme to the <a href="https://github.com/ohmyzsh/ohmyzsh/wiki/Themes#agnoster"><em>agnoster</em></a>:</p><pre>ZSH_THEME=”agnoster”</pre><p>Then, append the following instruction to hide the terminal context:</p><pre>prompt_context(){}</pre><p>If you want to personalize it, see <a href="https://gist.github.com/logicmd/4015090">that discussion</a>.</p><p><strong>Setting Visual Studio Code up as well</strong></p><p>Open the VS Code configs and drop the following lines:</p><pre>&quot;terminal.integrated.fontFamily&quot;: &quot;Source Code Pro for Powerline&quot;,<br>&quot;terminal.integrated.shell.osx&quot;: &quot;/bin/zsh&quot;</pre><h3><strong>That’s all!</strong></h3><p>I hope now you have a cool terminal to work with!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fbe7f6d23723" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ASP.NET Core on AWS Elastic Beanstalk Docker image through GitHub, CodeBuild, and CodePipeline…]]></title>
            <link>https://fmacedoo.medium.com/asp-net-core-on-aws-elastic-beanstalk-docker-image-through-github-codebuild-and-codepipeline-bfe00d8dbec6?source=rss-884d39cda552------2</link>
            <guid isPermaLink="false">https://medium.com/p/bfe00d8dbec6</guid>
            <category><![CDATA[aspnetcore]]></category>
            <category><![CDATA[dotnet-core]]></category>
            <category><![CDATA[elastic-beanstalk]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Filipe Macêdo]]></dc:creator>
            <pubDate>Tue, 15 Sep 2020 18:10:26 GMT</pubDate>
            <atom:updated>2020-09-15T18:10:26.146Z</atom:updated>
            <content:encoded><![CDATA[<h3>ASP.NET Core on AWS Elastic Beanstalk Docker image through GitHub, CodeBuild, and CodePipeline CI/CD.</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*N8H-3eg2GS_ZyoNE2aKhWw.png" /></figure><p>Hi there,</p><p>At this story, we will see how to create an ASP.NET Core service, build a Docker image with that service, how to process it through AWS Code Pipelines, and automatically deploys it to an Elastic Beanstalk instance.</p><h3>First steps</h3><h4>The ASP.NET Core web project</h4><p>Run the scripts to above to get a brand new web project.</p><pre>mkdir aspnetcore-api-aws<br>cd aspnetcore-api-aws<br>dotnet new web</pre><p>Then, feel free to change your endpoints on the Startup.cs file as you want.</p><h4>The Buildspec file</h4><p>Create a Buildspec.yml file as below.</p><pre>version: 0.2</pre><pre>phases:</pre><pre>pre_build:</pre><pre>commands:</pre><pre>- dotnet restore</pre><pre>build:</pre><pre>commands:</pre><pre>- dotnet publish -o output</pre><pre>- mkdir build</pre><pre>- cp -R output build/output</pre><pre>- cp Dockerfile build/Dockerfile</pre><pre>artifacts:</pre><pre>files:</pre><pre>- &#39;**/*&#39;</pre><pre>base-directory: build</pre><p>What that file defines is:</p><ul><li>Restore the project dependencies into a pre-build phase.</li><li>Publish the project to an <em>output</em> folder</li><li>Create a folder named <em>build</em></li><li>Copy the output and Dockerfile to inside the <em>build</em> folder.</li><li>Then, it defines all files inside the base directory <em>build</em> to be copied as artifacts.</li></ul><h4>The Dockerfile</h4><p>Create a Dockerfile as below.</p><pre>FROM mcr.microsoft.com/dotnet/core/aspnet:3.1</pre><pre>COPY <em>output/*</em> <em>/app/</em></pre><pre>EXPOSE <em>80</em></pre><pre>ENTRYPOINT <em>ASPNETCORE_URLS=http://*:80</em> <em>dotnet</em> <em>/app/aspnetcore-api-aws.dll</em></pre><p>It starts an image from <em>aspnet:3.1</em> templates, copy the content on the output folder to inside the container, define the port at 80, and define an startup execution point that runs our aspnetcore application at port 80.</p><h4>At GitHub</h4><p>Of course, create a GitHub repository, commit, and push all your code to the master branch.</p><p><strong>No more code from that point! :D</strong></p><h3>The AWS services</h3><h4>The Elastic Beanstalk service</h4><p>Create a elastic beanstalk application and then a new application environment as a <em>Web server environment</em>.</p><p>On platform options, choose Docker as below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yZcE90I3ELedie2fPUXVGA.png" /></figure><p><strong>Afterward, it’s gonna be star… Wait for it! …ted.</strong></p><p>You must see a website as the following image when accessing your environment URL.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SRPK1fBTWfiliJ_DbPDiaA.png" /></figure><h4>The CodePipeline service</h4><p>Create a CodePipeline and give a name to it. Select GitHub as a source provider and connect to it. Choose your GitHub project and the master branch.</p><p>At the Build Stage section, select AWS CodeBuild as the provider, and at the same flow, create a new CodeBuild project on the popup, with the environment settings as following.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pEmTfEjWNm9PxOJMjbDLcA.png" /></figure><p>Leave the Buildspec config as it is. <strong>Remember!</strong> The CodeBuild will use our repository’s Buildspec file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FXYv7bn28lwpZ0uDeDC-kA.png" /></figure><p>At the Deploy section, select AWS Elastic Beanstalk as the provider. Also, select the application and environment we previously created.</p><p>Review everything and click on <em>Create Pipeline</em>.</p><p><strong>Now, let the Pipeline get everything setup.</strong></p><p>If everything went well, you will see the Pipeline steps as the image below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/676/1*-dw6u8Hp0cSih9VUH1n6sA.png" /></figure><p>It means your Pipeline worked properly. Just check the environment URL out, to see your service online.</p><h3>Conclusion</h3><p>All these tools together provide a good solution for our continuous integration and delivery.</p><p>You may need functionalities like <em>blue/green deployment, </em>for example. So, that’s why it worth checking out more functionalities through Elastic Beanstalk instances and Code Pipelines documentations.</p><p><strong>If you want to check my GitHub repository used on that example, check it out on the following link.</strong></p><p><a href="https://github.com/fmacedoo/aspnetcore-api-aws">fmacedoo/aspnetcore-api-aws</a></p><p>Thanks you all!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bfe00d8dbec6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Standalone application with Electron, React, and SQLite stack.]]></title>
            <link>https://fmacedoo.medium.com/standalone-application-with-electron-react-and-sqlite-stack-9536a8b5a7b9?source=rss-884d39cda552------2</link>
            <guid isPermaLink="false">https://medium.com/p/9536a8b5a7b9</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[electron]]></category>
            <category><![CDATA[desktop]]></category>
            <category><![CDATA[sqlite]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Filipe Macêdo]]></dc:creator>
            <pubDate>Fri, 31 Jul 2020 21:18:52 GMT</pubDate>
            <atom:updated>2020-07-31T21:18:52.114Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*UfVpXivjrf2WiSl1pZtYRQ.png" /></figure><p>Sometimes we need to build some kind of application that does not need to consume any online service and we need to store data at the same time. Local storage could be an option in some cases, but a few weeks ago I’ve faced a project requirement where the application must store massive data collected in field research at remote places with no internet connection.</p><p>The collectors were using a kind of windows application built with the C# Windows Forms framework and SQLite that I created. With that stack, it’s simple to open a file or even connect to a database, as the process who runs the application is the same main process that launched it.</p><p>Of course, the collectors came back to me asking about new requirements on the application, and as I’ve learned and improved much more my skills I decided to rewrite the small application using that new stack proposed at the story title.</p><p><strong>TL;DR;</strong></p><h3>Let’s get to what lights up our eyes</h3><p>First of all, we must use create-react-app to bootstrap our application and then install some dependencies related to the Electron.</p><pre>create-react-app app</pre><pre>yarn add electron electron-builder wait-on concurrently --dev</pre><pre>yarn add electron-is-dev</pre><p>Add this electron.js file to the “public” folder.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8b069fccb305d9e01dfc402b7229e3cd/href">https://medium.com/media/8b069fccb305d9e01dfc402b7229e3cd/href</a></iframe><p>Add the “main” property to package.json and point to our electron file:</p><pre>“main”: “public/electron.js”</pre><p>Add this script to run the dev version:</p><pre>&quot;electron-dev&quot;: &quot;concurrently \&quot;BROWSER=none yarn start\&quot; \&quot;wait-on <a href="http://localhost:3000/">http://localhost:3000</a> &amp;&amp; electron .\&quot;&quot;</pre><p>Run the script:</p><pre>yarn electron-dev</pre><p>Now you have a sample electron app running. It’s basically what a guy named <a href="https://medium.com/@kitze">Kitze</a> wrote <a href="https://medium.com/@kitze/%EF%B8%8F-from-react-to-an-electron-app-ready-for-production-a0468ecb1da3">here</a>.</p><h3>What now? How to connect to an SQLite data source?</h3><p>At this point, We’re about to use something named Electron <a href="https://www.electronjs.org/docs/api/ipc-main"><strong>ipcMain</strong></a> and <a href="https://www.electronjs.org/docs/api/ipc-renderer"><strong>ipcRenderer</strong></a>. They are both a Node.js <a href="https://nodejs.org/api/events.html#events_class_eventemitter">Event Emitter</a>. Essentially we use them to communicate between the main process to the render process and vice-versa.</p><h4>Having these tools on our hands, let’s “ping pong” it.</h4><p>Write a function to allow the renderer to say ping to the main process. It will send a message named <em>asynchronous-message </em>to the main process and will be waiting once for a response named <em>asynchronous-reply</em>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c5c0b20cfc1b7f3a92a2dccd3b05818b/href">https://medium.com/media/c5c0b20cfc1b7f3a92a2dccd3b05818b/href</a></iframe><p>As our renderer.js will be imported by the Electron renderer process, we must explicit we want Node integration at our created BrowserWindow. So, get back to electron.js and put this there.</p><pre>new BrowserWindow({<br>    ...<br>    <strong>webPreferences: {<br>      nodeIntegration: true,<br>    }</strong><br>});</pre><p>That’s how the electron dependencies are injected into the browser window. Afterward, we import the dependency from the <em>window</em> variable as you could see on the renderer.js file.</p><pre>const electron = window.require(&#39;electron&#39;);</pre><p>Now, write a function to allow the main process to receive the renderer message (<em>asynchronous-message</em>) and respond it back (<em>asynchronous-reply</em>)<em>.</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e8eed9eae0f772b791355992b8593d06/href">https://medium.com/media/e8eed9eae0f772b791355992b8593d06/href</a></iframe><p>Import the main.js on our electron.js file. Remember that file, right?</p><pre>// preferable require it right after the main imports.<br>require(&#39;../src/message-control/main&#39;);</pre><p>On our web application (the renderer), create basic logic just to see that behavior happening.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/40ca15e4e567defd179df90b86fb30b3/href">https://medium.com/media/40ca15e4e567defd179df90b86fb30b3/href</a></iframe><p>Awesome, we already have our web application communicating to the main process, which is so powerful in terms of access.</p><h4>You may say: “Ok, we’ve already played a lot with it but you didn’t show me anything about SQLite yet.”</h4><p>Yeah, I did this on purpose to make sure you understood the concept of the communication between both processes (main and renderer).</p><p>So, talking about SQLite… add it.</p><pre>yarn add sqlite3</pre><p><em>Tip: Add an SQLite database file to the public folder. I suggest you use the </em><a href="https://sqlitebrowser.org/"><em>DB Browser for SQLite</em></a><em> tool.</em></p><p>Change the main.js to receive a SQL statement, run it, and send the result back to the renderer via event.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/24c276d8a1e0f9b561102c896d658fa7/href">https://medium.com/media/24c276d8a1e0f9b561102c896d658fa7/href</a></iframe><p>Change the App.js to treat the result as an array, as below:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/de02a9ae202733c84648026c15cd0a28/href">https://medium.com/media/de02a9ae202733c84648026c15cd0a28/href</a></iframe><p>Now, you must see the query results on the app screen. Simple as it is.</p><p><strong>Ok! That’s all folks.</strong></p><p><strong>Did you get a kind of ‘module not found’ error about SQLite?</strong></p><p>That’s because sqlite3 isn’t a native module, as in Node.js only 400 modules are native, against the 650,000 modules available.</p><pre><a href="https://www.electronjs.org/docs/tutorial/using-native-node-modules">https://www.electronjs.org/docs/tutorial/using-native-node-modules</a></pre><p><strong>But, if you wanna solve that, repeat the following steps:</strong></p><pre>yarn add --dev electron-rebuild</pre><p>Add to your package.json:</p><pre>“rebuild-sqlite3”: “electron-rebuild -f -w sqlite3”</pre><p>Run:</p><pre>yarn rebuild-sqlite3</pre><p>It could be a bit tricky. If you are on a MacOSX, you might need to have XCode and its tools installed. Also, on Windows, you may need to have some of the .NET Framework properly installed to build that native module. I don’t want to talk about that part of the story to avoid distraction from the main story’s idea.</p><h3>Conclusion</h3><p>With that stack, every React web developer can build desktop solutions collecting and storing data into an improved data source once compared to the simple and limited local storage.</p><p>I hope you all enjoyed it. You can check the repository at <a href="https://github.com/fmacedoo/ers-stack">https://github.com/fmacedoo/ers-stack</a></p><p>Thanks!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9536a8b5a7b9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>