#!/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
Month: June 2019
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