AWS Lambda Console: Accessing Environment Variables via Python

Editing configuration values inside the code is a high risk for error since there is a high chance that not only the values that you are changing you will change, you might even delete a letter or edit a line. In order to avoid this risk, you want your code to be able to accept configuration values at run time. This is extremely useful when developing codes on different environments like development, testing and production.

With AWS Lambda you can reuse your code on different environments using the Environment Variables.

Below is the way to use Environment Variables on AWS Lambda Console using Python 3.6.

Note: This is the same way to use Environment Variables on Python 2.7 and Python 3.7.

Environment Variables Setup

The Environment Variables section can be found under the Function Code section.

Environment Variables are Key/Value Pairs. The Key is what you will use on your Lambda Code, to access its Value. Continue reading AWS Lambda Console: Accessing Environment Variables via Python

Making an Off-Screen Window Appear in Windows 10

When opening a program in Windows, sometimes it would open itself in a position outside of the screen. Right-clicking the program on the taskbar does not work. Trying to move it to a new desktop is also futile. Using window key+arrow keys is also not making it appear. What to do then?

Below is a way to make the off-screen window appear again.

  1. Click the off-screen program icon on the Windows Taskbar to make it the active window.

    I selected Powerpoint as my active window (highlighted).

    Continue reading Making an Off-Screen Window Appear in Windows 10

Running Minikube in AWS EC2 (Ubuntu)

If you are studying Kubernetes and having a hard time running Minikube on an EC2 Instance, you are not alone. I had a hard time doing it when it was my first time.

Below are the steps (and some comments) that I took to help me run Minikube on my EC2 Instance.

Installation of Minikube on EC2 Ubuntu

1. Run a public EC2 Server with the following setup

AMI Ubuntu Server 18.04 LTS (HVM), SSD Volume Type
Instance Type t2.micro
Storage 8 GB (gp2)
Tags – Key: Name
– Value: Minikube
Security Group Name: Minikube Security Group
– SSH, 0.0.0.0/0
Later we will be editing this.
Key Pair Create your own keypair.
You will need this to SSH to your EC2 Instance

The above setup is within the AWS Free Tier so you could try Minikube on EC2 without spending money. But you can run Minikube on a bigger instance if you like.

2. SSH into your created EC2 Instance using your keypair.

3. Install kubectl

4. Install Docker

Minikube requires Docker. Continue reading Running Minikube in AWS EC2 (Ubuntu)

Showing “Open with Atom” when right clicking File or Folder in Windows 10

When right clicking on the File or Folder in Windows Explorer, the context menu will not show “Open with Atom” as an option. Because of this a user would need to open Atom Text Editor then Add Project Folder to see the Folder Tree on the side bar. Quite a lot of steps really.

Having a “Open with Atom” would be a time saving feature.

Context Menu for Folders

 

Context Menu for Files

The Context Menu is the menu that you can see every time you right-click a file or folder in Windows Explorer or Windows Desktop.


Is there a way to add “Open with Atom” on the context menu when you right click on a file or folder?

Yes, there is. Follow the instructions below. Continue reading Showing “Open with Atom” when right clicking File or Folder in Windows 10

How to Format an SD Card after using it on a Raspberry Pi (Windows Disk Management)

Whenever you install a Raspberry Pi Operating System (Raspbian, Ubuntu Mint, etc.) on an SD Card you will get two drives. One is formatted in FAT32 and the other in Linux Filesystem Format.

On the photo above here the SD card has 2 drives. E: and F:.

E: FAT32 42.4 MB Max Size
F: Linux File System ????

Note: There is actually a way to know what specific file system and how big it is for the Drive F:. I am avoiding it on this post as it would complicate matters.

Note: You may get a different drive for your SD Cards with Raspberry Pi OS when you insert them on Windows.

You can read more about SD Card Disk Partitions when using it for a Rasberry Pi here.

Now when you want to use an SD Card back to like using it on your Android Phone or camera, you just cannot use it by simply inserting it on the SD Card slot and turning on your gadget. You have to properly format the SD Card.

Note: If this method does not work for you, I will be writing another method for Windows, Mac and Linux systems in the future.


Problem

If you format separately the two drives (E: and F:), you will end up with two drives instead of one that has the full capacity of the SD Card.

Continue reading How to Format an SD Card after using it on a Raspberry Pi (Windows Disk Management)

Arduino Uno Schmitt Trigger Voltage Logic Levels

