Skip to content

Instantly share code, notes, and snippets.

View phanthaihuan's full-sized avatar

Huan phanthaihuan

  • Ho Chi Minh
View GitHub Profile
@phanthaihuan
phanthaihuan / README.md
Created July 14, 2020 07:38 — forked from kmassada/README.md
Vagrant and KVM(QEMU) on Centos7

Libvirt

yum group install -y "Development Tools"
yum -y install qemu-kvm libvirt virt-install bridge-utils libvirt-devel  libxslt-devel libxml2-devel libvirt-devel libguestfs-tools-c
echo "net.ipv4.ip_forward = 1"|sudo tee /etc/sysctl.d/99-ipforward.conf
sysctl -p /etc/sysctl.d/99-ipforward.conf
@phanthaihuan
phanthaihuan / create-libvirt.sh
Created July 10, 2020 10:48 — forked from ironcladlou/create-libvirt.sh
OpenShift 4.0 installer on GCP
#/bin/bash
NAME="$1"
if [ -z "$NAME" ]; then
echo "usage: create-libvirt.sh <name>"
exit 1
fi
CLUSTER_DIR="$HOME/clusters/${NAME}"
if [ -d "$CLUSTER_DIR" ]; then
@phanthaihuan
phanthaihuan / howto-forward-x11-to-win10-via-putty-vcxsrv.md
Created July 9, 2020 09:41 — forked from vietlq/howto-forward-x11-to-win10-via-putty-vcxsrv.md
Code2Pro: How to Forward X11 to Windows 10 via PuTTY & vcxsrv

Code2Pro: How to Forward X11 to Windows 10 via PuTTY & vcxsrv

Scope

Tested on Windows 10 & Ubuntu 16.

Steps

  1. Check that sshd on Ubuntu is properly configured
@phanthaihuan
phanthaihuan / docker-php-ext-install.md
Created June 26, 2020 05:42 — forked from giansalex/docker-php-ext-install.md
docker-php-ext-install Reference
RUN apt update
RUN apt upgrade -y
RUN apt install -y apt-utils
RUN a2enmod rewrite
RUN apt install -y libmcrypt-dev
RUN apt install -y libicu-dev
RUN docker-php-ext-install -j$(nproc) intl
RUN apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng12-dev
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ 
@phanthaihuan
phanthaihuan / bot.rb
Created June 1, 2020 18:31 — forked from dideler/bot.rb
Sending a notification message to Telegram using its HTTP API via cURL
# Use this script to test that your Telegram bot works.
#
# Install the dependency
#
# $ gem install telegram_bot
#
# Run the bot
#
# $ ruby bot.rb
#
@phanthaihuan
phanthaihuan / whenever.sh
Created June 1, 2020 12:47 — forked from mpapi/whenever.sh
A simple shell script that uses inotify in Linux to run shell commands whenever files matching a pattern are changed.
#!/bin/sh
#
# Usage: whenever.sh [pattern] [command]
#
# Executes a command whenever files matching the pattern are closed in write
# mode. "{}" in the command is replaced with the matching filename (via xargs).
# Requires inotifywait from inotify-tools.
#
# For example,
@phanthaihuan
phanthaihuan / 3 Master
Created May 19, 2020 12:03 — forked from thuyhiend/3 Master
Cấu hình Replication 3 master
```
## Master-1
create database replica_db;
create user 'slave'@'10.10.22.104' identified by 'abc@123';
create user 'slave'@'10.10.22.105' identified by 'abc@123';
grant replication slave on *.* to 'slave'@'10.10.22.104' identified by 'abc@123';
grant replication slave on *.* to 'slave'@'10.10.22.105' identified by 'abc@123';
vi /etc/my.cnf.d/mariadb-server.cnf
[mariadb]
@phanthaihuan
phanthaihuan / replication.sh
Created May 19, 2020 12:00 — forked from rodesousa/replication.sh
Replication MySQL
#!/bin/bash
# PARAM
mysql_master=<%= @DBMY_MASTER_HOST %>
user_mysql=root
password_user_mysql=<%= @USER_ROOT_DBMY_SLAVE_PASSWORD %>
replication_user=<%= @REP_USER %>
replication_password=<%= @REP_PASSWORD %>
read -p "Etes vous sur de vouloir installer la replication ? [Y/N]" -n 1 -r
REFERENCE:
http://hzcsky.blog.51cto.com/1560073/479476
# $Id: mysql-replication 335 2005-10-13 19:46:20Z sbalukoff $
# To set up bi-directional mysql replication:
# For the purposes of this document, we have two servers which will in the
# end be filling a co-master type relationship. However, since when you set up
# this replication there will probably be one machine with all the data on it
# that needs to be brought into sync with the other machine, the machine
#!/bin/sh
SSH_PUBLIC_KEY='insert_your_ssh_public_key_here'
function add_ssh_public_key() {
cd
mkdir -p .ssh
chmod 700 .ssh
echo "$SSH_PUBLIC_KEY" >> .ssh/authorized_keys
chmod 600 .ssh/authorized_keys