<?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: Francesco</title>
    <description>The latest articles on DEV Community by Francesco (@depsir).</description>
    <link>https://dev.to/depsir</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%2F236294%2F39a21933-4c7f-4bac-b866-7309860a805a.jpeg</url>
      <title>DEV Community: Francesco</title>
      <link>https://dev.to/depsir</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/depsir"/>
    <language>en</language>
    <item>
      <title>Quick Guide: Node-RED with Free HTTPS on Oracle Cloud</title>
      <dc:creator>Francesco</dc:creator>
      <pubDate>Mon, 22 May 2023 18:42:34 +0000</pubDate>
      <link>https://dev.to/depsir/quick-guide-node-red-with-free-https-on-oracle-cloud-1g77</link>
      <guid>https://dev.to/depsir/quick-guide-node-red-with-free-https-on-oracle-cloud-1g77</guid>
      <description>&lt;p&gt;If you're looking for a simple way to install Node-RED on a server exposed in HTTPS for free, you've come to the right place! In this article, I will guide you through the necessary steps to properly set up your environment. Using HTTPS not only provides increased security but also enables OAuth flows that require a secure return URL.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Creating the Oracle Linux Machine with Free Tier Access
&lt;/h2&gt;

&lt;p&gt;To install Node-RED we take advantage of the Free Tier offering by Oracle Cloud, which provides access to some virtual machines at no cost.&lt;/p&gt;

&lt;p&gt;During the creation process, make sure to provide a unique name for your instance, as it will help you identify it later. You'll also have the opportunity to select the desired configuration options, such as the availability domain and instance shape. It's important to note that the Free Tier offers specific shape options.&lt;/p&gt;

&lt;p&gt;As part of the setup, you'll need to download the SSH key pair, which ensures secure access to your machine. Follow the provided instructions to download the key pair file. This key will be used for SSH access to your Oracle Linux machine.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Enabling Ingress Rules for Ports 80 and 443
&lt;/h2&gt;

&lt;p&gt;Access the Oracle Cloud control panel and enable the ingress rules for ports 80 and 443 on the subnet you're using for your machine. This will allow you to access your Node-RED application through HTTP and HTTPS protocols.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Creating a DDNS Record
&lt;/h2&gt;

&lt;p&gt;To have a custom domain name for your Oracle Cloud server, create a DDNS record using a service like &lt;a href="https://www.noip.com/"&gt;https://www.noip.com/&lt;/a&gt;. These services usualy offer custom third level domains for free.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Connect to your instance
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chmod 600 ssh-key-2023-05-23.key
ssh -i ssh-key-2023-05-23.key opc@testcamp.ddns.net
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 5: Setting Up the HTTPS Certificate
&lt;/h2&gt;

&lt;p&gt;Start by installing Certbot, a widely used tool for managing SSL/TLS certificates. Follow these commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo yum --disablerepo=* --enablerepo=ol8_developer_EPEL install -y snapd
sudo systemctl start snapd.service
sudo ln -s /var/lib/snapd/snap /snap
sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, open the firewall for ports 80 and 443:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo firewall-cmd --permanent --zone=public --add-port=80/tcp
sudo firewall-cmd --reload
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, run the command to obtain the certificate using Certbot:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo certbot certonly --standalone
sudo chmod -R 2755 /etc/letsencrypt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 5: Setting Up Node-RED
&lt;/h2&gt;

&lt;p&gt;Now that you have your HTTPS certificate, you can proceed with installing Node-RED. Use the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bash &amp;lt;(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/rpm/update-nodejs-and-nodered)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, redirect requests on port 443 to the Node-RED port (1880) with the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo iptables -t nat -I PREROUTING -p tcp --dport 443 -j REDIRECT --to-ports 1880
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, open the Node-RED configuration file using a text editor:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo vim /home/nodered/.node-red/settings.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Inside the file, look for the https section and add the path to your newly obtained certificates:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https: {
  key: require("fs").readFileSync('/etc/letsencrypt/live/testcamp.ddns.net/privkey.pem'),
  cert: require("fs").readFileSync('/etc/letsencrypt/live/testcamp.ddns.net/cert.pem')
},
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Save the file and restart Node-RED with the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo systemctl restart nodered
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusions
&lt;/h2&gt;

&lt;p&gt;Congratulations! You have successfully installed Node-RED on an Oracle Cloud server using the Free Tier access. This serves as a great starting point to explore the capabilities of Node-RED and develop your applications.&lt;/p&gt;

