Interview based on Leetcode questions… you are doing it wrong

I noticed a huge trend of interviewers, specially the young professionals using algorithms and problems discussed in Leetcode. There are people that studies months or even years all the exercises trying to pass in an interview most part of the time memorizing them.

Honestly, if you, the interviewer, you were hired because you took hours and hours resolving the problems from sites like Leetcode, congratulations!!! there is a huge chance you are another useless resource for your organization.

A lot of candidates they even know how to start a webserver, they do not know how a microcontroller works, how a RTOS works, or don’t know when to use a SQL or NoSQL database in a system. But do they know how to resolve an exercise where the little frog must to jump in N possible stones obeying a specific rules.

Let’s be honest.. if you are hiring someone to develop features in React… just ask the person questions that are relevant to the job, or even try to explore if this person has side project and what they are… That candidate that took months studying how the frog must to jump stones will not resolve your issues. Besides that, check the skillset and how you can use his/her skillsets in your product, check how the candidate work in a team, how he/she reacts for last minute changes, if it is able to understand how your system or product must work and the most important thing, if the developer has passion for his/her work. Does the algorithm you are asking to resolve will really tell us if the candidate is a good fit ?

There is NOTHING wrong with Leetcode. I am not against Leetcode because it is just a tool that helps us to exercise and understand different algorithms, and to chat ideas with the community and understand how to things can be resolved differently.

Please, go beyond Leetcode. Your employeer will be thankful in the future.


Integrating Haskell with ATOM Editor on Ubuntu

I am a cryptocurrency investor, developer, miner and bitcoin professional certified by C4. Among several researches and enthusiasm on crypto world, there is a project that is my favorite. The name of this project is Cardano and brings a cryptocurrency called ADA. Cardano is a project involving several scientists, professors of renowned universities and system architects that created over 40 high quality white-papers describing the network synergy. Cardano and its products are being developed by a company called IOHK in collaboration with open source community and other third-party companies.  According the founder and CEO of IOHK, Charles Hoskinson, Cardano is classified as a cryptocurrency generation 3, based on PoS (Proof of Stake), smart-contracts with a decentralized network but much more scalable and sustainable when compared to old generations like Bitcoin and Ethereum.

Most part of the code is based on Haskell which is a functional language that works in a very different way when we compare with sequential and imperative languages like C, C++, Java, etc.

The idea of this post is to create a guide how to integrate Haskell with Atom editor on Ubuntu OS and help you to learn Haskell fast with a good IDE. The Ubuntu distro used on this post was version 19  but you also can use the procedure explained on this post in older versions as well.

More information about Cardano (ADA) please visit:

Before we start!

The procedure here will be using Stack tool set for Haskell. I literally was not able to make that work with GHC compiler superior to 8.0.2 due to several dependence of ghc-mod which is used as intermediary between the back-end (Stack) and or front-end (Atom). 

Continue reading

God does not play dice – chromosome, nucleotide and bits.

First of all this is not a technical post neither a computer science post. Also, this is not a religious topic. We will talk about chromosomes, nucleotide how this can make me think there is a God or expanding to our cosmos a possible “Architect of Universe”. I am enjoying a short vacation, thus I reserve myself the right to think in something else besides code.

Sometime ago I was doing a training in Python to explore and analyse DNA sequences. A very basic introduction to chromosomes but something beyond that class really intrigued me.

Each single cell in human body has 23 chromosome and each chromosome has 5 BILLION nucleotide.

Each nucleotide is composed by a base, a phosphate and a deoxyribose (sugar).

The base can be formed by 4 different elements:





As you can see, the variance in a nucleotide is the base. So if the base has 4 different options and each chromosome is composed until 5 billion nucleotide then

5 billion nucleotide x 4 = 20 billion of possible "bits"

20 billion possible bits in a nucleotide!!!! Continue reading

X86 Assembly and the importance of AES instruction set – part #1