I wanted to know the Schmitt Trigger Voltage Logic Levels for the Arduino Uno since I want to know on what voltage would the digital input pin detect a logic high or a logic low.

I know that the Arduino Uno uses the ATmega328 with a 5V as its voltage supply. I checked the ATmega328 specification sheet and since it was too long to read (TL;DR), I would rather check using a Signal Generator and an Oscilloscope.



The Setup

Here is the list of equipment that I used for doing this experiment

  • Arduino Uno powered via USB port
  • Laptop (Windows)
  • 2-Channel Oscilloscope (PicoScope)
  • Signal Generator

Continue reading Arduino Uno Schmitt Trigger Voltage Logic Levels

How to use Synergy on Raspberry Pi

I have always used Synergy when using multiple computers since I do not want to use a lot of hardware (mouse and keyboard) to control all my unit. When I first received a Raspberry Pi the first thing I did was make Synergy work.

Here is the configuration that I use when working with Raspberry Pi.

  • Client – Raspberry Pi (to be controlled)
  • Server – Laptop where the mouse and keyboard will be used (Windows/Mac)
Screenshot of Synergy on a Windows computer.

1. Installing Synergy on Raspbian

Open the terminal and run the code below.

This will install Synergy on the Raspberry Pi along with its dependencies.

Continue reading How to use Synergy on Raspberry Pi

How to use C++ Classes in Arduino IDE without creating a Library

If you looked inside an Arduino Library you would see filename extensions such as .h and .cpp, which makes us conclude that the Arduino IDE uses C++ for its codes. If you look inside those files most of the Arduino Libraries have C++ classes inside of them. The question now is: Can you use C++ Classes in Arduino IDE without Creating a Library?

The answer to that is YES!

It is a bit tricky though as there are rules you need to follow. I shall dive into that later.

Sample Code

Below is a short Arduino Code with a C++ Class without using a Library.

Okay, I admit that was not very short. At least you can see that I have used a C++ Class without creating a library. You can compile it in your Arduino IDE if you still do not believe me. You can see the Circuit Diagram somewhere below, there is also a Fritzing Diagram if you want to seriously test it.

You can check the code in my Github here. Continue reading How to use C++ Classes in Arduino IDE without creating a Library

Project Diary: Self Balancing Robot

I have always wanted to make a self-balancing robot. This post will be a diary on my journey to making one.

I’ll be updating this post as I go along this journey complete with details of the success and frustrations, pictures and expenses.


December 5, 2017 (Tuesday)

Ordered and paid for LSM9DS1 Breakout board from Circuit-Help. This one has an Accelerometer, Gyroscope and Magnetometer in a single board which would really be helpful for this project.
https://www.circuit-help.com.ph/product/adafruit-9-dof-accelmaggyrotemp-breakout-board-lsm9ds1/

After much research I saw a LSM9DS0 Breakout board in Lazada, much more expensive (₱ 1,446/pc) but has a higher accuracy than the LSM9DS1. Since I already bought the LSM9DS1 Breakout Board I just have to live with my decision.

Expenses for the day

Adafruit 9-DOF Accel/Mag/Gyro+Temp Breakout Board – LSM9DS1 ₱ 905
Shipping (via LBC Express) ₱ 160
TOTAL ₱ 1,065

Total Expense so far: ₱ 1,065


December 6, 2017 (Wednesday)

Circuit-help messaged me that they have already shipped the product. Hopefully, tomorrow it will arrive. Continue reading Project Diary: Self Balancing Robot

Arduino MapFloat Library Documentation

I have always used the Arduino IDE map function but have not been able to use it for float values. With these I have made the MapFloat Library so that I could extend the map function to floating point numbers.

A very useful feature when I want to have decimal places on my map function.


Introduction

A library that contains the mapFloat function which re-maps a floating point number from one range to another. The mapFloat function is inside the MapFloat library.

This library is based on the Arduino Map Function.

Here is a link to the reference of Arduino Map Function.
https://www.arduino.cc/reference/en/language/functions/math/map/

Installing the MapFloat Library

Download the MapFloat Library from RadishLogic’s Github repository.
https://github.com/radishlogic/MapFloat

Clone or Download >> Download ZIP. This will download the file MapFloat-master.zip.

Unzip the MapFloat-master folder inside the zip file and paste it on the library folder where your Arduino IDE is installed. Continue reading Arduino MapFloat Library Documentation