&lt;p&gt;While you have completed the essential steps outlined in this article, it's important to note that there may be additional steps or improvements that can be made based on your specific requirements. Consider exploring further documentation and resources to enhance the security, performance, and functionality of your Node-RED installation.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Persisting State in Node-RED: Making Your Automations More Reliable</title>
      <dc:creator>Francesco</dc:creator>
      <pubDate>Tue, 16 May 2023 08:27:04 +0000</pubDate>
      <link>https://dev.to/depsir/persisting-state-in-node-red-making-your-automations-more-reliable-1k1</link>
      <guid>https://dev.to/depsir/persisting-state-in-node-red-making-your-automations-more-reliable-1k1</guid>
      <description>&lt;p&gt;Node-RED is a powerful and user-friendly flow-based programming tool that enables rapid prototyping and automation development. Its intuitive visual interface and extensive library of pre-built nodes make it a popular choice for hobbyists and developers looking to create small-scale projects quickly. In this article, we'll explore different approaches to persisting state in Node-RED, with a focus on using the built-in contextStorage setting.&lt;/p&gt;

&lt;p&gt;Node-RED provides an in-memory storage mechanism called "context" that allows you to persist data within a flow or globally across all flows. The context can store variables, objects, or any other data needed for your automation. &lt;/p&gt;

&lt;p&gt;Flow Context: The flow context allows you to store data specific to a particular flow. This context is accessible to all nodes within the same flow and is ideal for storing flow-specific information.&lt;/p&gt;

&lt;p&gt;Global Context: The global context stores data that is accessible across all flows. It acts as a shared storage for multiple flows and can be useful when you need to maintain state information throughout your entire Node-RED instance.&lt;/p&gt;

&lt;p&gt;To use context, you can utilize the "context" object available within function nodes or the context-aware nodes provided by Node-RED. For instance, to set a value in flow context, you can use flow.set('key', value) and to retrieve it, use flow.get('key').&lt;/p&gt;

&lt;p&gt;By default, Node-RED's context is stored in memory only, which means that its contents are cleared whenever Node-RED restarts. However, starting from the 0.19 release, Node-RED introduced a new configuration option called "contextStorage," which allows you to save context data for persistence across restarts.&lt;/p&gt;

&lt;p&gt;With contextStorage, you can choose from different storage options, including local file system, a remote database, or custom storage mechanisms. The local file system storage is particularly convenient for small-scale projects. To enable context persistence via the local file system, add the following line to your Node-RED settings.js file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;contextStorage&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;default&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;module&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;localfilesystem&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once enabled, Node-RED will automatically save the context to files, ensuring that the data is available even after restarts.  &lt;/p&gt;

&lt;p&gt;Node-RED's simplicity and efficiency make it a preferred choice for rapid automation development. While it may not be initially designed for production-ready systems, it provides an excellent platform for building small pet projects or proof-of-concept prototypes. By utilizing the built-in contextStorage feature and persisting state in files, Node-RED becomes even more reliable, ensuring that your automations continue functioning seamlessly, even after restarts.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Unlock the Secrets of Automating DaVinci Resolve with Python - Free Version Edition</title>
      <dc:creator>Francesco</dc:creator>
      <pubDate>Tue, 02 May 2023 18:47:38 +0000</pubDate>
      <link>https://dev.to/depsir/unlock-the-secrets-of-automating-davinci-resolve-with-python-free-version-edition-1fkn</link>
      <guid>https://dev.to/depsir/unlock-the-secrets-of-automating-davinci-resolve-with-python-free-version-edition-1fkn</guid>
      <description>&lt;p&gt;DaVinci Resolve is one of the most widely used video editing software in the world. Its free version is already very powerful, but often lacks advanced features found in the paid version. However, using Python, it is possible to automate some editing operations even in the free version.&lt;/p&gt;

&lt;p&gt;Unfortunately, the official DaVinci Resolve documentation is not very clear on how to use Python. In addition, much of the information available online only applies to the paid version. In this article, we will show you a way to use Python in the free version of DaVinci Resolve.&lt;/p&gt;

&lt;p&gt;Secret 1: Putting the Python script in the right folder&lt;/p&gt;

&lt;p&gt;The free version does not allow standalone python scripts to interact with DaVinci Resolve as shown in many tutorials. Even the built in python console did not work well for me. The way I found to use Python in DaVinci Resolve is to put a Python file in the &lt;code&gt;~/Library/Application Support/Blackmagic Design/DaVinci Resolve/Fusion/Scripts/Edit&lt;/code&gt; folder. This will cause the file to appear in the "Workspace/Scripts" menu in DaVinci Resolve. To run the file, simply click on it in the "Scripts" menu. It is also possible to assign a shortcut for running the file, although sometimes this option doesn't work.&lt;/p&gt;

