Skip to content

Instantly share code, notes, and snippets.

View mubbashir10's full-sized avatar
🚀
Busy making SaaS Startups Successful!

Mubbashir Mustafa mubbashir10

🚀
Busy making SaaS Startups Successful!
View GitHub Profile
@mubbashir10
mubbashir10 / postgresql_13_replication.md
Created July 20, 2022 19:51 — forked from kpirliyev/postgresql_13_replication.md
PostgreSQL 13 Master-Slave Streaming Replication

PostgreSQL 13 Master-Standby Streaming Replication

PostgreSQL has various types of replication available and it could be a little bit confusing to figure out what has to be done to just configure a simple master-standby replicated database setup. Digging my way through documentation I decided to write my own little guide on how to setup simple replication in PostgreSQL 13.

How it works

Streaming replication works by streaming the contents of WAL (Write-Ahead Logging) file from one server to another. Each transaction is first written into the WAL file, so essentially every change on the primary server will be replicated on the standby server. Standby server could be used for read-only operations, but can't be written to. Ofcourse, transferring data over the network takes time and there is a small lag before data written to one server becomes available on the other. To guarrantee data consistency on both servers at the time of read operation we can enable synchronous replication mode. This way, datab

@mubbashir10
mubbashir10 / aws-amplify-slack-notifs.js
Created March 20, 2022 07:41
Send AWS Amplify Pipeline Notifications on Slack
const fetch = require('node-fetch')
// this should be your webhook URL (doc: https://api.slack.com/messaging/webhooks)
const integrationURL = ''
exports.handler = async (event) => {
const message = event.Records[0].Sns.Message
return await fetch(integrationURL, {
export default [
{
"utc": "(UTC) Casablanca",
"description": "Morocco Standard Time",
"abbreviation": "MST"
},
{
"utc": "(UTC) Coordinated Universal Time",
"description": "Coordinated Universal Time",
@mubbashir10
mubbashir10 / WebSpider.java
Created July 13, 2016 09:52
Extract images and anchor tag (hyperlinks) from a given website using JAVA and jSoup. Raw
/*
To run this program you need jSoup in your classpath.
Author: Mubbashir10
URL: http://mubbashir10.com
*/
import java.util.*;
import java.io.IOException;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
@mubbashir10
mubbashir10 / JDBCExample.java
Created March 16, 2016 23:38
Simple JDBC example to connect to MySQL Server.
/*
About: A simple tutorial showing JDBC connection (to MYSQL Database)
Author: Mubbahsir10
URL: http://mubbashir10.com
*/
//packages/libraries
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.SQLException;
@mubbashir10
mubbashir10 / mapImp.cpp
Last active March 16, 2016 14:43
A simple example of map usage (STL C++). Traverse, add, create maps in c++.
/*
About: A simple tutorial of maps (c++ STL)
Author: Mubbashir10
URL: http://mubbashir10.com
*/
//libraries
#include <iostream>
#include <string>
#include <map>
@mubbashir10
mubbashir10 / vectorImp.cpp
Last active February 10, 2023 05:13
Simple example of vectors in C++ (size, adding elements, traversing)
/*
About: A simple tutorial of using vectors (c++ STL)
Author: Mubbashir10
URL: http://mubbashir10.com
*/
//libraries
#include <iostream>
#include <vector>
@mubbashir10
mubbashir10 / mfFiles.py
Created March 12, 2016 14:17
A simple script (written in python) that I used to move thousands of .mp3 files from different nested folders to music folder.
#importing libraries
import os
import shutil
#define source dir
src_dir = "temp/"
#define destination dir
des_dir = "temp2"