Skip to content

Instantly share code, notes, and snippets.

View eshafik's full-sized avatar
💭
coding

Md. Shafikul Islam eshafik

💭
coding
View GitHub Profile
@eshafik
eshafik / fastapi_kafka_integration_aiokafka.md
Created January 16, 2024 18:27
FastAPI and Kafka Integration with aiokafka [ Consumer and Producer]

Producer:

Create a sperate file like producer.py -

import json
import ssl

from aiokafka import AIOKafkaProducer

from conf.app_vars import KAFKA_HOST, KAFKA_USERNAME, KAFKA_PASSWORD
@eshafik
eshafik / multiple_github_accounts_ssh.md
Created January 7, 2024 17:32
Multiple Github Accounts with ssh keys (Linux / Mac)

How to manage multiple github accounts from your machine (linux or mac) using ssh keys-

Step: 1: Generate SSH keys for each GitHub account:

Go to .ssh directory (if not exists, create .ssh directory). Make sure you are in .ssh directory. Now generate ssh key for each of your github account like this :

>> ssh-keygen -t rsa -b 4096 -C "work-email@example.com"

output:
@eshafik
eshafik / ERPNext Installation Process on MAC M1.md
Last active November 25, 2022 13:35
ERPNext Manual Installation Process on MAC M1

Step-1: Install and Run MariaDB server on local machine (if not exists)

brew install --cask wkhtmltopdf
brew install mariadb

Add the following lines in the config file

sudo nano /opt/homebrew/etc/my.cnf

[mysqld]
import re
text = " Hello < I live in Bangladesh. <I love my country> I speak Bangla>"
textGreedyRegex = re.compile(r"<.*>") # Greedy Approach
print(textGreedyRegex.search(text))
# Output:
<re.Match object; span=(7, 66), match='< I live in Bangladesh. <I love my country> I speak Bangla>
import re
text = "I speak Bangla. I live in Bangladesh"
textRegex = re.compile(r"Bangla(desh)+") # 1 or more time
print(textRegex.search(text))
# Output:
<re.Match object; span=(26, 36), match='Bangladesh'>
import re
text_1 = "I speak Bangla"
text_2 = "I eat Banana"
textRegex = re.compile(r"Ba(na)*") # O or more time
print(textRegex.search(text_1))
# Output:
import re
text_1 = "I live in Bangladesh"
text_2 = "I speak Bangla"
textRegex = re.compile(r"Bangla(desh)?") # 0 or one time.
print(textRegex.search(text_1))
# Output:
import re
text = "I live in Bangladesh"
textRegex = re.compile(r"Bangla(desh|deshi)")
print(textRegex.search(text))
Output:
<re.Match object; span=(10, 20), match='Bangladesh'>
import re
text = "my phone number is 01740-999768"
phoneRegex = re.compile(r"(\d{5})-(\d{6})")
print(phoneRegex.search(text))
Output:
<re.Match object; span=(19, 31), match='01740-999768'>
import re
text = "my phone number is 01740999768"
phoneRegex = re.compile(r"\d{5, 11}")
print(phoneRegex.search(text))
Output: