
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
 <channel>
   <title>Jorge Avante</title>
   <link>/</link>
   <description>Recent content on Jorge Avante</description>
   <generator>Hugo -- gohugo.io</generator>
   <language>en-us</language>
   <copyright>Copyright &amp;copy; 2020 - Jorge Avante</copyright>
   <lastBuildDate>Fri, 20 Sep 2024 09:45:25 +0000</lastBuildDate>
   
       <atom:link href="/index.xml" rel="self" type="application/rss+xml" />
   
   
     <item>
       <title>Skip network setup when installing Windows 11</title>
       <link>/posts/skip-network-setup-windows/</link>
       <pubDate>Fri, 20 Sep 2024 09:45:25 +0000</pubDate>
       
       <guid>/posts/skip-network-setup-windows/</guid>
       <description>&lt;p&gt;To skip the annoying network setup in Windows 11, when starting the installation press SHIFT + F10&lt;/p&gt;
&lt;p&gt;In the Terminal that will be shown, enter following:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;quot;OOBE /BYPASSNRO&amp;quot;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;or if your windows version supports it, even better:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;start ms-cxh:localonly
``

Setup will restart and a new option will be shown in the network step.
&lt;/code&gt;&lt;/pre&gt;</description>
     </item>
   
     <item>
       <title>Setup mail command in linux</title>
       <link>/posts/setup-mail-command-in-linux/</link>
       <pubDate>Fri, 13 Sep 2024 14:52:25 +0000</pubDate>
       
       <guid>/posts/setup-mail-command-in-linux/</guid>
       <description>&lt;p&gt;Supposing we have sendmail in the linux server, the easiest way to setup any server without a valid FDQN hostname is using msmtp:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;apt-get install msmtp msmtp-mta mailutils
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If used by root, create the file&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;nano /etc/msmtprc
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Otherwise, create a local file&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;nano ~/.msmtprc
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Inside, paste the configuration you need, specifically, the original email address used by the &amp;ldquo;from&amp;rdquo; field&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;# Set default values for all following accounts.
defaults

# Set the mail server port.
port 587

# Use TLS.
tls on

# Use system certificates
tls_trust_file /etc/ssl/certs/ca-certificates.crt

# Mail account
account xxx@vvvvvv.com

# SMTP server
host smtp.mail.com

# Envelope-from address
from xxx@vvvvvv.com

# Authentication. The password is given using one of five methods, see below.
auth on

# user name for mail server
user xxx@vvvvvv.com

password superpassword

# Set a default account
account default: xxx@vvvvvv.com

# Map local users to mail addresses (for crontab)
aliases /etc/aliases
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;For services like sendgrid, the above configuration worked, for using 1&amp;amp;1 / Ionos, following line is needed:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;set_from_header on
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;After editing, set the correct permissions on the file:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;chmod 600 /etc/msmtprc
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;or&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;chmod 600 ~/.msmtprc
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;For fallback addresses, it&#39;s needed to update the /etc/aliases file&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;root: xxx@vvvvvv.com
default: xxx@vvvvvv.com
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;At the end, we need to tell sendmail to use msmtp, edit the /etc/mail.rc file:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;set sendmail=&amp;quot;/usr/bin/msmtp -t&amp;quot;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;To test, you can send an email like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;echo &amp;quot;hello world&amp;quot; | mail -s &amp;quot;test email&amp;quot; foo@bar.com
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Extra: if your application is throwing an error, saying &amp;ldquo;sendmail: account default not found&amp;rdquo; or something like that, verify that the user belongs to the &amp;ldquo;msmtp&amp;rdquo; group and check that the binary is correct:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;chown root:msmtp /etc/msmtprc
chmod 640 /etc/msmtprc
&lt;/code&gt;&lt;/pre&gt;</description>
     </item>
   
     <item>
       <title>Adding timezones and substracting dates in python</title>
       <link>/posts/adding-timezones-and-substracting-dates-in-python/</link>
       <pubDate>Sun, 11 Oct 2020 13:52:25 +0000</pubDate>
       
       <guid>/posts/adding-timezones-and-substracting-dates-in-python/</guid>
       <description>&lt;p&gt;Python&#39;s date and datetime objects can sometimes seem difficult to use when trying to calculate time deltas or when trying to use timezones. There are several libraries to deal with it, however in case no dependencies are required, you can do the following:&lt;/p&gt;
&lt;p&gt;Create a datetime with a timezone:&lt;/p&gt;
&lt;p&gt;To do so, the timedelta class receives as input the time difference, so for example, if you want to be in Europe/Berlin zone which is GMT+2, the following snippet would be used:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;from datetime import datetime, timezone, timedelta
today = datetime.now(timezone(timedelta(hours=2)))
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Subtracting dates:&lt;/p&gt;
&lt;p&gt;When making a subtraction (or any other operation) between two dates or datetimes, python will give you a timedelta object, however you may want to have some time object or a date object. In order to do so, the &lt;code&gt;total_seconds&lt;/code&gt; method can help you:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;seconds = (datetime.now - myDate).total_seconds()
&lt;/code&gt;&lt;/pre&gt;</description>
     </item>
   
     <item>
       <title>Running an Electron app on a Raspberry Pi 4</title>
       <link>/posts/running-an-electron-app-in-a-raspberry-pi-4/</link>
       <pubDate>Fri, 11 Sep 2020 23:21:52 +0000</pubDate>
       
       <guid>/posts/running-an-electron-app-in-a-raspberry-pi-4/</guid>
       <description>&lt;p&gt;When trying to run an Electron app in a raspberry pi, a blank window may appear if the gpu is not disabled.
This can be fixed at runtime with the command:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;electron . --disable-gpu
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;However, when packaging or distributing your app, it may be necessary to disable the gpu from the code, to do that, you need to do the following before the app is ready:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;app.disableHardwareAcceleration();
&lt;/code&gt;&lt;/pre&gt;</description>
     </item>
   
     <item>
       <title>Using external javascript in an Angular component</title>
       <link>/posts/using-external-javascript-in-an-angular-component/</link>
       <pubDate>Sat, 01 Aug 2020 21:18:17 +0000</pubDate>
       
       <guid>/posts/using-external-javascript-in-an-angular-component/</guid>
       <description>&lt;p&gt;Sometimes is needed to use an external javascript code in an angular component, for example for some analytics, or to use an old library that is already part of the website.&lt;/p&gt;
&lt;p&gt;If you try to add a &lt;em&gt;&lt;!-- raw HTML omitted --&gt;&lt;/em&gt; element inside an Angular component, it will not be inserted, since Angular ignores such elements. Adding it to the &lt;em&gt;index.html&lt;/em&gt; file is not enough to be able to use it inside a component.&lt;/p&gt;
&lt;p&gt;In order to make use of such objects, they need to be &amp;ldquo;declared&amp;rdquo; using the &lt;code&gt;declare&lt;/code&gt; keyword, so TypeScript understands there are some variables without a typing file.&lt;/p&gt;
&lt;p&gt;Let&#39;s make an example, suppose you have jQuery added in the head of your index.html:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;head&amp;gt;
  &amp;lt;script src=&amp;quot;https://code.jquery.com/jquery-3.5.1.slim.min.js&amp;quot; integrity=&amp;quot;sha256-4+XzXVhsDmqanXGHaHvgh1gMQKX40OUvDEBTu8JcmNs=&amp;quot; crossorigin=&amp;quot;anonymous&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;/head&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Now, imagine you have a component called example.component.ts, in order to use jQuery, you need to declare the $ variable:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;import { Component, OnInit } from &#39;@angular/core&#39;;

declare var $: any;

