Skip to content

Instantly share code, notes, and snippets.

View coder4web's full-sized avatar

Aleksey Deryagin coder4web

View GitHub Profile
@coder4web
coder4web / mysql_monit.sql
Last active May 13, 2019 08:39
MySQL monitoring
-- all databases sizes
SELECT table_schema AS "Database",
ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) AS "Size (MB)"
FROM information_schema.TABLES
GROUP BY table_schema;
-- sizes of all of the tables in a specific database
SELECT table_name AS "Table",
ROUND(((data_length + index_length) / 1024 / 1024), 2) AS "Size (MB)"
FROM information_schema.TABLES
@coder4web
coder4web / postgresql_install.sh
Last active November 4, 2022 22:16
PostgreSQL install and setup
:'SET PASSWORD
sudo -i -u postgres
psql
\password postgres
'
# RHEL / CentOS 8
# https://www.postgresql.org/download/linux/redhat/
# https://www.postgresql.org/docs/current/runtime.html
dnf list installed |grep postgresql
@coder4web
coder4web / pgbouncer_centos8.sh
Last active March 13, 2025 09:51
CentOS 8 PgBouncer setup
# https://www.pgbouncer.org/install.html
# sudo dnf install pgbouncer
# Problem: package pgbouncer requires python-psycopg2, but none of the providers can be installed
# https://www.pgbouncer.org/install.html#building
sudo dnf install libevent libevent-devel
# https://www.pgbouncer.org/downloads/
wget -c https://www.pgbouncer.org/downloads/files/1.12.0/pgbouncer-1.12.0.tar.gz
tar xvfz pgbouncer-1.12.0.tar.gz
@coder4web
coder4web / nginx_self_signed_ecc.sh
Last active September 19, 2022 13:39
Create a self-signed ECC certificate
#!/bin/sh
# Private key
openssl ecparam -genkey -name secp384r1 -out nginx.ec.key
openssl ec -in nginx.ec.key -text -noout
# CSR
openssl req -new -sha256 -key nginx.ec.key -subj "/CN=devops/C=BM/ST=Bermudian/L=Bermudian/O=Org/OU=IT" -out nginx.ec.csr
#openssl req -in nginx.ec.csr -text -noout
openssl req -in nginx.ec.csr -text -noout | grep -i "Signature.*SHA256" && echo "All is well"
@coder4web
coder4web / openssl11_build.sh
Last active May 24, 2020 09:54
OpenSSL 1.1.x build from sources
# https://github.com/openssl/openssl/blob/master/INSTALL.md
# https://github.com/openssl/openssl/blob/master/NOTES.UNIX
# https://www.openssl.org/docs/man1.1.1/
# reqs
#sudo yum groupinstall "Development Tools"
#sudo apt-get install build-essential cmake gcc libssl-dev
cd /usr/local/src
wget https://www.openssl.org/source/openssl-1.1.1g.tar.gz
@coder4web
coder4web / debian_initial_setup.sh
Last active November 7, 2024 12:35
Debian initial setup (v10 - v12)
#!/bin/sh
apt-get update && apt-get upgrade
apt install -y dialog
# ------------------------
# INITIAL
# ------------------------
# see https://gist.github.com/coder4web/5fe1bb155d8957558911
dpkg-reconfigure locales