Proxy and port forwarding

This article is more like a case study on when to use proxies and when to just stick to simple port forwarder. Also discusses in detail on what each of those is, and the tools falling under each category.

At office, we have our solution - basically a bunch of HTTP services, deployed on openstack which is not directly accessible from external network. We were asked to use a jump server (a.k.a jump box/jump host) - a server in the middle which has access to both, private network of the solution and the external network.

For using the services ...

View comments.

more ...

Dockerfile CMD vs ENTRYPOINT

I had difficulty in understanding the difference between CMD and ENTRYPOINT in Dockerfile before I did the below experiment. Hope this will help someone like me who cannot understand the difference from the documentation or stackoverflow.

Consider the below docker file

[ythulasi@YTHULASI-M-C341 01.BusyboxWithCMD]$ cat Dockerfile
FROM busybox:latest
CMD ["cat", "/etc/passwd"]

Let's build an image and call it busy_cmd_image

[ythulasi@YTHULASI-M-C341 01.BusyboxWithCMD]$ docker build -t busy_cmd_image .
Sending build context to Docker daemon 2.048 kB
Step 1 : FROM busybox:latest
 ---> 2b8fd9751c4c
Step 2 : CMD cat /etc/passwd
 ---> Using cache
 ---> e4df0d0c0d67
Successfully built e4df0d0c0d67

Now, we ...

View comments.

more ...

Random Rationalized

I had a requirement to have random numbers generated in a C application.

#include <stdlib.h>
#include <stdio.h>
int main()
{
  int i = 0;
  for (i = 0; i < 5; i++) {
    printf("Random number %d  =  %ld\n", i, random());
  }
  return 0;
}

I ran the code once and saw that random numbers were getting generated.

But to my surprise when I ran the code second time, I saw the same numbers getting printed.

What??? Does it mean random numbers are predictable? If so, why is it called random? Random and Predictable words literally contradicting each other.

But I remember using random.random ...

View comments.

more ...