Skip to content

Instantly share code, notes, and snippets.

@kenshin17
kenshin17 / compile-python-3.6.5.sh
Created November 4, 2019 07:51
Compile python-3.6.5
#!/bin/bash
# File : compile-python-3.6.5.sh
# OS : Redhat/Debian
# LastUpdate : 14:38 2019.11.04
# Description : Compile python-3.6.5
###########################################
# Determine OS platform
echo -e "\n########## Determine OS platform ##########"
if [ -f /etc/redhat-release ]; then
# For yum-based systems (like CentOS)
@kenshin17
kenshin17 / compile-postgreSQL-11.5-Ubuntu-16.04.LTS.sh
Created November 4, 2019 07:40
Compile PostgreSQL 11.5 on Ubuntu
#!/bin/bash
# File : compile-postgreSQL-11.5-Ubuntu-16.04.LTS.sh
# OS : Ubuntu 16.04.6 LTS
# LastUpdate : 10:06 2019.10.07
# Description : Compile PostgreSQL 11.5 on Ubuntu
###########################################
##POSTGRESQL : /postgres/pgscript/postgres-stop.sh | /postgres/pgscript/postgres-restart.sh <<<<<RESTART>>>>>
# | CONFIG FILE : /postgres/pgdata/{postgresql.conf,pg_hba.conf}
# | CONNECT DBA : /postgres/pgscript/postgres-connect-dba.sh
#!/bin/bash
# File : compile-mariadb-10.3.sh
# OS : Ubuntu 16.04.6 LTS
# LastUpdate : 16:55 2019.10.08
# Description : Compile MariaDB Server StandAlone / MariaDB Galera Cluster 10.3
###########################################
MARIADB_VERSION=10.3.18
MARIADB_HOME=/mariadb
@kenshin17
kenshin17 / Compile PostgreSQL 10.5 on Ubuntu-16.04
Created September 4, 2019 09:26
Compile-postgreSQL-10.5-Ubuntu-16.04.LTS.sh
#!/bin/bash
# File : Compile-postgreSQL-10.5-Ubuntu-16.04.LTS.sh
# OS : Ubuntu 16.04.5 LTS
# LastUpdate : 11:55 2019.05.13
# Description : Compile PostgreSQL 10.5 on Ubuntu-16.04
###########################################
export LC_CTYPE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
@kenshin17
kenshin17 / database_backup_restore.adoc
Created August 8, 2019 09:22 — forked from stompro/database_backup_restore.adoc
Database Backup and Restore

Evergreen Database - Backup and Restore

Tips and tricks on backing up and restoring your Evergreen Database.

Backup to directory format dump. This allows the dump to be done in parrallel for speed, and automatically compresses the output. The downside is that it may not be possible to restore to a different version of postgresql. If you need to move from one version of postgres to another, don’t use the directory format. pg_dump -U evergreen -j 4 -F d -f $BACKUPDIR/$DBNAME-$CURTIME $DBNAME

Restore into a new database

@kenshin17
kenshin17 / ssh_login_alert_telegram.sh
Last active July 6, 2019 04:48
SSH login alert via Telegram
#!/bin/bash
#File: /etc/profile.d/ssh_login_alert.sh
##################################
#wget https://raw.githubusercontent.com/xxxx -O /etc/profile.d/ssh_login_alert
#chmod +x /etc/profile.d/ssh_login_alert
##################################
USERID="xxx"
KEY="xxx:xx-xx"
@kenshin17
kenshin17 / kafka-cheat-sheet.md
Created May 30, 2019 03:19 — forked from ursuad/kafka-cheat-sheet.md
Quick command reference for Apache Kafka

Kafka Topics

List existing topics

bin/kafka-topics.sh --zookeeper localhost:2181 --list

Describe a topic

bin/kafka-topics.sh --zookeeper localhost:2181 --describe --topic mytopic

Purge a topic

bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic mytopic --config retention.ms=1000

... wait a minute ...

@kenshin17
kenshin17 / compile-haproxy-with-lua-openssl-ubuntu1804.sh
Last active September 11, 2019 11:22
Compile HAProxy 1.9.6 with Lua 5.3.5 and OpenSSL 1.1.0h and multithreading support on Ubuntu 18.04.2 LTS
#!/bin/bash
# Author : kenshin17
# OS : Ubuntu 18.04.2 LTS
# LastUpdate : 11:55 2019.05.13
# Description : Compile HAProxy 1.9.6 with Lua 5.3.5 and OpenSSL 1.1.0h and multithreading support on Ubuntu 18.04.2 LTS
###########################################
export LC_CTYPE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
SETUP_DIR_WORKSPACE="/opt/setup"
#!/bin/bash
ping_ip()
{
IP=$1
ping $1 -c 1 >/dev/null 2>&1
if [ $? = 1 ]
then
echo "$1 is down"
fi
@kenshin17
kenshin17 / install-rabbitmq.sh
Created September 17, 2018 03:34 — forked from yetanotherchris/install-rabbitmq.sh
RabbitMQ on Docker with admin UI
# AWS specific install of Docker
sudo yum update -y
sudo yum install -y docker
sudo service docker start
sudo usermod -a -G docker ec2-user
# exit the SSH session, login again
# Docker
docker run -d --hostname my-rabbit --name some-rabbit -p 4369:4369 -p 5671:5671 -p 5672:5672 -p 15672:15672 rabbitmq