Install PlatformIO Binaries in Ubuntu Linux

Step 1 (Optional)

Before doing this step, make sure you already have installed Python’s distutils . To do this, run the command below:

sudo apt-get install python3-distutils

Step 2

Get and run the installer:

python3 -c "$(curl -fsSL https://raw.githubusercontent.com/platformio/platformio/develop/scripts/get-platformio.py)"

Step 3

Create symbolic links to /usr/local/bin

sudo ln -s ~/.platformio/penv/bin/platformio /usr/local/bin/platformio
sudo ln -s ~/.platformio/penv/bin/pio /usr/local/bin/pio
sudo ln -s ~/.platformio/penv/bin/piodebuggdb /usr/local/bin/piodebuggdb

Note: After this, you can now use PlatformIO plugin in Clion without hiccups

References

  1. PlatformIO Utility Installation

Written with StackEdit.

Enable Wifi on Raspbian Using WPA Supplicant

Step 1

Edit your wpa_supplication config file.

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf 

Step 2

Then copy and paste the configurations below and edit the SSID and WIFI PASSWORD.

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=PH

network={
    ssid="[SSID]"
    psk="[WIFI PASSWORD]"
    scan_ssid=1
    proto=RSN
    key_mgmt=WPA-PSK
    pairwise=CCMP
    auth_alg=OPEN
}

Note: Double check your own Wifi settings and change the network configuration as you see fit. See WPA Supplicant Config Documentation for details. Also use iwlist [NET INTERFACE] scan to get more infor on your Wifi settings

Note on Hidden SSID: If you’re using hidden SSID for your Wifi hotspot, make sure to use scan_ssid=1 This uses probe request specific to your hidden SSID, and has a high latency.

Step 3

After setting the WPA Supplicant configurations. Restart your network manager with:

sudo service networking restart

Note: If restarting your network manager doesn’t connect you to wifi. Restart your board.

References

  1. WPA Supplicant Configuration Documentation

Written with StackEdit.

Show Free and Used Memory in Linux

The free comman can be used to show the free and used memory on both RAM and Swap files.

Sample Usage

List Free and Used Memory in Either Kilobytes, Megabytes or Gigabytes

Kilobytes

free -k
# or
free -kilo

Megabytes

free -m
#
free --mega

Gigabytes

free -g
# or
free --giga

Show List in Human Readable Format

free -h
# or
free --human

Display the List of Block Devices in Linux (e.g. Hard Disk, CD-ROM, Flash Drive)

When you want to find out the list of block devices in your computer, you can use lsblk.

Sample Usage

List block devices

lsblk

List all block devices

lsblk

List all SCSI devices

Please take note of the capital ‘S’

lsblk -S

Specifically list column

You can get all the available columns by running lsblk -h.

lsblk -o NAME,TYPE,MODEL

References

Fix SSH Login `Too many authentication failures` Due To Multiple SSH Keys

When loging in to your one of your remote server with or without a password and you got the Too many authentication failures error, then its your ssh client using multiple irrelivant keys for authentication. There are two ways to get out from this. One: Explicitly indicate you’re using password as your method of authentication, if you’re using one. Or, Two: specify SSH to use only relevant identity.

Specific Authentication Method Using Password Only

ssh -o 'PreferredAuthentications password' user@someserver.com

Use Identity Only

ssh -o 'IdentitiesOnly yes' user@someserver.com

Using Linux XCLIP

xclip is a command line utility for setting and getting values on the clipboard using other command’s output or input. Instead of directly using shortcut keys on the terminal, xclip can be used likewise except you have to pipe the output and input from other commands.

In general here’s the three(3) selection for xclip

  • Primary – Used for the 3rd mouse button
  • Secondary – Act’s as an alternative to primary
  • Clipboard – GUI or window-style clipboard using the shortcut keys (ctrl+c, ctrl+shift+v)

Sample Usage

Copying directory listing to clipboard

ls | xclip -selection c
# Alternative
ls | xclip -selection clipboard

Outputing clipboard

xclip -o -selection c

Outputting clipboard content to a file

xclip -o selection c > somefile

Aliasing xclip

Since clipboard‘s the common selection for xclip we can just create an alias on our ~/.bashrc file or system-wide /etc/bashrc, if you’re using bash.

USER

echo "alias xclip='xclip -selection clipboard'" >> ~/.bashrc 
source ~/.bashrc

SYSTEM-WIDE

echo "alias xclip='xclip -selection clipboard'" >> /etc/bashrc
source /etc/bashrc

References