Skip to content

Instantly share code, notes, and snippets.

@MohammadrezaJavid
MohammadrezaJavid / README.md
Last active October 2, 2023 07:59
PostgreSQL Master-Slave Database Replication

PostgreSQL Master-Slave

General concepts

 What's a slave and master?

 In postgresql, we can have a database called Replica,
 whose data is always synced with the primary database(Master).
 Slave is usually used for backup and read only.
@MohammadrezaJavid
MohammadrezaJavid / hosts.ini
Last active May 3, 2023 13:29
Show memory free and uptime with Ansible.
[servers]
192.168.102.2
192.168.103.2
192.168.100.139
@MohammadrezaJavid
MohammadrezaJavid / bash.md
Last active April 27, 2023 18:32
clone vm with virt
virt-clone --original virtual_name_src --name new_name --file path/new_name.qcow2
  • virtual_name_src for show all vm name:
virsh list --all
@MohammadrezaJavid
MohammadrezaJavid / set ip
Last active May 23, 2023 19:05
set ip address static with netplan
#! /bin/bash
read -p "interface name: " intf
read -p "ip addr: " addr
read -p "sub net: " sub
read -p "gate way: " gate
read -p "dns ips: (format: 8.8.8.8, 1.1.1.1, 8.8.4.4): " dns
sudo touch /etc/netplan/01-netcfg.yaml
@MohammadrezaJavid
MohammadrezaJavid / api-git-curl.md
Last active April 14, 2023 15:44
Download the latest version of docker-compose from GitHub in one line with API GitHub
curl -s https://api.github.com/repos/docker/compose/releases \
| grep "docker-compose-linux-x86_64" \
| cut -d : -f 2,3 \
| tr -d \" \
| grep -v "," \
| grep -v ".sha256" \
| head -n 1