Skip to content

Instantly share code, notes, and snippets.

View evilkost's full-sized avatar

Valentin Gologuzov evilkost

  • Czech Republic, Prague
View GitHub Profile
isort_run:
deps: [ ensure_venv ]
dotenv:
- .env
shell: bash
vars:
CHECK_FLAG:
sh: check_flag="--check"; if [ '{{.APPLY_FIX}}' == 'true' ]; then check_flag=""; fi; echo $check_flag
cmds:
- for: { var: TARGET, as: FILE }
tc qdisc list
tc qdisc add dev lo root netem delay 0.1ms
tc qdisc change dev lo root netem delay 0.3ms
tc qdisc change dev lo root netem delay 0.1ms
pre-commit run --files `git diff --name-only HEAD~ | tr '\r\n' ' '`
DO $$ DECLARE
tabname RECORD;
BEGIN
FOR tabname IN (SELECT tablename
FROM pg_tables
WHERE schemaname = current_schema())
LOOP
EXECUTE 'DROP TABLE IF EXISTS ' || quote_ident(tabname.tablename) || ' CASCADE';
END LOOP;
END $$;
#!/bin/bash
set -e
while [[ `pg_isready &>/dev/null && echo "1"` -ne "1" ]]; do
sleep 1;
echo "pg is not ready";
done
echo "pg is ready";
for i in */.git; do ( echo $i; cd $i/..; git pull; ); done
from subprocess import check_output
host_ip = check_output("/sbin/ip route|awk '/default/ { print $3 }'", shell=True).decode().strip()
root@85ba14b2a8ab:/opt/pow# echo $PYTHONPATH
/opt/pow:/opt/pow/csn:/opt/pow/zozzymodels:/opt/pow/libs:
root@85ba14b2a8ab:/opt/pow# echo $DJANGO_SETTINGS_MODULE
'csn.settingsdocker'
root@85ba14b2a8ab:/opt/pow# ls -laht /opt/pow/csn/settingsdocker.py
-rw-rw-r-- 1 root root 1.2K Jun 3 13:38 /opt/pow/csn/settingsdocker.py
root@85ba14b2a8ab:/opt/pow# django-admin
Traceback (most recent call last):
File "/usr/local/bin/django-admin", line 11, in <module>
sys.exit(execute_from_command_line())
Root/Video Games & Consoles/Video Game Consoles [Video Game Consoles]:
-> Root/Video Games/Categories/Xbox 360/Consoles[score 52.9318181818182]
Root/Sporting Goods/Indoor Games/Billiards/Tables [Tables]:
-> Root/Sports & Outdoors/Categories/Sports & Fitness/Leisure Sports & Game Room/Billiards & Pool/Tables & Accessories/Tables[score 59.9232954545455]
-> Root/Toys & Games/Categories/Games/Game Room Games[score 26.72]
-> Root/Toys & Games/Categories/Games/Game Room Games/Billiards[score 14.58125]
-> Root/Sports & Outdoors/Categories/Sports & Fitness/Leisure Sports & Game Room/Arcade & Table Games/Tabletop Billiards & Pool[score 8.74875]
Root/Sporting Goods/Cycling/Bicycle Components & Parts/Tires [Tires]:

Enable module:

vim /var/lib/pgsql/data/postgresql.conf

add at the end:

shared_preload_libraries = 'pg_stat_statements'
# Increase the max size of the query strings Postgres records
track_activity_query_size = 2048