After 2009, Intel introduced a new instruction set created to perform AES (Advanced Encryption Standard). The encryption and decryption occurs on silicon level which speeds up the performance for applications that make properly usages of these instructions.
One famous usage of AES instruction set is the Monero coin in crypto-currency scenario. Monero is a cryptocoin that might be mined using regular CPUs that support AES. You actually can mine the coin using old processor if your miner implemented a AES software based but considering the actual difficult level of this crypto-currency and the poor hash/s, you will lose money if your intentions are profit (it is ok if you are just making an educational experiment).


In order to make this post clear not only for assembly programmers I will give you a quick introduction about X86 Assembly using Intel syntax and how to call assembly function from C/C++ programs. Of course I will not cover the full assembly language. I hope this introduction is enough to make you understand the AES implementation.

The X86 Architecture

The X86 architecture is composed by segment registers, general purposes registers, flags, instruction pointer register and float point units. Check the figure below:

The RAX register is a 64 bits register, that also contains the 32 bits register EAX. In other hand, it is possible to access the lower 16 bits of EAX if AX identifier is used in the intructions set. Finally, it is possible to access the lower and higher 8 bits of AX, using AL and AH respectively.

Not all registers can have their 32, 16 or 8 bits accessible by sub-registers like EAX, AX, AH and AL.

General-Purpose Registers

The following table contains the general purpose registers for 32 and 64 bits.


Continue reading

Running Processes When Your Screen is Locked Only Using C#

Imagine the following situation. You have a heavy process that execute some tasks not so important during your regular day. However, you would like to keep this processing running when your screen is locked and kill when your screen is unlocked.

A typical example is mining blockchains. Some cryptocoins like Monero can be mined using CPU .. yeah.. I know GPUs are better but mining Monero is still feasible using CPUs (specially Intel Xeon).

This is a very simple but useful software written in C# and runs as a hidden Windows console application in order to avoid any annoyance.

[sourcecode language=”cpp”]
using System;
using System.Diagnostics;
using Microsoft.Win32;
using System.Runtime.InteropServices;

namespace dws
class Program

static extern IntPtr GetConsoleWindow();

static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);

const int SW_HIDE = 0;
const int SW_SHOW = 5;

private static SessionSwitchEventHandler sseh;

static void Main(string[] args)

var handle = GetConsoleWindow();
ShowWindow(handle, SW_HIDE);

sseh = new SessionSwitchEventHandler(SystemEvents_SessionSwitch);
SystemEvents.SessionSwitch += sseh;

