Pentatonic Superimposition

Let us analyse a modal harmony, such as someone playing the G lydian chord:

G - A - B - C# - D - E - F#

1 - 2 - 3 - #4 - 5 - 6 - 7

If you have a G lydian chord, you can play the G major pentatonic to emphasize the 1, 3 and 5 chord tones and "play it safe". However you can also play the A major pentatonic as it has the #4 chord tone of the G lydian:

G major pentatonic scale: G A B D E        (G lydian degrees: 1 - 2 - 3  - 5 - 6)

A major pentatonic scale: A B C# E F#  (G lydian degrees: 2 - 3 - #4 - 6 - 7

This is known as pentatonic superimposition. If you have lydian mode, this is always going to work - i.e. just play the major pentatonic a whole step above.

What about D major pentatonic?

D major pentatonic scale: D E F# A B   (G lydian degrees: 5 - 6 - 7 - 2 - 3)

This would work too, but be aware that you might not get the sound of the Lydian (#4)!

Experiment with the other modes and you will find that the docile pentatonic scale can be a very potent tool even for Jazz and Fusion genres...

Easily encrypt and decrypt files using GPG and Bash functions

Use bash functions to simplify encryption and decryption using GPG:

To use them simply add your file to encrypt or decrypt, as an argument, like so:

enc myfile


dec myfile

Generate SHA-512 hashes using Python

python -c "import crypt, getpass, pwd; \
             print(crypt.crypt('password', '\$6\$saltsalt\$'))"

Pagination in Solidity

Simple working Solidity code to paginate arrays returned from a Smart Contract:

pragma solidity >=0.4.22 <0.6.0;

contract ArrayPagination {
    uint[] arr;

    function add(uint data) public {

    function fetchPage(uint cursor, uint howMany) public view returns (uint[] memory valueset, uint newCursor) {
        uint length = howMany;
        if (length > arr.length - cursor) {
            length = arr.length - cursor;

        uint[] memory values = new uint[] (length);
        for (uint i = 0; i < length; i++) {
            values[i] = arr[cursor + i];

        return (values, cursor + length);

Mapping network connections to Process ID's in Windows

One of the cool features in Linux is the ability to map network requests with process id's (PIDs). This can help any system administrator troubleshoot a number of things, such as "What process is using port 80?".

I struggled for a long time to do the same thing on Windows machines, but I have recently found out that with netstat, run in administrator mode, you can actually get something similar:

Microsoft Windows [Version 10.0.17763.592]
(c) 2018 Microsoft Corporation. All rights reserved.

C:\WINDOWS\system32>netstat -aon

Active Connections

  Proto  Local Address          Foreign Address        State           PID
  TCP                 LISTENING       4
  TCP                LISTENING       1072
  TCP                LISTENING       4
  TCP               LISTENING       4428
  TCP               LISTENING       11140
  TCP               LISTENING       10204
  TCP               LISTENING       6916
  TCP               LISTENING       4

Remove all Docker images and containers

Very handy and fundamental commands to delete ALL Docker images and containers:

First start by deleting the containers (since these are dependencies of images):
docker rm $(docker ps -a -q)

Then we can proceed to delete all the images:
docker rmi $(docker images -a -q)

Render Material-UI Modal in the center of the Screen

The Material-UI Modal component is a very powerful and commonly used component in the ReactJS community. Unfortunately it is badly documented. One of the most common questions is how to center the modal to the center of the screen. Well the solution is actually quite simple, just add a style prop as follows:

          style={{ alignItems: "center", justifyContent: "center" }}