&lt;p&gt;Secret 2: The global variables&lt;/p&gt;

&lt;p&gt;When the script is run from the DaVinci Resolve menu, three variables will be available in your script: &lt;code&gt;resolve&lt;/code&gt;, &lt;code&gt;fusion&lt;/code&gt; and &lt;code&gt;bmd&lt;/code&gt;. This is the basis for interacting with the DaVinci Resolve program and it is possible to access many DaVinci Resolve functions and automate some editing operations.&lt;/p&gt;

&lt;p&gt;Secret 3: Documentation and sample files&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;/Library/Application Support/Blackmagic Design/DaVinci Resolve/Developer/Scripting&lt;/code&gt; folder contains a documentation file with the main functions and some sample files. More sample files can be found in the Scripts folder where close to where you put your script in secret 1. This documentation file is essential for using Python in DaVinci Resolve. The sample files are useful for understanding how to use the functions.&lt;/p&gt;

&lt;p&gt;A basic script could be something like this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;    &lt;span class="n"&gt;projectManager&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;GetProjectManager&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;project&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;projectManager&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;GetCurrentProject&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;timeline&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;project&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;GetCurrentTimeline&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;videoitem&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;timeline&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;GetCurrentVideoItem&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="p"&gt;...&lt;/span&gt; &lt;span class="n"&gt;do&lt;/span&gt; &lt;span class="n"&gt;something&lt;/span&gt; &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;timeline&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;video&lt;/span&gt; &lt;span class="n"&gt;item&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In conclusion, we have revealed the three secrets to automating DaVinci Resolve using Python in the free version.&lt;br&gt;
While the official documentation for Python in DaVinci Resolve may be lacking, with these three secrets, you can now begin automating editing operations and streamlining your workflow in the free version of this powerful video editing software.&lt;/p&gt;

</description>
      <category>davinciresolve</category>
      <category>python</category>
    </item>
    <item>
      <title>Use pip packages in DaVinci Resolve scripts</title>
      <dc:creator>Francesco</dc:creator>
      <pubDate>Sun, 30 Apr 2023 12:32:09 +0000</pubDate>
      <link>https://dev.to/depsir/use-pip-packages-in-davinci-resolve-scripts-42m8</link>
      <guid>https://dev.to/depsir/use-pip-packages-in-davinci-resolve-scripts-42m8</guid>
      <description>&lt;p&gt;As a content creator and a automation enthusiast, I've spent some time studying how to script my video editing workflow in DaVinci Resolve. I'm happy to share my findings because I've found that there isn't much documentation on this topic.&lt;/p&gt;

&lt;p&gt;As with regular programming, it's always beneficial to reuse modules written by others when creating scripts for DaVinci Resolve. These modules can be easily installed using pip, just like with any other Python project. &lt;/p&gt;

&lt;p&gt;However, it's important to note that the process for using custom modules in DaVinci Resolve is slightly different than it is for regular Python programming. &lt;/p&gt;

&lt;p&gt;In particular, you need to manually locate the Python folder used by DaVinci Resolve and install the module in the "site-packages" folder within that folder. Once installed, the module can be used just like any other module in your DaVinci Resolve scripts. &lt;/p&gt;

&lt;p&gt;To locate DaVinci Resolve's Python folder, I created script that logs &lt;code&gt;os.file&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;logging&lt;/span&gt;
&lt;span class="n"&gt;logger&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;logging&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;getLogger&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;logging&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;basicConfig&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;filename&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;'/absolutePath/forYourLogFile/log.log'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;level&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;logging&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;DEBUG&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;logger&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;debug&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;__file__&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After executing the script from DaVinci Resolve, you will see in the log file a line like &lt;code&gt;DEBUG:root:/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/os.py&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Open up a terminal and navigate to the bin directory, some levels up the path that was logged. In my case was &lt;code&gt;/Library/Frameworks/Python.framework/Versions/3.10/bin&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;From there you can install a custom Python module in DaVinci Resolve with the command &lt;code&gt;./pip3 install &amp;lt;module name&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;In your DaVinci Resolve script you will be able to import it with &lt;code&gt;import &amp;lt;module name&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;In conclusion, using Python modules in DaVinci Resolve can offer many opportunities for customizing and automating your workflow.&lt;/p&gt;

&lt;p&gt;I hope this article has been helpful to you and has provided you with the necessary information to use custom Python modules in DaVinci Resolve.&lt;/p&gt;

&lt;p&gt;This was tested with Resolve 18 on MacOs&lt;/p&gt;

</description>
      <category>davinciresolve</category>
      <category>python</category>
      <category>pip</category>
      <category>logs</category>
    </item>
  </channel>
</rss>