while (true) {


static void SystemEvents_SessionSwitch(object sender, SessionSwitchEventArgs e)
if (e.Reason == SessionSwitchReason.SessionLock)
//desktop locked
else if (e.Reason == SessionSwitchReason.SessionUnlock)
//desktop unlocked


private static void startMiner()

Process process = new Process();
process.StartInfo.FileName = "your_process.exe";
process.StartInfo.Arguments = "your_arguments";
process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;


private static void killProcess()
foreach (Process proc in Process.GetProcessesByName("your_process"))
catch (Exception ex)


How hack the Android boot.img with no compilation


There are two very cool tools (unmkbooting and mkbootimg) that allows you to hack your boot.img and make changes in the ramdisk including the init.rc very quickly and faster than compilation. You actually do not need to compile anything, just using a Linux machine (I am using Ubuntu 12.04 64bits), install the two tools and run the procedure below:

  • Install install these two tools in your linux machine:


and them,

Continue reading

OpenCV and Emotion Recognition Using Intel Galileo Gen 2

Using OpenCV

This is part of the book “Intel Galileo and Intel Galileo Gen 2 – API Features and Arduino Projects for Linux Programmers”You can download for free using this link


Open source Computer Vision (OpenCV) is a set of cross-platform libraries containing functions that provide computer vision in real time.

Open source Computer Vision (OpenCV) is a set of cross-platform libraries containing functions that provide computer vision in real time.

OpenCV is huge framework and there are some basic functions needed to capture and process videos and images V so that they can communicate with input devices, such as a webcams. This chapter introduces the basic concepts needed to build powerful applications with your Intel Galileo board. The project will focus on how to connect a webcam to Intel Galileo, how the webcam works in Linux, how to capture pictures and videos, how to change the pictures with OpenCV algorithms, and how to detect and recognize faces and emotions.

BSP (board support package) SD card images of the Intel Galileo board support OpenCV and allow projects like the one in this chapter to be developed.

Several programs and tasks will be executed in this project. They are divided into Video4Linux and OpenCV categories as follows:

  1. Identify the capabilities of webcam with V4L2.

  2. Capture pictures using V4L2.

  3. Capture videos using V4L2.

  4. Capture and process images with OpenCV.

  5. Incorporate edge detection in your pictures with OpenCV.

  6. Incorporate face and eye detection with OpenCV.

  7. Detect emotions with OpenCV.


Note that the V4L2 examples use C and the OpenCV examples are written in C++ and Python. This is done to illustrate the performance of OpenCV in different languages and its cross-platform capabilities.

OpenCV Primer

OpenCV was developed by Intel research and is now supported by Willow Garage under the open source BSD license.

But what is computer vision and what is used for? Computer vision is the ability to provide methods and algorithms that help computers interpret the environment around them. Human eyes are able to capture the environment around us stereographically. They send the images to our brains, which interpret the images with a sense of depth, format, and dimension to all the components that compose an image.

For example, when you look at a dog in a park, you can tell how far the dog is from you, where exactly the dog is, whether you know the dog and his name, the format of the objects in the park such as sandboxes, trees, and parked cars, if it is going to rain or not, and so on.

A three-month old baby can identify objects and faces in a process that looks so natural for human beings.

What about computers? How do we program computers to use the same kind of analysis and come to the same conclusions when analyzing a simple picture of the park?

Several mathematic models, static data, and machine learned methodologies have being developed hat allow computers to “see” the world and understand the environment around them.

Robots use computer vision to assemble cars, recognize people, help patients in hospitals, and replace astronauts in dangerous missions in the space. In the future they will be able to replace soldiers in the battlefield, perform surgeries with precision, and more.

The OpenCV libraries offer a powerful infrastructure that enables developers to create sophisticated computer vision applications, abstracting all mathematic, static, and machine learning models out of the application context.

It is important to understand how V4L2 works because sometimes OpenCV throws some “mysterious” messages related to issues with V4L2. If you focus exclusively in OpenCV, it will be difficult to understand what is going on and how to fix these issues. These “mysterious” messages are related to V4L2 and not to OpenCV, which can be confusing.

If you need more details about how the algorithms works, visit the OpenCV website ( and improve your knowledge with books dedicated exclusively to OpenCV and image processing.

Project Details

This project requires a webcam to serve as Intel Galileo’s “eyes” to capture pictures and videos and apply algorithms using OpenCV. If you are using Intel Galileo, you will also need an OTG-USB adapter in order to connect the webcam because, unlike Intel Galileo Gen2, Intel Galileo does not have an OTG-USB connector.

You’ll need to generate a custom BSP image that contains all the tools and software packages that will be used. You can also download the BSP image from the code folder and copy it to the micro SD card, which will save you hours building with Yocto. The tools and ipks packages used in this chapter require more space than the SPI images can support, thus a micro SD card is necessary.

To focus directly on the OpenCV examples, it is necessary to understand the capabilities of your webcam, like the resolution, encodes, and frames per second that are supported. Understanding these capabilities using V4L2 will prevent you from wasting hours trying to decipher errors that in fact do not come from OpenCV but from V4L2.

Continue reading



DBASEII and Mr. SPOCK: Today we lost our first officer Mr Spock leaving definitely the Enterprise star-ship but not our hearts. Few people really knows the importance of Mr Spock on influencing our modern databases. In 1979, a programmer called Wayne Ratlif created a database that could accept common English words like “find”, “insert”, “append”, “browse”, etc.. Wayne worked for Jet Propulsion Laboratories in Pasadena.

It was possible also to display messages in the screen creating menus, print data and have real applications trying to bring the natural manner that Mr Spock accessed data in the sophisticated Enterprise. The database received the name of Mr. Spock home planet, in other words, Vulcan. Later the software turns commercial and it was renamed as DBASEII even not having a first version… Vulcan or DBASEII was able to run in 24KRAM computers based on Z80 processor until huge main frames and introduced a modern database management even not being a full relational database. I worked with “Vulcan” database when I was 13 years old creating an application for storage control. I am thankful for all inspiration that Mr Spock brought during decades to our lives and our technology.

R.I.P. Mr Spock or Leonard Simon Nimoy and thanks for all!!!

(March 26, 1931 – February 27, 2015)

My book is available now !!!!

After 11 months working all weekends and mostly all nights (late nights) and besides my duty on Intel, the book “Intel Galileo and Intel Galileo Gen 2: API Features and Arduino Projects for Linux Programmers” is ready in the printers and it will be available for shipping.

One of the conditions that make me to accept the proposal to write this book is “the digital book must be FREE”. The focus is to attend our maker/open-source community, colleges or any individual interested in our boards… You will be able to download the digital content on Apress website or you can order the hardcopy here

The book has a little more than 700 pages (in fact was more than 800 but we reduced) and covers several topics like details of our Yocto build process, the integration of 7160 LTE modem, OpenCV with emotion recognition, 6 analog board control channels to control robotic arms, and much more info.

The front matter is below:

 What is in the book ?

Chapter 1 discusses the hardware design of Intel Galileo and Intel Galileo Gen 2, and the construction of serial and FTDI cables for debugging using Linux terminal consoles.

Chapter 2 explains how the Yocto build system works, and how to generate your custom SPI and SD card images. It also presents how to compile, install and use the toolchains for native applications development, and discusses procedures to recover bricked Intel Galileo boards.

Chapter 3 shows how to install and use Arduino IDE;  how to install the drivers needed in the computer or virtual machine used, running real examples of interacting sketches with simple circuits. It also brings a practical project that integrates Python, POSIX calls and sketches to send an alert when an email is received.

Chapter 4 discusses the new APIs and hacking techniques created especially for Intel Galileo and Intel Galileo Gen 2 boards. It contains a broad discussion about clusters architecture, how GPIOs are distributed and their respective speed limits.

A practical project of how to overcome Intel Galileo’s limitation and make the temperature sensor DHT11 work is presented.

Chapter 5 presents networking APIs and hackings using Ethernet adapter and Wi-Fi mPCIe cards. Also explains how to install new Wi-Fi cards and how to share Internet access between Intel Galileo and computers. This chapter also explains how to hack the Arduino IDE to download sketches using network interfaces instead of USB.

Chapter 6 is a practical project about tweeting using Intel Galileo boards with new OAuth authentication without intermediary computers or servers. The project uses RTC (Real Time Clock) with external coin batteries and Wi-Fi mPCIe cards.

Chapter 7 shows techniques to use V42L and OpenCV libraries and how to capture images, videos and detect face and emotions using a webcam. This chapter also explains how to change the Linux BSD to support eglibc instead uClibc and generate the toolchain to compile C/C++ programs. There are also examples of OpenCV in Python.

Chapter 8 presents a low cost project to create moisture sensors based in scrap materials and galvanized nails.

Chapter 9 shows a practical home automation project implementing a webserver using node.js , interacting with multiples sensors as motion and temperature, keypads and switch relays.

Chapter 10 explains how to install and use PoE (Power of Ethernet) modules with Intel Galileo Gen 2.

Chapter 11 discusses basic principles in robotics, how to design and control a robotic arm using analog controllers and shows a practical project using a 6 DOF robotic arm with a mechanical gripper and another one built with ground coffee.

Chapter 12 discusses how to connect a XMM 7160 LTE modem and use data channels in real networks using Intel Galileo boards.

Chapter 13 is only available online. It shows a practical project of how to design and build a low cost robot head with animatronic eyes and mouth that  expresses emotions. This chapter is available online at, under the Source Code/Downloads tab.

What about Intel Edison ?

In few months we will have a “mini version” of this book including Intel Edison and the digital version will be also FREE.

Many thanks for ALL!!! I hope you appreciate the book.