Code Maven

Welcome to the Code Maven!

The main topics

Programming Exercises for any language.

Python: Repeat the same random numbers using seed

Python has a module called random that can provide pseudo random numbers.

In a nutshell that means that the numbers seem to be random and can be used for various applications as if they were indeed random, but in fact they are just a really strange series of fixed numbers.


Python: Repeat the same random numbers using seed


Python: split command line into pieces as the shell does - shlex.split()

Sometime, for example when you use subprocess you might want to run an external program avoiding the invocation of the shell. For that you need to have the external command in pieces, not in a single long string.

So what if you have the command as a string?


Python: split command line into pieces as the shell does - shlex.split()


Create temporary directory on Linux with Bash using mktemp

When writing a test or whenn running a build job it is usually a good practice to use a temporary directory and then clean up after the process is done.

It is also a good practice to make sure the temporary directoy is unique so if two processes run at the same time they won't interfere.


Create temporary directory on Linux with Bash using mktemp


Digital Ocean Virtual Private Server Hosting