@Component({
  selector: &#39;example&#39;,
  templateUrl: &#39;./example.component.html&#39;,
  styleUrls: [&#39;./example.component.less&#39;]
})
export class ExampleComponent implements OnInit {

  constructor() { }

  ngOnInit() {
    const jqueryData = $(&#39;#my-example&#39;).data();
    console.log(jqueryData);
  }
}
&lt;/code&gt;&lt;/pre&gt;</description>
     </item>
   
     <item>
       <title>Casting and operations in SQLite</title>
       <link>/posts/casting-and-operations-in-sqlite/</link>
       <pubDate>Sat, 07 Mar 2020 20:56:52 +0000</pubDate>
       
       <guid>/posts/casting-and-operations-in-sqlite/</guid>
       <description>&lt;p&gt;SQLite allows not only to query tables in a database, but also to perform some calculations.&lt;/p&gt;
&lt;p&gt;Let&#39;s suppose we want to divide a number taken from a column with data of type &lt;code&gt;integer&lt;/code&gt; by an specific number, for that we need to cast the value as a float and then perform the operation:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;SELECT CAST(a AS float) / 10 FROM (SELECT SUM(my_column) AS a FROM MYTABLE WHERE created_at&amp;gt;date(&amp;quot;now&amp;quot;,&amp;quot;-7 days&amp;quot;)); 
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The result will be then a float number :)&lt;/p&gt;
</description>
     </item>
   
     <item>
       <title>Assign internal IP addresses in docker compose</title>
       <link>/posts/assign-internal-ip-addresses-in-docker-compose/</link>
       <pubDate>Thu, 05 Mar 2020 07:57:07 +0000</pubDate>
       
       <guid>/posts/assign-internal-ip-addresses-in-docker-compose/</guid>
       <description>&lt;p&gt;Sometimes it is needed to fix IP addresses in some containers declared in a docker compose file. To achieve that it is needed to configure the network. Lets suppose the network is called mynetwork and we want to assign ip addresses in the &amp;ldquo;172.20.0.X&amp;rdquo; range:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;networks:
  mynetwork:
    ipam:
      config:
        - subnet: 172.20.0.0/24
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Then, for the desired services you can assign a fixed ip address, for example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;services:
  myservice:
    image: myimage:latest
    networks:
      mynetwork:
        ipv4_address: 172.20.0.10
&lt;/code&gt;&lt;/pre&gt;</description>
     </item>
   
     <item>
       <title>Create user in Postgres via psql</title>
       <link>/posts/create-user-in-postgres-via-psql/</link>
       <pubDate>Wed, 04 Mar 2020 20:09:00 +0000</pubDate>
       
       <guid>/posts/create-user-in-postgres-via-psql/</guid>
       <description>&lt;p&gt;In case it is needed to manually add users in postgres using the psql console is pretty simple.&lt;/p&gt;
&lt;p&gt;First, access the command line:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sudo -u postgres psql
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Then create the database, user and assign permissions:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;CREATE DATABASE mydatabase;
CREATE USER myuser WITH ENCRYPTED PASSWORD &#39;secretpassword&#39;;
GRANT ALL PRIVILEGES ON DATABASE mydatabase TO myuser;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You can verify the users with the command &lt;code&gt;\du&lt;/code&gt;&lt;/p&gt;
</description>
     </item>
   
     <item>
       <title>How to limit grep results when searching in long lines</title>
       <link>/posts/how-to-limit-grep-results-when-searching-in-long-lines/</link>
       <pubDate>Fri, 14 Feb 2020 20:37:25 +0000</pubDate>
       
       <guid>/posts/how-to-limit-grep-results-when-searching-in-long-lines/</guid>
       <description>&lt;p&gt;The `grep` command is very useful to print lines containing certain patterns. But sometimes we may be looking for something in lines that are extremely long, for example in a minified javascript file.&lt;/p&gt;
&lt;p&gt;There is a way to limit the number of characters before and after the pattern we are searching for, using the extended regexp and telling grep to gives us only the match.&lt;/p&gt;
&lt;p&gt;For example, suppose we have a bundle.min.js file, and we are looking for the word &amp;ldquo;foobar&amp;rdquo;, if we just want to print 20 characters before and after, then we execute:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; grep -E -o &amp;quot;.{0,20}foobar.{0,20}&amp;quot; bundle.min.js
&lt;/code&gt;&lt;/pre&gt;</description>
     </item>
   
     <item>
       <title>Replace a string pattern in several files using the sed command and RegExp</title>
       <link>/posts/replace-strings-in-several-files-using-the-sed-command-and-regexp/</link>
       <pubDate>Mon, 10 Feb 2020 15:39:25 +0000</pubDate>
       
       <guid>/posts/replace-strings-in-several-files-using-the-sed-command-and-regexp/</guid>
       <description>&lt;p&gt;Sometimes it is necessary to replace some text inside a file using the &lt;code&gt;sed&lt;/code&gt; command. However, what if the text to search for is not fixed but has some pattern?&lt;/p&gt;
&lt;p&gt;A regular expression can be used alongside &lt;code&gt;sed&lt;/code&gt; 🙂. Let&#39;s suppose we have the following &lt;code&gt;listA.txt&lt;/code&gt; and &lt;code&gt;listB.txt&lt;/code&gt; files:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;name=John,email=john@myurl.com
name=Eva,email=eva@myurl.com
name=Laurie,email=laurie@anotherurl.com
&lt;/code&gt;&lt;/pre&gt;&lt;pre&gt;&lt;code&gt;order=12324,email=john@myurl.com
order=45656,email=eva@myurl.com
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If we want to replace the emails with a set of XXXs we could use the following shell script:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;for i in list*.txt; do
    sed -i -r &#39;s/\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,3}\.?[a-zA-Z]{0,3}/XXXXX/g&#39; $i
done
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;What the &lt;em&gt;-r&lt;/em&gt; option does, is to accept as input a regular expression, instead of just searching for a fixed string. The result would be for example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;name=John,email=XXXXX
name=Eva,email=XXXXX
name=Laurie,email=XXXXX
&lt;/code&gt;&lt;/pre&gt;</description>
     </item>
   
     <item>
       <title>How to save Docker logs in MongoDB with Fluentd</title>
       <link>/posts/how-to-save-docker-logs-in-mongodb-with-fluentd/</link>
       <pubDate>Wed, 22 Jan 2020 19:12:41 +0000</pubDate>
       
       <guid>/posts/how-to-save-docker-logs-in-mongodb-with-fluentd/</guid>
       <description>&lt;p&gt;Sometimes it is needed to aggregate or simply save the logs of container applications somewhere outside the docker host machine. For example, when using a small device like a raspberry pi with limited storage.&lt;/p&gt;
&lt;p&gt;In this guide we will setup fluentd (&lt;a href=&#34;https://www.fluentd.org&#34;&gt;https://www.fluentd.org&lt;/a&gt;) in order to stream container logs to a remote mongoDB database.&lt;/p&gt;
&lt;h4 id=&#34;fluentd-installation&#34;&gt;Fluentd installation&lt;/h4&gt;
&lt;p&gt;&lt;em&gt;Note: In case you are running a 64 bits Linux machine, there are already fluentd docker images and binaries, so you can take a look and skip this part.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;In order to install fluentd on a raspberrypi, first we need to make sure we have some dependencies:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sudo apt-get update
sudo apt-get install build-essential autoconf libc6-dev automake libtool ruby-dev
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Then we need to install fluentd as a ruby gem:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sudo gem install fluentd
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;And the fluentd plugins that we will use:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sudo fluent-gem install fluent-plugin-td
&lt;/code&gt;&lt;/pre&gt;&lt;pre&gt;&lt;code&gt;sudo fluent-gem install fluent-plugin-mongo
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;That&#39;s all, now fluentd is installed&lt;/p&gt;
&lt;h5 id=&#34;fluentd-configuration&#34;&gt;Fluentd configuration&lt;/h5&gt;
&lt;p&gt;Fluentd needs a configuration file where we tell what are the inputs and outputs we want. Since docker can communicate with our fluentd process, the config is pretty simple. Create a fluent.conf file and configure the mongoDB info as shown in the fluent official documentation ( &lt;a href=&#34;https://docs.fluentd.org/output/mongo&#34;&gt;https://docs.fluentd.org/output/mongo&lt;/a&gt; ):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;source&amp;gt;
  @type forward
&amp;lt;/source&amp;gt;
&amp;lt;match docker.*&amp;gt;
  # plugin type
  @type mongo
  # connection string can also be used: 
  # connection_string mongodb://&amp;lt;User&amp;gt;:&amp;lt;Pass&amp;gt;@localhost:27017/myDatabase?w=0
  # mongodb db + collection
  database myDatabase
  collection logs
  # mongodb host + port
  host localhost
  port 27017
  # authentication
  user michael
  password jordan
  # interval
  &amp;lt;buffer&amp;gt;
    flush_interval 10s
  &amp;lt;/buffer&amp;gt;
  # make sure to include the time key
  &amp;lt;inject&amp;gt;
    time_key time
  &amp;lt;/inject&amp;gt;
&amp;lt;/match&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The important thing here is the match expression, we are saying that our logs will have a tag of the style &amp;ldquo;docker.&amp;rdquo; + other thing, for example the container name.&lt;/p&gt;
&lt;p&gt;Now we can start fluentd with the command:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;fluentd -c fluent.conf
&lt;/code&gt;&lt;/pre&gt;&lt;h4 id=&#34;docker-log-output&#34;&gt;Docker log output&lt;/h4&gt;
&lt;p&gt;When running docker containers, we need to tell them that we will use fluentd instead of the standard log mechanism. And we need to specify the correct tag so fluentd saves the logs. For example, lets run a simple alpine container:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sudo docker run --log-driver=fluentd --log-opt tag=&amp;quot;docker.{{.ID}}&amp;quot; alpine echo﻿ &#39;Hello world!&#39;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The tag option can include the container id like in the example, or other parameters, as documented in the official docker page ( &lt;a href=&#34;https://docs.docker.com/config/containers/logging/log_tags/&#34;&gt;https://docs.docker.com/config/containers/logging/log_tags/&lt;/a&gt; ).&lt;/p&gt;
&lt;p&gt;If everything went fine, you should see an entry in your mongoDB collection. Try other containers you own and you can see how they log in the database :)&lt;/p&gt;
&lt;h4 id=&#34;extra-setting-fluentd-as-service&#34;&gt;Extra: Setting fluentd as service&lt;/h4&gt;
&lt;p&gt;If you want that fluentd starts automatically after starting the computer, you need to add the &lt;code&gt;fluentd.service&lt;/code&gt; file into &lt;code&gt;/etc/systemd/system&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Description=Fluentd
Documentation=http://www.fluentd.org/
After=network.target

[Service]
Type=forking
ExecStart=/usr/local/bin/fluentd -d /run/fluentd.pid -c /path/to/fluent.conf
PIDFile=/run/fluentd.pid
Restart=on-failure

[Install]
WantedBy=multi-user.target
&lt;/code&gt;&lt;/pre&gt;</description>
     </item>
   
     <item>
       <title>Running an Angular project in AWS Cloud9</title>
       <link>/posts/running-an-angular-project-in-aws-cloud9/</link>
       <pubDate>Fri, 10 Jan 2020 13:06:20 +0000</pubDate>
       
       <guid>/posts/running-an-angular-project-in-aws-cloud9/</guid>
       <description>&lt;p&gt;Since Cloud9 was acquired by AWS, few changes made the development of an Angular or any web application a little bit trickier to preview. The following steps are necessary to visualize or share a running angular development application:&lt;/p&gt;
&lt;p&gt;First, we need to change the EC2&#39;s security parameters, as described in this post: &lt;a href=&#34;https://community.c9.io/t/what-is-vfs-connection-does-not-exist-on-aws-c9/22697/17&#34;&gt;https://community.c9.io/t/what-is-vfs-connection-does-not-exist-on-aws-c9/22697/17&lt;/a&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;First, click on your user icon and then in Manage EC2 instance&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;In the Description tab, click in the security group link.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Add a new inbound rule&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Set the rule with the following parameters:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Type: Custom TCP&lt;/li&gt;
&lt;li&gt;Port Range: The port of the app (by default 4200)&lt;/li&gt;
&lt;li&gt;Source: Anywhere (Warning: this makes your app public to the world, for local dev you can choose &amp;ldquo;My IP&amp;rdquo;, but beware normally your internet provider will change this IP regularly and you need to repeat this step again)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Click Save&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Next, instead of just running &lt;code&gt;ng serve&lt;/code&gt; to start the angular app, run or add to package.json the following command:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;ng serve --host 0.0.0.0 --disableHostCheck
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This will make the app available outside the EC2 instance and ignore that we will access it through the EC2&#39;s public IP.&lt;/p&gt;
&lt;p&gt;Now you should be able to open a new tab and view your app!&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/img/2020-01-10_1.png&#34; alt=&#34;&#34;&gt;&lt;/p&gt;
</description>
     </item>
   
     <item>
       <title>How to bypass &#34;type X is not JSON serializable&#34; error in python</title>
       <link>/posts/how-to-bypass-type-x-is-not-json-serializable-error-in-python/</link>
       <pubDate>Thu, 09 Jan 2020 22:07:07 +0000</pubDate>
       
       <guid>/posts/how-to-bypass-type-x-is-not-json-serializable-error-in-python/</guid>
       <description>&lt;p&gt;When working with dictionaries in python, sometimes the attributes types are not serializable. This ca happen specially with dates and times, which are common attributes when building API interfaces for example.&lt;/p&gt;
&lt;p&gt;The problem comes when we need to convert it as a JSON string. Take the following snippet:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;import json
from datetime import date

today = date.today()
dict = { 
  &#39;today&#39;: today,
  &#39;foo&#39;: &#39;bar&#39;
}
print(json.dumps(dict))
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This code will fail with the following error: &lt;code&gt;TypeError: Object of type date is not JSON serializable&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;To avoid this, we can pass the &amp;ldquo;default&amp;rdquo; argument to the dumps method:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;print(json.dumps(dict, default=str))
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This way, in case some type cannot be serialized, it will be converted to string.&lt;/p&gt;
</description>
     </item>
   
     <item>
       <title>Hello World</title>
       <link>/posts/hello-world/</link>
       <pubDate>Fri, 03 Jan 2020 12:53:29 +0000</pubDate>
       
       <guid>/posts/hello-world/</guid>
       <description>&lt;p&gt;The purpose of this blog is to share snippets and small steps to configure, programm or deploy web applications and in general any kind of software I have written.&lt;/p&gt;
&lt;p&gt;The first attempt is done with netlify cms, as a first try.&lt;/p&gt;
</description>
     </item>
   
 </channel>
</rss>
