Skip to content

Instantly share code, notes, and snippets.

View ovichowdhury's full-sized avatar
🏠
Working from home

Nahid Chowdhury ovichowdhury

🏠
Working from home
View GitHub Profile
@ovichowdhury
ovichowdhury / CTE.sql
Created September 15, 2021 05:35
Recursive Common Table Expression
-- Find sum of value from an parent recursively
with recursive head_balance(id, name, value, parent_id) as (
select id, name, value, parent_id from chart_of_account
where id = 1
union
select t1.id, t1.name, t1.value, t1.parent_id
from chart_of_account as t1
join head_balance as t2

Open an ssl connection to site

openssl s_client -connect client-cert-missing.badssl.com:443

returns

.
.
.
---
@ovichowdhury
ovichowdhury / ecosystem.config.js
Created June 5, 2021 08:24
PM2 Cluster Deployment of Next.js App
module.exports = {
apps: [{
script: "node_modules/next/dist/bin/next",
args: "start",
exec_mode: "cluster",
instances: "max",
name: "ovi-app"
}]
}
@ovichowdhury
ovichowdhury / Guide on Microservices: Backups and Consistency.md
Created May 11, 2021 09:22 — forked from dhana-git/Guide on Microservices: Backups and Consistency.md
Guide on Microservices: Backups and Consistency | Consistent Disaster Recovery for Microservices - the BAC Theorem

Guide on Microservices: Backups and Consistency | Consistent Disaster Recovery for Microservices - the BAC Theorem


The BAC (Backup Availability Consistency) Theorem

When backing up an entire microservices architecture, it is not possible to have both availability and consistency.

  • Eventual Inconsistency with Full Availability (High Availability)
    • When making an independent backup of the state (the event log) of each service, it is possible that one service will be backed up before the event is added to the log, while the other service will be backed up after the corresponding event is added to its log. When restoring the services from backup, only one of the two services will recover its complete log. The global state of the microservice architecture will thus become inconsistent after restoring it from backup.
    • Possible problems,
  • Broken link
@ovichowdhury
ovichowdhury / Oracle DB Utility Commands.txt
Created January 31, 2021 15:30
Oracle Database Essentials Commands
// For Checking The amount of space occupied by schema
select
sum(bytes)/1024/1024 as size_in_mega, owner
from
dba_segments
where owner = '<owner_name>'
group by owner;
@ovichowdhury
ovichowdhury / base64ToBlob.js
Created October 8, 2020 13:08
Base64 to Blob for all file type function.
const b64toBlob = (b64Data, contentType = '', sliceSize = 512) => {
const byteCharacters = atob(b64Data);
const byteArrays = [];
for (let offset = 0; offset < byteCharacters.length; offset += sliceSize) {
const slice = byteCharacters.slice(offset, offset + sliceSize);
const byteNumbers = new Array(slice.length);
for (let i = 0; i < slice.length; i++) {
byteNumbers[i] = slice.charCodeAt(i);
@ovichowdhury
ovichowdhury / Main.java
Created February 27, 2020 12:27
Java Multi Threading Example.
import java.util.ArrayList;
// Implementing runnable interface using WorkerThread Class
// this example will sum up upto n values
class WorkerThread implements Runnable {
private Thread th; // Thread class reference (will be work as worker)
private String name;
private int startNum;
private int end;
@ovichowdhury
ovichowdhury / keras_mnist_cnn.py
Last active February 26, 2020 12:28
MNIST Dataset train test and visualization using Tensorflow and Keras.
#!/usr/bin/env python
# coding: utf-8
# In[2]:
import pandas as pd
import numpy as np
import seaborn as sns
@ovichowdhury
ovichowdhury / App.js
Created November 7, 2019 03:45
Image capture component React
import React from 'react';
import Camera from './components/Camera';
class App extends React.Component {
state = {
showCamera: false
}
@ovichowdhury
ovichowdhury / face-crop.py
Created October 27, 2019 08:34
Face detection resources using python face_recognition
import face_recognition
import cv2
import numpy as np
def show_image(image):
cv2.imshow("Image", cv2.cvtColor(image, cv2.COLOR_BGR2RGB))
cv2.waitKey(0)
# Load a sample picture and learn how to recognize it.
image = face_recognition.load_image_file("ovi4.jpg")