Yearly Archives: 2017


Find all git repositories and perform a pull operation on them.

The following command will find all git projects in your home folder and perform a pull operation on them.

find ~ -name ".git" -type d -exec bash -c "echo '{}' && cd '{}'/.. && git pull" \;

The above command is based on finding the .git folders that exist in any clone of a git repository. Once a .git folder is found, it will navigate to its parent folder where it will perform the pull request.

Bonus – Automate the procedure using a cron job

The following entry in crontab allows us to periodically perform a pull request on all the cloned repositories that we have in a specific folder. Specifically, it will perform this operation once every five minutes.

*/5    *    *    *    *    cd /home/bytefreaks/Projects; find . -name ".git" -type d -exec bash -c "echo '{}' && cd '{}'/.. && git pull" \; &> /tmp/bf.git.log

Please note that it would be easier to use an ssh key that does not have a password for this automation.
If you do not, the you will need to either pass the password via this configuration line (not recommended) or have a key agent running to provide the password for the key.

Redirecting standard error (stderr)

The following command will redirect stderr to a different file than the one stdout is redirected to:

command >log.txt 2>errors.txt;

In case you want to redirect stderr to stdout (&1), and then redirect stdout to a file you can use the following setup:

command >mixed-log.txt 2>&1;

The following command will have the same effect as the previous one, the difference between them is the way they are implemented. This time we will redirect both the stdout and stderr to a file:

command &> mixed-log.txt;


Logarithm is the inverse operation to exponentiation

In mathematics, the logarithm is the inverse operation to exponentiation, just as division is the inverse of multiplication and vice versa. That means the logarithm of a number is the exponent to which another fixed number, the base, must be raised to produce that number. In the most simple case the logarithm counts repeated multiplication of the same factor; e.g., since 1000 = 10 × 10 × 10 = 103, the “logarithm to base 10” of 1000 is 3. More generally, exponentiation allows any positive real number to be raised to any real power, always producing a positive result, so the logarithm can be calculated for any two positive real numbers b and x where b is not equal to 1. The logarithm of x to base b, denoted logb (x) (or logb x when no confusion is possible), is the unique real number y such that by = x. For example, log2 64 = 6, as 64 = 26.

From: https://en.wikipedia.org/wiki/Logarithm

Another example: When N = ax then x is equal to loga (N) (or loga N).
Comic is based on: https://www.facebook.com/cutbu2/photos/a.146307418902007.1073741874.145016865697729/479097838956295/