This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def drop_all_doc_types(es: Elasticsearch, type_=ES_DOC_TYPE): | |
while es.count()["count"] > 0: | |
r = es.search( | |
index=ES_INDEX, | |
doc_type=type_, | |
filter_path=["hits.hits._id"], | |
body={"query": {"match_all": {}}}, | |
size=10000, | |
) | |
ids = [x["_id"] for x in r["hits"]["hits"]] if r else [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kubectl -n <namespace> scale deployment <depl-name> --replicas=0 && kubectl -n <namespace> scale deployment <depl-name> --replicas=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pill from [Errno 98] Address already in use | |
socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) | |
socket.setsockopt(socket.SOL_SOCKET, socket.SO_LINGER, struct.pack('ii', 1, 0)) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
sudo mkdir -p /var/lib/mysql | |
sudo mkdir -p /var/lib/postgresql/data | |
sudo mkdir -p /var/lib/mongodb/data | |
sudo mkdir -p /var/lib/edgedb/data | |
sudo docker run \ | |
--detach \ | |
--name=edgedb-server \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo docker rm -v $(sudo docker ps -a -q) && sudo docker rmi $(sudo docker images -q) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- selects approx size of all databases | |
SELECT | |
table_schema AS "Database", | |
SUM( data_length + index_length )/1024/1024 AS "Size, MB" | |
FROM information_schema.TABLES | |
GROUP BY table_schema; | |
SELECT | |
CONCAT(table_schema, '.', table_name) AS "Table", | |
ROUND(((data_length + index_length) / 1024 / 1024), 2) AS "Total size, MB", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# 1. Configure two monitors mode, set xfce panel to be displayed on the primary monitor | |
# 2. Instal required packages and remove unused | |
sudo apt update | |
sudo apt upgrade | |
sudo apt install terminator htop python3-setuptools python3-pip python3-dev python3-venv python2.7-dev vim git docker.io mysql-client |