Skip to content

Instantly share code, notes, and snippets.

Aleksey Deryagin coder4web

Block or report user

Report or block coder4web

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@coder4web
coder4web / pgbouncer_centos8.sh
Last active Nov 27, 2019
CentOS 8 PgBouncer setup
View pgbouncer_centos8.sh
# 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 / postgresql_install.sql
Last active Dec 3, 2019
PostgreSQL install and setup
View postgresql_install.sql
# RHEL / CentOS 8
# https://www.postgresql.org/download/linux/redhat/
# https://www.postgresql.org/docs/current/runtime.html
dnf install https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
dnf install postgresql12 postgresql12-server
# Fedora 31
dnf install https://download.postgresql.org/pub/repos/yum/reporpms/F-31-x86_64/pgdg-fedora-repo-latest.noarch.rpm
dnf install postgresql12 postgresql12-server
@coder4web
coder4web / mysql_monit.sql
Last active May 13, 2019
MySQL monitoring
View mysql_monit.sql
-- 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 / postgrespro.sh
Last active Nov 10, 2019
Postgres Pro install, setup and maintenance
View postgrespro.sh
# @see https://postgrespro.ru/docs/postgrespro/11/binary-installation-on-linux.html
#-------------------------------
# Debian 8/9/10:
#-------------------------------
sudo apt-get install lsb-release
sudo sh -c 'echo "deb http://repo.postgrespro.ru/pgpro-11/debian $(lsb_release -cs) main" > /etc/apt/sources.list.d/postgrespro.list'
wget --quiet -O - http://repo.postgrespro.ru/pgpro-11/keys/GPG-KEY-POSTGRESPRO | sudo apt-key add -
sudo apt-get update
@coder4web
coder4web / osm_tile_server_centos7.sh
Last active Jan 13, 2020
CentOS 7 Open Street Map Tile Server
View osm_tile_server_centos7.sh
# Based on next manuals:
# Ubuntu 18.04 LTS: https://switch2osm.org/manually-building-a-tile-server-18-04-lts/
# CentOS 7 - https://www.keisan.io/en/knowledgebase/centos-7-open-street-map-tile-server
# CentOS 6 - http://gis-lab.info/qa/mod_tile.html#.D0.9D.D0.B0.D1.81.D1.82.D1.80.D0.BE.D0.B9.D0.BA.D0.B0_renderd (on Russian)
# Updated to latest CentOS / deps packages
# Dependencies
sudo yum install git libpng libtiff libjpeg freetype gdal cairo cairo-devel pycairo sqlite geos boost curl libcurl libicu bzip2-devel libpng-devel libtiff-devel zlib-devel libjpeg-devel libxml2-devel python-setuptools proj-devel proj proj-epsg proj-nad freetype-devel libicu-devel gdal-devel sqlite-devel libcurl-devel cairo-devel pycairo-devel geos-devel protobuf-devel protobuf-c-devel lua-devel cmake proj boost-thread proj-devel autoconf automake libtool pkgconfig ragel gtk-doc glib2 glib2-devel libpng libpng-devel libwebp libtool-ltdl-devel python-devel harfbuzz harfbuzz-devel harfbuzz-icu boost-devel cabextract xorg-x11-font-util
@coder4web
coder4web / ubuntu_dualboot.sh
Last active Aug 31, 2018
Ubuntu dual-boot HOW-TO
View ubuntu_dualboot.sh
# boot - How can I reinstall GRUB to the EFI partition? - Ask Ubuntu
# https://askubuntu.com/a/831241/19938
# Note : sdX = disk | sdXX = efi partition | sdXXX = system partition
sudo mount /dev/sdXXX /mnt
sudo mount /dev/sdXX /mnt/boot/efi
for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done
sudo chroot /mnt
grub-install /dev/sdX
update-grub
View postgresql_roles.sql
\z
-- Full access
GRANT ALL privileges ON DATABASE db TO admin_user;
GRANT ALL ON schema public TO admin_user;
GRANT ALL ON ALL TABLES IN SCHEMA public TO admin_user;
GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA public TO admin_user;
-- Read-only access
CREATE ROLE readonly;
@coder4web
coder4web / zabbix_setup.sh
Last active Mar 23, 2019
Zabbix setup (CentOS. RHEL)
View zabbix_setup.sh
# ------------------------
# agent
# ------------------------
sudo rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
sudo yum list zabbix-agent
sudo yum install zabbix-agent
sudo firewall-cmd --zone=public --add-port=10050/tcp
sudo firewall-cmd --zone=public --add-port=10050/tcp --permanent
sudo semanage permissive -a zabbix_agent_t
sudo systemctl enable zabbix-agent.service
@coder4web
coder4web / vertica_monit.sql
Last active Apr 3, 2018
Vertica management and monitoring
View vertica_monit.sql
-- List of schemas
\dn
-- list all tables
\dt
-- list only tables with "public" schema
\dt public.*
-- database size
@coder4web
coder4web / centos_kernel_upgrade.sh
Last active Nov 18, 2019
How to Install or Upgrade to Kernel 5.x in CentOS 7
View centos_kernel_upgrade.sh
# @see https://www.tecmint.com/install-upgrade-kernel-version-in-centos-7/
uname -sr
# Linux 3.10.0-1062.1.1.el7.x86_64
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm
yum --disablerepo="*" --enablerepo="elrepo-kernel" list available
yum --enablerepo=elrepo-kernel install kernel-ml
You can’t perform that action at this time.