Skip to content

Instantly share code, notes, and snippets.

View Eduard-gan's full-sized avatar

Eduard Gan Eduard-gan

  • Self employed
  • Russian federation
View GitHub Profile
@Eduard-gan
Eduard-gan / gist:be4c25e05d9c8721f1dac48e974df31f
Last active November 24, 2018 14:10
Change default storage path of dockerd
1) Make sure you're stopped the main daemon: sudo systemctl stop docker ; systemctl status docker
2) Create your new storage directory: sudo mkdir /storage
3) Move existing content to that diractory: sudo mv /var/lib/docker /storage
4) Configure daemon to use new directory: sudo nano /etc/docker/daemon.json
{
"data-root": "/storage/docker"
}
5) Start main daemon again: sudo systemctl start docker ; systemctl status docker
# Docker - How to cleanup (unused) resources
Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...
## delete volumes
// see: https://github.com/chadoe/docker-cleanup-volumes
$ docker volume rm $(docker volume ls -qf dangling=true)
$ docker volume ls -qf dangling=true | xargs -r docker volume rm
@Eduard-gan
Eduard-gan / gist:71b900cc4ecca07bd87feb12ad7d1c5f
Last active April 14, 2021 06:30
Virtualfish setup on Debian
WARNING! VF can be installed in both python3 or python2.7 you should check that versions of python match in both commands (pip install and coammand in config.fish)
sudo pip3 install virtualfish
echo "eval (python3 -m virtualfish)" >> ~/.config/fish/config.fish
Copy output of "funced -e nano fish_prompt"
Paste to "nano ~/.config/fish/functions/fish_prompt.fish"
or just
docker run -d --hostname mf_rabbit --name mf_rabbit -p 5672:5672 -p 15672:15672 rabbitmq:3.7.15
rabbitmq-plugins enable rabbitmq_management
rabbitmqctl add_user your_user your_password
rabbitmqctl set_user_tags your_user administrator
rabbitmqctl set_permissions -p / your_user ".*" ".*" ".*"
docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
# Show active connections
SHOW VARIABLES WHERE Variable_name LIKE 'character\_set\_%' OR Variable_name LIKE 'collation%';
# Show some shit;
show processlist;
# Create Database with PROPPER unicode encoding
create database animarender character set UTF8mb4 collate utf8mb4_unicode_ci;
# Add existing repo as a submodule in another repo(now it's super-repo)
- CD to super-repo
- git submodule add https://gitlab.com/e.gan/test-shared-repo.git some_generic_code (some_generic_code is a name of directory under which the code from submodule will reside)
- git commit -am "I linked a somerepo as submodule some_generic_code"
# Update or downgrade version of submodule to latest in super-repo
- CD to some_generic_code (the submodule repo is now manages by "git" command)
- git checkout master
- CD out of some_generic_code to parent directory(super-repo)
try:
self._pass_issue_date = self.person.pass_issue_date if getattr(self.person,'birthday', 0) else None
except ValueError:
self._pass_issue_date = self.person.pass_issue_date if getattr(self.person,'birthday', 0) else None
@Eduard-gan
Eduard-gan / docker-compose.yml
Created December 24, 2019 10:30
Forever running docker container with docker-compose
recovery:
build: build/postgres/
container_name: recovery
network_mode: bridge
hostname: recovery
restart: always
command: tail -f /dev/null
volumes:
- ./build/postgres/postgresql.conf:/etc/postgresql/postgresql.conf
- ./build/postgres/backup.py:/opt/scripts/backup.py # Скрипт отвечающий за бэкапы на вольюм бэкапов.
@Eduard-gan
Eduard-gan / default.conf
Created February 4, 2020 02:14
Раздача статики с Nginx
location /static/ {
# error_log /home/aa/kek.log debug; # Очень много информации для дебага именно по этому локэйшену.
root /home/aa;
# Сами файлы лежат в /home/aa/static/
}
@Eduard-gan
Eduard-gan / gist:5ebf1acdccaf21ea1b7358bae425a252
Created August 3, 2020 13:43
Typical pytest launch with pytest-cov package installed
pytest tests/test_quiz.py --disable-pytest-warnings --cov=business_logic.credit_history_quiz --cov-report term-missing
In PyChrm that would be
Additional arguments:
--disable-pytest-warnings --cov=business_logic.credit_history_quiz --cov-report term-missing