Free Programming Books

Hey, guys,

I just found a GitHub hosting an incredibly variety of programming books for free. Here is the link.


Rotate video with ffmpeg command

On Linux, you should have ffmpeg tool and libraries installed on your system.

Original post here:

Rotate 90 clockwise:

ffmpeg -i -vf "transpose=1"

For the transpose parameter you can pass:

0 = 90 Counter CLockwise and Vertical Flip (default) 
1 = 90 Clockwise 
2 = 90 Counter Clockwise 
3 = 90 Clockwise and Vertical Flip

TCP handshake (connection setup)

From original post:

Establishing a normal TCP connection requires three separate steps:


  1. The first host (Alice) sends the second host (Bob) a “synchronize” (SYN) message with its own sequence number x, which Bob receives.
  2. Bob replies with a synchronize-acknowledgment (SYN-ACK) message with its own sequence number y and acknowledgement number x + 1, which Alice receives.
  3. Alice replies with an acknowledgment message with acknowledgement number y + 1, which Bob receives and to which he doesn’t need to reply.

Additional image (in more details):


Confidence Interval

Basic steps for calculating Confidence Interval (CI): (Wikipedia)

The basic breakdown of how to calculate a confidence interval for a population mean is as follows:

  1. Identify the sample mean, \bar{x} . While \bar{x} differs from \mu, population mean, they are still calculated the same way: \sum {x_i \over n} .
  2. Identify whether the standard deviation is known, \sigma, or unknown, s.
    • If standard deviation is known then z* is used as the critical value. This value is only dependent on the confidence level for the test. Typical confidence levels are:[24]
99% 2.58
95% 1.96
90% 1.64
    • If the standard deviation is unknown then t* is used as the critical value. This value is dependent on the confidence level (C) for the test and degrees of freedom. The degrees of freedom is found by subtracting one from the number of observations, n-1. The critical value is found from the t-distribution table. In this table the critical value is written as tα(r), where r is the degrees of freedom and \alpha = {1-C \over 2}.
  1. Plug the found values into the appropriate equations:
    • For a known standard deviation: (\bar{x} - z^* {\sigma \over \sqrt{n}}, \bar{x} + z^* {\sigma \over \sqrt{n}})
    • For an unknown standard deviation: (\bar{x} - t^* {\sigma \over \sqrt{n}}, \bar{x} + t^* {\sigma \over \sqrt{n}})
  2. The final step is to interpret the answer. Since the found answer is an interval with an upper and lower bound it is appropriate to state that based on the given data we are __ % (dependent on the confidence level) confident that the true mean of the population is between __ (lower bound) and __ (upper bound).[25]

Variance and Standard Deviation

Here, there is a simple explanation why we have to square the differences. Basically, it’s because “we have to be fair” when comparing data statistics. One could think that we could use module operator, instead of squaring the differences. We could, but the results may not indicate always the same idea.

The “Population Standard Deviation”:

The “Sample Standard Deviation“:


Git Merge Conflicts

We can use mergetool to solve conflicts in git.
Here is short (a very short) example. Original post is here.

$ git mergetool


Both of you have modified When you open the file in your text editor, you’ll see both changes:

the number of planets are
<<<<<<< HEAD
>>>>>>> branch-a

In branch-a, you wrote the word “nine,” but your friend wrote “eight.” Git automatically addsconflict markers to the affected areas. A conflict-marked area begins with <<<<<<< and ends with >>>>>>>. These are also known as the conflict markers. The two conflicting blocks themselves are divided by a =======.