<?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 Italo Lelis on Medium]]></title>
        <description><![CDATA[Stories by Italo Lelis on Medium]]></description>
        <link>https://medium.com/@italohdc?source=rss-83570f48a23f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*bHK_vncX8Zq_YzHtZDOwew.jpeg</url>
            <title>Stories by Italo Lelis on Medium</title>
            <link>https://medium.com/@italohdc?source=rss-83570f48a23f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 17:06:48 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@italohdc/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[LearnSnake: Teaching an AI to play Snake using Reinforcement Learning (Q-Learning)]]></title>
            <link>https://medium.com/@italohdc/learnsnake-teaching-an-ai-to-play-snake-using-reinforcement-learning-q-learning-b63ac23dfdd1?source=rss-83570f48a23f------2</link>
            <guid isPermaLink="false">https://medium.com/p/b63ac23dfdd1</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[q-learning]]></category>
            <category><![CDATA[reinforcement-learning]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Italo Lelis]]></dc:creator>
            <pubDate>Thu, 07 Jun 2018 17:22:28 GMT</pubDate>
            <atom:updated>2018-06-07T17:22:28.769Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*dn1DNGc2ZWUwhm_4tCfR0Q.gif" /><figcaption>Example of the AI Learning (<a href="https://italolelis.com/snake">Try it yourself</a>)</figcaption></figure><p>This is an implementation of an Artificial Intelligence fully written in <strong>Javascript</strong> that learns to play Snake using <strong>Reinforcement Learning</strong>. It runs directly in the browser, no installation is necessary.</p><p>See it working and tweak some variables <a href="https://italolelis.com/snake">here</a>.</p><p>You can check the <a href="https://github.com/italohdc/LearnSnake"><strong>GitHub Repository</strong></a><strong> </strong>to see the source code of the project.</p><p>The first question I was asked when I came up with this idea: “Why do you want to use Javascript instead of Python?”. I know Python has some libraries for scientific computing (like NumPy and TensorFlow), but I wanted something that worked right out of the box: no installation, running directly in the browser. This way, anyone can test and play with it without worrying about setting up a proper environment.</p><h3>Snake (the game itself)</h3><p>Snake is a game in which a snake needs to explore an environment and catch the fruit without hitting any obstacle or itself. Every time the snake catches a fruit, its size increases (for practical reasons explained in the next section, the snake has a fixed size in the <a href="https://italolelis.com/snake">live example</a>).</p><p>I could have forked another Snake repository, but since I didn’t know Javascript (and I would need to use it on the next steps), I thought that developing the Snake game from scratch would be a good idea to learn more about it.</p><p>To develop this part of the project, I used these contents for guidance:</p><ul><li><a href="https://www.youtube.com/watch?v=xGmXxpIj6vs">Coding “Snake” in 4 min 30 sec</a></li><li><a href="https://toddmotto.com/mastering-the-module-pattern/">Mastering the Module Pattern</a> (not really about Snake itself, but a pattern I tried to follow on the project)</li></ul><p>See <a href="https://github.com/italohdc/LearnSnake/blob/master/game.js">game.js</a> for the source code.</p><h3>Q-Learning</h3><p>Accordingly to <a href="http://www.cs.rhul.ac.uk/~chrisw/">Christopher Watkins</a>, “Q-Learning is a simple way for agents to learn how to act optimally in controlled Markovian domains” (<a href="https://link.springer.com/content/pdf/10.1007%2FBF00992698.pdf">Watkins, 1989</a>). In simple terms, it uses a MDP (<a href="https://en.wikipedia.org/wiki/Markov_decision_process">Markov Decision Process</a>) to control and make decisions in an environment. It consists of a Q-Table that is constantly updated.</p><p>A Q-Table is a matrix with a set of states and respective action’s probability of success. When the agent explore the environment, the table is updated. The action with the biggest value is considered the best action to make.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*54ipUupR7gSv6hJy.png" /><figcaption><em>Example of a QTable (the best action is highlighted)</em></figcaption></figure><p>In this guide I will explain how I applied Q-Learning in the Snake game. If you want to understand more deeply (yet in a simple way) about Q-Learning and Reinforcement Learning, I suggest <a href="https://medium.com/machine-learning-for-humans/reinforcement-learning-6eacf258b265">this post</a> by <a href="https://twitter.com/v_maini">Vishal Maini</a>.</p><p>See <a href="https://github.com/italohdc/LearnSnake/blob/master/q-learning.js">q-learning.js</a> for the source code.</p><h3>Algorithm</h3><p>The algorithm consists of:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/560/1*KhsKQWcNTiLpG7m7ab-Alg.png" /></figure><h4>Update Q-Table</h4><p>The new Q-Table value for the action accomplished is given by this formula (taken from the <a href="https://medium.com/machine-learning-for-humans/reinforcement-learning-6eacf258b265">article</a> by Vishal Maini):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Hb6NwQYHoVND_aQQ.png" /></figure><p>It’s executed after the action is taken and the reward is known.</p><h4>Actions</h4><p>Available actions are “<strong>UP</strong>”, “<strong>DOWN</strong>”, “<strong>LEFT</strong>” and “<strong>RIGHT</strong>”, simulating a user interaction with the game.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/274/1*-8PfHMLCLezBH6OQ8NVfjg.png" /></figure><p>The best action is selected by choosing the biggest action value in a certain state in the Q-Table. If the maximum value equals 0, a random action is selected.</p><h4>Reward</h4><p>The only reward is given when the <strong>snake grabs the fruit</strong> ( <strong>+1</strong> ). I tried also giving a small reward (approximately +0.1) when it successfully explored the environment without dying, but the result was that the snake only moved on the environment in circles without really caring about the fruit.</p><p>The penalty happens whenever the <strong>game resets</strong> ( <strong>-1</strong> ), that is, the snake hits its tail or a wall.</p><p>If anything else happens, there’s no reward ( <strong>0</strong> ).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/206/1*7qxFOadqadPL5qoIYjOgYw.png" /></figure><h4>States</h4><p>First I tried creating a dictionary of states based on <strong>all</strong> the snake positions and trail formats. Although it worked, because of the high number of states, it was necessary to let the code train for a very long time. Since this project was intended to give a fast explanation and to show a fast result to the user (and the results are not saved across sessions), this way to save states was not the best approach.</p><p>To work around this limitation, the tail got a fixed size and the dictionary of states is based only in the <strong>relative position of the fruit</strong> to the head of the snake and the <strong>relative position of the last tail section</strong> to the head of the snake.</p><p>In this way, the dictionary of states store the name like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/580/0*hFxjt6Zst66kTFAO.png" /></figure><p>The Q-Table is stored using a Javascript Object and looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/565/0*C2juv6pf55Bmeu5L.png" /><figcaption><em>Example of a Q-Table in the code</em></figcaption></figure><blockquote><em>If you want to test this algorithm with a full set of states, make some changes and explore it, you can clone the </em><a href="https://github.com/italohdc/LearnSnake"><em>project</em></a><em> on GitHub and change a few lines to see how it behaves.</em></blockquote><h4>Interesting Links</h4><ul><li><a href="https://github.com/hasanIqbalAnik/q-learning-python-example">Q-Learning-Python-Example </a>(an implementation of Q-Learning for the game “Catch the Ball”, which I used to understand the algorithm steps)</li></ul><p><em>Originally published at </em><a href="https://italolelis.com/snake"><em>italolelis.com</em></a><em> on June 6, 2018.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b63ac23dfdd1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Smooth Meshes on Unity3D (Mesh Subdivide)]]></title>
            <link>https://medium.com/@italohdc/smooth-meshes-on-unity3d-mesh-subdivide-b55a469bb518?source=rss-83570f48a23f------2</link>
            <guid isPermaLink="false">https://medium.com/p/b55a469bb518</guid>
            <category><![CDATA[unity3d]]></category>
            <category><![CDATA[modeling]]></category>
            <category><![CDATA[unity]]></category>
            <category><![CDATA[csharp]]></category>
            <dc:creator><![CDATA[Italo Lelis]]></dc:creator>
            <pubDate>Wed, 04 Apr 2018 19:06:20 GMT</pubDate>
            <atom:updated>2018-04-07T00:47:02.137Z</atom:updated>
            <content:encoded><![CDATA[<p>Graphical interfaces on computers work by discretizing an environment. For example, when you see a circle on your screen, it’s shaped by showing a finitude of dots (pixels) tangent to the circle. As there is a multitude of pixels to represent the circle, you have the perception that the circle is smooth, as you cannot see these individual pixels in naked eye.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/758/0*0lWk6LVmB1_DhVDG.jpg" /><figcaption><em>Raw vs Smooth Mesh</em></figcaption></figure><p>A similar thing happens when you’re dealing with meshes, but instead of circles or lines, you’re dealing with triangles in a 3D environment. <strong>A multitude of triangles tangents to the mesh connects to one another to forge the desired mesh shape.</strong> The more the triangles, the smoother and more similar to the original shape is the mesh.</p><p>Sometimes when you’re handling a mesh in Unity, it may look sharp on the edges. One of the easiest ways to correct this is to increase the number of triangles on the mesh.</p><p>When using this method (steps on how to reproduce it described below), you will get a result similar to this one:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BIGap5T_h9ZRnsrf.jpg" /><figcaption><em>Non-Smoothed vs Smoothed Mesh Comparison</em></figcaption></figure><blockquote><em>This method is specially helpful if you want to </em><strong><em>change the mesh shape in runtime</em></strong><em> (for example, if the user interacts with the application shaping the mesh).</em></blockquote><h3>How to setup</h3><p>To easily make a mesh smoother, you will need to create two scripts in your Unity project.</p><p>One script is responsible for the algorithm to subdivide the triangles in the mesh (available on <a href="http://wiki.unity3d.com/index.php/MeshHelper#Code">Unity Community Wiki</a>) and the other is an abstraction layer to show the user the available options to smooth the mesh.</p><h3>Import Scripts</h3><p>You must <strong>create two new scripts in C#</strong> (MeshHelper.cs and MeshSmoother.cs) and place them in your project folder as following:</p><pre>.<br>└── Assets<br>    └── Scripts<br>        ├── MeshHelper.cs<br>        └── MeshSmoother.cs</pre><h4>MeshHelper.cs</h4><p>Code available on <a href="http://wiki.unity3d.com/index.php/MeshHelper#Code">Unity Community Wiki</a>.</p><h4>MeshSmoother.cs</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8ced835cbf0d08806307b58cf7395109/href">https://medium.com/media/8ced835cbf0d08806307b58cf7395109/href</a></iframe><h3>Setup Script</h3><p>Now, you need to <strong>Add</strong> the script to the mesh you want to manipulate. Select the mesh in the scene list and, in the <strong>Inspector</strong> tab, search for Mesh Smoother.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/389/0*YbSpVNdix4RLZTeh.png" /></figure><p>To make the mesh smoother, you must tweak the options in the script.</p><p><strong>Subdivision Level</strong> [0–10]: The level in which the triangles of the mesh will be subdivided in smaller triangles.</p><p><strong>Times to Subdivide</strong> [0–10]: How many times to repeat the process of subdivision using the above <em>Subdivision Level</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/389/0*xHEpJ1eqLhOoB8jR.png" /></figure><blockquote><em>If you are going to modify the shape of the mesh during runtime, it’s recommended that you keep a low subdivision level and repeat the subdivision more times, as it will be less resourceful (and will achieve a higher FPS rate).</em></blockquote><p>This article was written based on the project <a href="https://github.com/lucascoelhof/unity-robot-teleoperation"><strong>Unity Robot Teleoperation</strong></a>.</p><p>Thanks to <a href="https://github.com/lucascoelhof">Lucas C. Figueiredo</a> and <a href="https://scholar.google.com.br/citations?user=jF9S_gMAAAAJ&amp;hl=en">Luciano C. A. Pimenta</a> for making this project possible.</p><p><em>Originally published at </em><a href="https://italolelis.com/posts/unity3d-smooth-mesh/"><em>italolelis.com</em></a><em> on April 4, 2018.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b55a469bb518" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I’m an Android user and have been for a number of years.]]></title>
            <link>https://medium.com/@italohdc/im-an-android-user-and-have-been-for-a-number-of-years-6483b981a86b?source=rss-83570f48a23f------2</link>
            <guid isPermaLink="false">https://medium.com/p/6483b981a86b</guid>
            <category><![CDATA[ux]]></category>
            <category><![CDATA[iphone]]></category>
            <category><![CDATA[user-experience]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[smartphones]]></category>
            <dc:creator><![CDATA[Italo Lelis]]></dc:creator>
            <pubDate>Tue, 20 Feb 2018 09:00:00 GMT</pubDate>
            <atom:updated>2018-02-20T15:47:25.089Z</atom:updated>
            <content:encoded><![CDATA[<h3>I’m an Android user and have been for a number of years. What can you say to convince me to switch to iOS?</h3><p>Dear Android User,</p><p>I’ve been an Android user for almost my entire smartphone usage life, but recently I’ve switched to an iPhone. The bigger difference I realized about iOS was not exactly about the apps being more polished, as some people point out (as there are cases in which Android apps seem to work better), but a difference in paradigm.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qqL2QWWWz--p5gfagPZ50Q.jpeg" /><figcaption>iPhone Home Screen</figcaption></figure><p>While in the Android universe you’re free to change and modify the system as you intend, the restrictions imposed in iPhone devices, although in first glance give the impression of keeping you locked, it actually makes you less obsessed in tweaking your device and, thus, give you more time to focus on what’s important, being it online or offline (I’m talking as a power user).</p><p>And something else I’ve been wondering about iOS was <em>“Why don’t they group notifications as in Android and make our life easier?”.</em> I realized that this keeps you less obsessed with your notifications (not having to constantly make it organized, thus spending less time on it) and then I came to the conclusion that it is part of the philosophy that your phone should be used as an auxiliary accessory, and not drive your life. I tried to make Android notifications not to be so invasive, but they are (at least for me), more addictive than the iOS counterpart.</p><p><strong>TL;DR: An iPhone makes it easier for me to get my work done in the end of the day than an Android device.</strong></p><p><em>This answer was originally published at </em><a href="https://www.quora.com/Im-an-Android-user-and-have-been-for-a-number-of-years-What-can-you-say-to-convince-me-to-switch-to-iOS/answer/Italo-Lelis?share=ae071f0c&amp;srid=hRanb["><em>quora.com</em></a><em> on January 24, 2018.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6483b981a86b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dear Tim Cookie…]]></title>
            <link>https://medium.com/@italohdc/dear-tim-cookie-1be0917e478b?source=rss-83570f48a23f------2</link>
            <guid isPermaLink="false">https://medium.com/p/1be0917e478b</guid>
            <category><![CDATA[funny]]></category>
            <category><![CDATA[iphone]]></category>
            <category><![CDATA[letters]]></category>
            <category><![CDATA[apple]]></category>
            <dc:creator><![CDATA[Italo Lelis]]></dc:creator>
            <pubDate>Mon, 13 Nov 2017 22:30:00 GMT</pubDate>
            <atom:updated>2017-12-10T01:17:39.569Z</atom:updated>
            <content:encoded><![CDATA[<p>Since my first iPod Touch, I haven’t been buying Apple products because they tend to be very expensive, but as a loyal fan of the brand, I got a used but barely new iPhone 5 (which only had a lot of scratch marks).</p><p>When I first used that device, I was impressed by the perfection the Apple team has put on this 2012 device with 2011 Android features. It run as smoothie as a 2013 low-end smartphone.</p><p>Unfortunately, probably because of my inappropriate use, as your customer service says, I went to sleep with my iPhone fully working (placed on my nightstand) and woke up with a bad screen.</p><p>To show you what happened on my iPhone, I’m gonna send attached a video I took with my low-end Motorola device from 2013 (which, by the way, works as intended :]) of the malfunctioning screen.</p><p>Sincerely,</p><p>​​Italo Lelis</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/0*zNax9Vmq7AbFRTls.gif" /><figcaption><em>flickering_screen.mp4</em></figcaption></figure><p>This is just a draft letter to Apple’s CEO as a funny joke based in a real situation that happened with me. Some facts are fictional. Thus, I referred to “Tim Cook” as “Tim Cookie” for humorous purposes and, in no way, I meant to harm his person.</p><p><em>Originally published at </em><a href="http://italolelis.com/posts/iphone5-flickering-screen/"><em>italolelis.com</em></a><em> on November 13, 2017.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1be0917e478b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Setting up Touchpad Gestures in your Ubuntu Laptop]]></title>
            <link>https://medium.com/@italohdc/setting-up-touchpad-gestures-in-your-ubuntu-laptop-dae7a5617f91?source=rss-83570f48a23f------2</link>
            <guid isPermaLink="false">https://medium.com/p/dae7a5617f91</guid>
            <category><![CDATA[gnome]]></category>
            <category><![CDATA[ubuntu]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[unity]]></category>
            <dc:creator><![CDATA[Italo Lelis]]></dc:creator>
            <pubDate>Sun, 24 Sep 2017 22:30:00 GMT</pubDate>
            <atom:updated>2018-08-17T21:44:46.651Z</atom:updated>
            <content:encoded><![CDATA[<p>If you ever used a MacBook (or if you have a Windows 10 laptop with a compatible touchpad), you know how pleasant and useful can be the trackpad gestures to change desktops, show all open windows and pinch-to-zoom. Beyond the visual effects, these tools are more intuitive than a keyboard shortcut and thus can improve our productivity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*QA7sKabkpHFhCD01.gif" /><figcaption><em>Exposé Gesture on Mac</em></figcaption></figure><p>Unfortunately these gestures are not available by default on the major Linux distributions. But thanks to <a href="https://github.com/iberianpig">Kohei Yamada</a>, who developed the application <a href="https://github.com/iberianpig/fusuma">Fusuma</a> in <a href="https://www.ruby-lang.org/en/">Ruby</a> to recognize multitouch input on the trackpad on Linux, shortcuts can be easily configured to different gestures.</p><p>The following tutorial, based on the <a href="https://github.com/iberianpig/fusuma/blob/master/README.md"><em>README</em></a> of the <a href="https://github.com/iberianpig/fusuma">Fusuma</a> project, will teach how to setup the environment for <strong>Unity</strong> and <strong>GNOME</strong> in Ubuntu 16.04 (it also works on Ubuntu 18.04, but you may find some issues if you’re using Wayland instead of Xorg).</p><p>Fusuma also work in some others Ubuntu-Based distros, like Elementary OS.</p><h3>Installing Fusuma</h3><p>First of all, your user must be a member of the <em>input</em> group, so the application can read the touchpad inputs. If your user isn’t a member, or if you don’t know what it means, run the following command in the terminal:</p><pre>sudo gpasswd -a $USER input</pre><p>You must logout and login again for the changes to take effect.</p><p>Then, you shall install libinput-tools and xdotool. For that, run the commands:</p><pre>sudo apt-get install libinput-tools</pre><pre>sudo apt-get install xdotool</pre><p>Now, install the application Fusuma:</p><pre>gem install fusuma</pre><h3>Configuring the Gestures</h3><p>In your home directory, go to the folder ~/.config and create the folder fusuma inside of it. Now you must create a file config.yml, in which you will declare the shortcuts and gestures you want. After some tests, I found a group of gesture configurations that best switched for me and had a fluid, yet precise, movements. These are best setup I’ve found for config.yml:</p><blockquote>The folder path must be all in lower case, as it is case sensitive.</blockquote><h4>For Unity:</h4><pre>swipe:<br>  3: <br>    left: <br>      command: &#39;xdotool key alt+Right&#39;<br>    right: <br>      command: &#39;xdotool key alt+Left&#39;<br>    up: <br>      command: &#39;xdotool key super+w&#39;<br>    down: <br>      command: &#39;xdotool key Escape&#39;<br>  4:<br>    left: <br>      command: &#39;xdotool key ctrl+alt+Right&#39;<br>    right: <br>      command: &#39;xdotool key ctrl+alt+Left&#39;<br>    up: <br>      command: &#39;xdotool key ctrl+alt+Down&#39;<br>    down: <br>      command: &#39;xdotool key ctrl+alt+Up&#39;<br>pinch:<br>  in:<br>    command: &#39;xdotool key ctrl+plus&#39;<br>  out:<br>     command: &#39;xdotool key ctrl+minus&#39;<br><br>threshold:<br>  swipe: 0.4<br>  pinch: 0.4<br><br>interval:<br>  swipe: 0.8<br>  pinch: 0.1</pre><p>To start the program and test if everything is working, run in terminal the command:</p><pre>fusuma</pre><p>These are the gestures and respective actions:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/365/1*6r4o5e395GNfaj4pFmB8gg.png" /><figcaption>List of Gestures on Unity</figcaption></figure><blockquote><em>If you get a error message about the touchpad input and want to test if fusuma is working before restarting your computer, you can run it as a superuser: </em><em>sudo fusuma.</em></blockquote><h4>For GNOME:</h4><pre>swipe:<br>  3: <br>    left: <br>      command: &#39;xdotool key alt+Right&#39;<br>    right: <br>      command: &#39;xdotool key alt+Left&#39;<br>    up: <br>      command: &#39;xdotool key super&#39;<br>    down: <br>      command: &#39;xdotool key super&#39;<br>  4:<br>    left: <br>      command: &#39;xdotool key ctrl+alt+Down&#39;<br>    right: <br>      command: &#39;xdotool key ctrl+alt+Up&#39;<br>    up: <br>      command: &#39;xdotool key ctrl+alt+Down&#39;<br>    down: <br>      command: &#39;xdotool key ctrl+alt+Up&#39;<br>pinch:<br>  in:<br>    command: &#39;xdotool key ctrl+plus&#39;<br>  out:<br>     command: &#39;xdotool key ctrl+minus&#39;<br><br>threshold:<br>  swipe: 0.4<br>  pinch: 0.4<br><br>interval:<br>  swipe: 0.8<br>  pinch: 0.1</pre><p>To start the program and test if everything is working, run in terminal the command:</p><pre>fusuma</pre><p>These are the gestures and respective actions:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/363/1*zhiw4OrY7RePtKE349YWsQ.png" /><figcaption>List of Gestures on GNOME</figcaption></figure><p>If you are using the GNOME desktop and nothing happens, you must ensure the Touchpad events are being received:</p><pre>gsettings set org.gnome.desktop.peripherals.touchpad send-events enabled</pre><p>Logout and login back for the changes to take effect and run Fusuma again.</p><blockquote>If you get a error message about the touchpad input and want to test if fusuma is working before restarting your computer, you can run it as a superuser: sudo fusuma.</blockquote><h3>Launch Fusuma on Startup</h3><h4>For Unity:</h4><p>On the Unity Menu, search for Startup Applications.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/476/0*S511VCYLZHGocaAu.png" /><figcaption><em>Unity Search Menu</em></figcaption></figure><p>Open the program and click the button <em>Add</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*xxJ2YrmzgvQVM-PmTxHlAw.png" /><figcaption>Startup Applications Preferences</figcaption></figure><p>In the field <em>Name</em> write Fusuma and in the field <em>Command</em> write fusuma.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/441/1*T66teMwYPiUi4rbrwTsFvA.png" /><figcaption>Add Startup Program</figcaption></figure><p>Now you can restart your computer and Fusuma will run as soon as you login.</p><h4>For GNOME:</h4><p>On the GNOME Menu, search for Startup Applications.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/604/0*3gC1c333MnbtW_SD.png" /><figcaption><em>GNOME Search Menu</em></figcaption></figure><p>Open the program and click the button <em>Add</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*xxJ2YrmzgvQVM-PmTxHlAw.png" /><figcaption>Startup Applications Preferences</figcaption></figure><p>In the field <em>Name</em> write Fusuma and in the field <em>Command</em> write fusuma.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/441/1*T66teMwYPiUi4rbrwTsFvA.png" /><figcaption>Add Startup Program</figcaption></figure><p>Now you can restart your computer and Fusuma will run as soon as you login.</p><p><em>Originally published at </em><a href="http://italolelis.com/posts/multitouch-gestures-ubuntu-fusuma/"><em>italolelis.com</em></a><em> on September 24, 2017.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dae7a5617f91" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Configurar uma Raspberry Pi Zero W sem monitor]]></title>
            <link>https://medium.com/@italohdc/configurar-uma-raspberry-pi-zero-w-sem-monitor-95845f5a2b70?source=rss-83570f48a23f------2</link>
            <guid isPermaLink="false">https://medium.com/p/95845f5a2b70</guid>
            <category><![CDATA[diy]]></category>
            <category><![CDATA[portuguese]]></category>
            <category><![CDATA[raspberry-pi]]></category>
            <dc:creator><![CDATA[Italo Lelis]]></dc:creator>
            <pubDate>Mon, 11 Sep 2017 07:32:02 GMT</pubDate>
            <atom:updated>2017-09-18T03:04:17.457Z</atom:updated>
            <content:encoded><![CDATA[<p>A Raspberry Pi Zero W é um computador com menos de 3 polegadas e que custa aproximadamente $10. O seu tamanho reduzido, a presença de conexão Wi-Fi e Bluetooth, além do fato de conseguir rodar um sistema operacional Linux, o torna ideal para a criação de pequenos servidores, projetos que utilizam linguagens de alto nível (como Python e JavaScript) ou o controle/leitura de dispositivos eletrônicos (possui 36 portas GPIO).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nqzA9iQy6A7arI2Q.jpg" /><figcaption><em>Raspberry Pi Zero W ao centro</em></figcaption></figure><p>O modo mais fácil de fazer a configuração inicial é utilizando um monitor, mouse e teclado. Porém, pode acontecer de você não ter um monitor extra disponível para conectar à sua Raspberry. Como apontado pelo site australiano <a href="https://core-electronics.com.au/tutorials/raspberry-pi-zerow-headless-wifi-setup.html">Core Eletronics</a>, é possível utilizar a Raspberry sem um monitor. Essa forma de utilizar o dispositivo é chamado <strong>Headless Mode</strong>.</p><p>O guia a seguir apresentará o passo a passo de como instalar e configurar o acesso remoto ao sistema Raspbian na sua Raspberry. Para controlar a Raspberry remotamente, será necessário que o seu computador e a Raspberry estejam conectados à mesma rede Wi-Fi.</p><blockquote><em>Uma outra opção de Sistema Operacional para utilizar na Raspberry é o </em><a href="http://dietpi.com/"><em>DietPi</em></a><em>, que é baseado no Raspbian, porém é mais leve.</em></blockquote><h3>Configurando o acesso remoto à Raspberry sem um monitor</h3><p>Primeiramente, será necessário baixar uma imagem do <a href="https://www.raspberrypi.org/downloads/raspbian/">Raspbian</a> (o Raspbian é um sistema operacional Linux baseado no Debian otimizado para o hardware da Raspberry Pi) e instalar num cartão <strong>microSD</strong>.</p><h4>Instalando o Raspbian no cartão microSD (Windows)</h4><p>Para instalar o Raspbian no cartão microSD, será necessário o programa <a href="https://sourceforge.net/projects/win32diskimager/">Win32DiskImager</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/482/0*ch7cokPuTYkyTTmH.png" /><figcaption><em>Win32 Disk Imager</em></figcaption></figure><ol><li>Descompacte a imagem do Raspbian baixada. Se não conseguir descompactar o arquivo, tente usar o <a href="http://www.7-zip.org/download.html">7-Zip</a>.</li><li>Selecione no programa o o arquivo .img descompactado e a letra da unidade que está localizado o cartão de memória. Por exemplo, letra E:.</li><li>Após conferir que a imagem e o dispositivo selecionados estão corretos, selecione no programa a opção Write. (Essa etapa pode demorar um pouco, dependendo da velocidade de gravação do seu cartão microSD)</li></ol><h4>Configurando a conexão Wi-Fi</h4><p>Na nova partição boot criada no cartão de memória, crie um arquivo com o seguinte nome:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/979/1*rJmbD3ljfNMR-EXnK9HBdw.png" /><figcaption><em>Organização de pastas da unidade de boot</em></figcaption></figure><p>Edite o arquivo criado e adicione os seguintes parâmetros:</p><pre>network={<br>   ssid=&quot;SSID&quot;<br>   psk=&quot;PASSWORD&quot;<br>   key_mgmt=WPA-PSK<br>}</pre><p>Lembrando de substituir SSID pelo nome da sua rede Wi-Fi e PASSWORD pela senha da sua rede Wi-Fi. O parâmetro key_mgmt refere-se ao protocolo de segurança utilizado pela rede.</p><h4>Ativando SSH</h4><p>As novas versões do Raspbian vêm com <em>SSH</em> desativado por padrão, por questões de segurança. O <em>SSH</em> é um protocolo de rede que será utilizado para fazer a comunicação entre o seu computador e a Raspberry.</p><p>Ainda no diretório principal da unidade boot do cartão de memória, crie um arquivo vazio com o nome ssh</p><h4>Conectando à Raspberry remotamente</h4><p>Os arquivos no cartão de memória estão devidamente configurados. Desconecte o cartão microSD do computador e conecte à sua Raspberry Pi. Conecte a Raspberry a uma fonte de alimentação e espere um momento enquanto é realizado o boot do sistema.</p><p>No seu computador, será utilizado o cliente <a href="https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html">Putty</a> no Windows para conectar à Raspberry.</p><p>O Raspbian vem configurado por padrão com o seguinte hostname:</p><p>Entre com esse <em>hostname</em> no Putty para conectar à sua Raspberry Pi.</p><blockquote><em>Se você não conseguir conectar à sua Raspberry através do hostname, procure pelo IP associado a ela no roteador. </em><a href="https://www.raspberrypi.org/documentation/remote-access/ip-address.md"><em>O site oficial da Raspberry Pi apresenta outras formas de se descobrir o endereço IP do sistema</em></a><em>.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/0*mDL9dSowwGmXvvJh.png" /><figcaption><em>Putty</em></figcaption></figure><p>Se tudo ocorrer corretamente, aparecerá uma janela pedindo as informações de login e senha para acessar o sistema operacional da Raspberry. O usuário padrão é pi e a senha é raspberry.</p><p>Fontes: <a href="http://trendblog.net/install-raspbian-sd-card-os-x-windows/">Trendblog</a>, <a href="https://core-electronics.com.au/tutorials/raspberry-pi-zerow-headless-wifi-setup.html">Core Electronics</a>, <a href="https://www.raspberrypi.org/documentation/remote-access/ssh/windows.md">Raspberry Pi Foundation</a></p><p><em>Originally published at </em><a href="http://italolelis.com/posts/configurar-rasp0-sem-monitor/"><em>italolelis.com</em></a><em> on September 11, 2017.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=95845f5a2b70" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[IoT] Como fazer upload de códigos para a ESP8266 via Wi-Fi]]></title>
            <link>https://medium.com/@italohdc/iot-upload-de-c%C3%B3digos-para-a-esp8266-via-wi-fi-d8ebd9e22dff?source=rss-83570f48a23f------2</link>
            <guid isPermaLink="false">https://medium.com/p/d8ebd9e22dff</guid>
            <category><![CDATA[internet-of-things]]></category>
            <category><![CDATA[esp8266]]></category>
            <category><![CDATA[iot]]></category>
            <category><![CDATA[portuguese]]></category>
            <category><![CDATA[diy]]></category>
            <dc:creator><![CDATA[Italo Lelis]]></dc:creator>
            <pubDate>Mon, 28 Aug 2017 05:46:46 GMT</pubDate>
            <atom:updated>2017-09-07T07:43:17.554Z</atom:updated>
            <content:encoded><![CDATA[<p>O módulo <a href="https://www.embarcados.com.br/modulo-esp8266/">ESP8266</a> da <a href="http://espressif.com/en">Espressif</a>, que vem com Wi-Fi integrado, permite o rápido desenvolvimento de protótipos que necessitam conectividade à internet, o que o torna adequado para projetos de IoT (<em>Internet das Coisas</em>). Além disso, uma outra vantagem da conectividade Wi-Fi é a possibilidade de enviar o código a ser executado no módulo sem a necessidade de fios, como apontado pelo blog do <a href="http://pedrominatel.com.br/pt/esp8266/ota-como-programar-o-esp8266-pelo-wifi-no-platformio/">Pedro Minatel</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*Lpr0M2m-dub0_FosJIr_dQ.jpeg" /><figcaption>Módulo Wi-Fi NodeMcu ESP8266</figcaption></figure><p>Neste tutorial, será explicado passo a passo como descarregar um <em>firmware</em> para a ESP8266 sem fios (<em>over-the-air</em>).</p><h3>Instalando o PlatformIO</h3><p>O <a href="http://platformio.org/">PlatformIO</a> é uma IDE <em>open-source</em> voltado para o desenvolvimento de aplicações IoT. É desenvolvida em Python e roda em cima do editor de texto <a href="https://atom.io/">Atom</a>.</p><p>Caso você já tenha o Atom instalado, pode instalar o PlataformIO seguindo as <a href="http://platformio.org/get-started/ide?install=atom">instruções na página oficial</a>.</p><h3>Criar novo projeto</h3><p>Caso a instalação ocorra corretamente, após reiniciar o Atom, você será recebido com uma janela de boas-vindas. Selecione a opção <em>New Project</em> para criar um novo projeto para a ESP8266.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mqgtl02bYP93RymQ2yqAxg.png" /><figcaption>Janela de Boas-Vindas do PlatformIO</figcaption></figure><p>Na janela de configurações que se abrir, seleciona a placa que será utilizada no projeto.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*Qk86Xb34mx25g3yO8a79Yg.png" /><figcaption>Janela de configuração de Novo Projeto do PlatformIO</figcaption></figure><blockquote><em>Para este tutorial, estou utilizando um </em><a href="https://www.filipeflop.com/produto/modulo-wifi-esp8266-nodemcu-esp-12/"><em>Módulo ESP8266 NodeMCU v3</em></a><em>, que é uma placa de desenvolvimento que possui a ESP8266 integrada. Você deve escolher o modelo da placa que irá utilizar.</em></blockquote><h3>Upload do firmware inicial</h3><p>Na primeira vez que for configurar a sua ESP8266 para receber as atualizações via Wi-Fi, será necessário descarregar um código via USB. O código a ser utilizado utilizará a biblioteca <a href="https://github.com/esp8266/Arduino/tree/master/libraries/ArduinoOTA">ArduinoOTA</a>. A biblioteca deverá ser colocada dentro da pasta lib do projeto, da seguinte forma:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/242/1*5SW5dMtA_JmRhLB2in56SA.png" /><figcaption>Organização dos arquivos na pasta <strong>lib</strong></figcaption></figure><p>Você pode usar o código de exemplo fornecido pela biblioteca para fazer a gravação na ESP8266. O arquivo deve ser salvo dentro da pasta src com a extensão <em>.ino</em>. Por exemplo, src/esp8266_ota.ino.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0d8d2ac9c63509dcef51dbd673917fae/href">https://medium.com/media/0d8d2ac9c63509dcef51dbd673917fae/href</a></iframe><p>Para configurar corretamente o código de exemplo, substitua SSID pelo nome da sua rede Wi-Fi:</p><pre>const char* ssid = &quot;SSID&quot;;</pre><p>E SENHA pela senha da sua rede Wi-Fi:</p><pre>const char* password = &quot;SENHA&quot;;</pre><p>Descarregue o código de exemplo para a ESP8266.</p><blockquote><em>Caso não consiga fazer upload do código no Ubuntu, tente rodar o Atom como usuário root, usando o comando </em><em>sudo atom em um terminal, ou adicione o seu usuário à lista de permissão de acesso às portas seriais com o comando </em><em>sudo usermod -a -G dialout $USER e reinicie o seu computador.</em></blockquote><p>Abra o Serial Monitor e pressione o botão de <em>reset</em> na placa para consultar o IP local do seu módulo.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bkH3XGuwBbrx_Fxm8aqZkg.png" /><figcaption>Serial Monitor</figcaption></figure><h3>Configurando o upload sem fio no PlatformIO</h3><p>Será necessário alterar o arquivo platformio.ini. Adicione ao arquivo a linha:</p><pre>upload_port = 192.168.0.22</pre><p>Alterando o valor para o endereço de IP mostrado no Serial Monitor.</p><p>Caso você deseje dar um nome à placa, para que não seja necessário consultar o endereço de IP constantemente, adicione um nome à sua ESP8266 na linha:</p><pre>ArduinoOTA.setHostname(&quot;nome_personalizado&quot;);</pre><p>Substitua o endereço IP no arquivo platformio.ino pelo nome definido, como no exemplo a seguir:</p><pre>upload_port = nome_personalizado.local</pre><p>Lembrando que é necessário que o seu computador e a placa estejam conectados à mesma rede Wi-Fi.</p><h3>Código de teste (Piscar LED)</h3><p>Agora, mesmo se você desconectar a placa do computador e ligar a uma alimentação externa, será possível descarregar os seus códigos.</p><p>Caso você queira testar se o envio do código está funcionando corretamente, altere o void loop () do código de exemplo, adicionando o comando de piscar o LED interno, e faça upload do código:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a5ff1e3fcf093da38bcda66989ff1f46/href">https://medium.com/media/a5ff1e3fcf093da38bcda66989ff1f46/href</a></iframe><blockquote><em>No módulo NodeMCU, o LED interno está ligado à porta GPIO 2. Você deve consultar o GPIO correspondente para a sua placa.</em></blockquote><p>O código final a ser utilizado deve conter as funções e chamadas do código de exemplo da biblioteca ArduinoOTA, pois o novo código que for descarregado irá sobrescrever o código presente na memória flash. Ou seja, caso você não adicione a biblioteca ArduinoOTA e as suas funções no novo código descarregado, não será mais possível fazer upload de códigos sem fio e o próximo upload deverá ser feito novamente via porta USB.</p><p><em>Originally published at </em><a href="http://italolelis.com/posts/upload-ESP8266-OTA/"><em>www.italolelis.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d8ebd9e22dff" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>