Skip to content

Instantly share code, notes, and snippets.

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

Muazzem Hossain Muazzeem

🏠
Working from home
View GitHub Profile
def parse_json_from_text(text):
# Removing newline characters and backticks
clean_text = text.replace('\n', '').replace('`', '')
# Extracting JSON part
json_start_index = clean_text.find('{')
json_string = clean_text[json_start_index:]
# Parsing JSON
data = json.loads(json_string)
def euclidean_distance(point1, point2):
x1, y1 = point1
x2, y2 = point2
return math.sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)
def cal(c_cor, t_cor):
c = c_cor
c_xmid, cy_mid = (c[0][0] + c[2][0]) / 2, (c[0][1] + c[2][1]) / 2
return t_cor[0][1] <= cy_mid <= t_cor[3][1]
import json
from google.cloud import storage
bucket_name = ""
folder_name = "unchecked_checkbox"
def list_items_in_folder(folder_path):
client = storage.Client()
from sqlalchemy import MetaData, Table, text
from sqlalchemy.orm import scoped_session
from sqlalchemy import create_engine, URL
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
connection_cred = {
'username':'postgres',
'password': '',
'host':'',

Airbyte Connection

This doc is a guide for launching a virtual machine (VM) and setting up Airbyte, a data integration platform.

Prerequisites

Before getting started, ensure that you have the following:

Redis Backup and Restore

This guide provides step-by-step instructions on how to backup Elasticache, copy the backup to Amazon S3, create GCP Redis, select network, allocate IP range, create a storage bucket, and upload the backup file. Finally, it explains how to import the backup file after Redis starts.

Prerequisites

Before proceeding with the backup and restore process, make sure you have the following:

  • Access to the Elasticache instance
  • Access to an Amazon S3 bucket
/**
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@Muazzeem
Muazzeem / connection.py
Last active May 8, 2024 16:00
Connect database
db_url = URL.create(
"postgresql+psycopg2",
username="postgres",
password="",
host="",
database="postgres",
)
engine = create_engine(db_url, connect_args={'connect_timeout': 10})
metadata = MetaData()
metadata.reflect(engine)
@Muazzeem
Muazzeem / build-docker-image.yml
Created March 2, 2023 15:43
Build docker image on arm64 platform
steps:
- uses: actions/checkout@v3
- uses: docker/setup-qemu-action@v1
- uses: mr-smithers-excellent/docker-build-push@v5
with:
image: flask_docker
registry: 940443069190.dkr.ecr.ap-southeast-1.amazonaws.com
tags: ${{ github.sha }}
platform: linux/arm64/v8
env: