For example, you have a website / git repository, etc. And you don’t want to use Let’s Encrypt to get certificates, or it is a purely internal service, so we are quite satisfied with a self-signed certificate. In any case, we need to add a self-signed certificate to the Mac OS certificate store. Otherwise, youContinue Reading
How to delete all Docker images and containers
#!/bin/bash# Stop all containersdocker stop $(docker ps -a -q)# Delete all containersdocker rm $(docker ps -a -q)# Delete all imagesdocker rmi $(docker images -q) First of all we need to get a list of all containers. We can get it by the command: docker ps -a -q — all and quiet. Now we need toContinue Reading
How to change permissions for file / directory recursively in Linux
Change owner for directory recursively: sudo chown -R user:group /path/to/directory Chown is a short for “change owner”, -R – means “recursively”, owner and group definition are separated by “:”. Also we need high privileges to run chown command – so we use “sudo”. Change permissions only for directories recursively: find /path/to/directory -type d -exec chmod 755 {}Continue Reading
How to install non-free video / audio codecs in Ubuntu
You can install codecs during Ubuntu installation or by using the following command: sudo apt-get install ubuntu-restricted-extras If you want to watch movies and listen music as you accustomed – you need some additional software. Basicly all movie files or audio files encoded by some algorithm. Some of them are open and free, but manyContinue Reading
Python 3 performance profiling – easiest way
Just add cProfile module to the running command: python3 -m cProfile test.py For example: $ python3 -m cProfile test.py 14 function calls in 0.000 seconds Ordered by: standard name ncalls tottime percall cumtime percall filename:lineno(function) 1 0.000 0.000 0.000 0.000 test.py:1() 10 0.000 0.000 0.000 0.000 test.py:1(func) 1 0.000 0.000 0.000 0.000 test.py:4() 1 0.000 0.000 0.000Continue Reading
How to configure Qemu-KVM
At times, it is useful to have a deployed infrastructure of N machines to see how networking works, how the cluster shards on nodes, etc. From time to time I remember how I did it last time. But this time I decided to just write this simple set of commands, so as not to remember,Continue Reading
Git: «Corrupt loose object»
Also you can see something like this in you terminal: error: object file .git/objects/03/9e5691db59686e2afce2da700853398c961b4a is empty After the computer crashes, git showed: $ git status error: object file .git/objects/03/9e5691db59686e2afce2da700853398c961b4a is empty error: object file .git/objects/03/9e5691db59686e2afce2da700853398c961b4a is empty fatal: loose object 039e5691db59686e2afce2da700853398c961b4a (stored in .git/objects/03/9e5691db59686e2afce2da700853398c961b4a) is corrupt Git is a control version system. So if weContinue Reading
What’s new in Python 3.8: the Walrus Operator
The new operator will be available in the new version of Python. It’s called “walrus operator” because it’s like someone cosplayed a walrus: “:=”. This is similar to the normal ” =” assignment, but returns the value of the statement. So this is a C-like assignment. For eaxmple, we can use it for a one-lineContinue Reading
How to run a program as daemon without any output
Each program has a set of file descriptors. It’s like an open stream from / to file. On start program has 3 descriptors: standard input (stdin), standard output (stdout) and standard error (stderr). They has numbers: from 0 to 2. Standard input is used for reading input data from the user (from the terminal). StandardContinue Reading
How to get top 10 largest files
As we already saw, we can easily get to 10 largest directories (see “How to get top 10 largest directories in the current directory“). But there we used du utility – it shows directory size (or “estimate file space usage”). What utility shows file size? Oh… It’s just the ls! Looks easy? But we needContinue Reading