Find slow queries
Ref: https://vertabelo.com/blog/using-sql-to-monitor-a-postgresql-database/
select now() - query_start AS elapsed,
query AS sql_text,
datname AS database,
usename AS username
from pg_stat_activity
Find slow queries
Ref: https://vertabelo.com/blog/using-sql-to-monitor-a-postgresql-database/
select now() - query_start AS elapsed,
query AS sql_text,
datname AS database,
usename AS username
from pg_stat_activity
#!/bin/bash | |
CHAT_ID=<chat_id> | |
BOT_TOKEN=<bot_token> | |
# this 3 checks (if) are not necessary but should be convenient | |
if [ "$1" == "-h" ]; then | |
echo "Usage: `basename $0` \"text message\"" | |
exit 0 | |
fi |
# /etc/netplan/00-installer-config.yaml | |
network: | |
version: 2 | |
renderer: networkd | |
ethernets: | |
eno1: | |
dhcp4: false | |
dhcp6: false | |
addresses: |
__author__ = 'Khiem Doan' | |
__github__ = 'https://github.com/khiemdoan' | |
__email__ = '[email protected]' | |
from datetime import datetime, timedelta | |
from typing import Self | |
from aredis_om import EmbeddedJsonModel as RedisEmbeddedJsonModel | |
from aredis_om import HashModel as RedisHashModel |
Restore postgres database
pg_restore --verbose --clean --no-acl --no-owner --host=localhost --dbname=db_name --username=username latest.dump
Download and use Meslo LG M Regular Nerd Font
"terminal.integrated.fontFamily": "'MesloLGM Nerd Font', 'MesloLGM NF', monospace"
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>ANSIBlackColor</key> | |
<data> | |
YnBsaXN0MDDUAQIDBAUGBwpYJHZlcnNpb25ZJGFyY2hpdmVyVCR0b3BYJG9iamVjdHMS | |
AAGGoF8QD05TS2V5ZWRBcmNoaXZlctEICVRyb290gAGjCwwTVSRudWxs0w0ODxARElVO | |
U1JHQlxOU0NvbG9yU3BhY2VWJGNsYXNzTxAoMC4wMzkzODA3MzY2NSAwLjE2MDExNjQ2 | |
MzkgMC4xOTgzMzI3NTY4ABABgALSFBUWF1okY2xhc3NuYW1lWCRjbGFzc2VzV05TQ29s |