Skip to content

Instantly share code, notes, and snippets.

View ehzawad's full-sized avatar
🎃
Wasteland Baby!

ehzawad ehzawad

🎃
Wasteland Baby!
View GitHub Profile
@ehzawad
ehzawad / utf8_bangali.py
Created February 24, 2024 20:22
UTF-8 print all Bengali Characters
import yaml
# Define the Unicode ranges for Bengali characters
# The ranges are tuples of start and end points, inclusive
# Unassigned code points will be skipped
bengali_char_ranges = [
(0x0980, 0x0983), # Bengali Anji, etc.
(0x0985, 0x098C), # Bengali vowels
(0x098F, 0x0990), # Bengali E, AI
(0x0993, 0x09A8), # Bengali O, etc.
import re
import csv
def is_bangla_word(word):
# Check if the word contains Bangla characters (Unicode range for Bangla: U+0980 to U+09FF)
return bool(re.search('[\u0980-\u09FF]', word))
def extract_bangla_words(line):
# Split the line into potential words, filtering out non-Bangla words
words = re.findall('[\u0980-\u09FF]+', line)
@ehzawad
ehzawad / actionmeh.py
Created February 4, 2024 05:11
actions.py
class ActionAnalyzePreviousMessages(Action):
def name(self) -> Text:
return "action_analyze_previous_messages"
def run(self, dispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List[EventType]:
# Your predefined list or dictionary of keywords
keywords = ["খতিয়ান", "পর্চা", "পর্চার", "খাজনা"]
# Get the list of events
events = tracker.events
@ehzawad
ehzawad / MOL-scraper.py
Created January 29, 2024 09:37
Web Scraping from a simple website
import requests
from bs4 import BeautifulSoup
def scrape_page(url):
try:
response = requests.get(url)
response.raise_for_status()
soup = BeautifulSoup(response.content, 'html.parser')
faqs = []
// // const puppeteer = require('puppeteer');
// // async function downloadWikipediaPDF(url) {
// // // Launch a new browser instance in headless mode
// // const browser = await puppeteer.launch({ headless: true });
// // // Create a new page in the browser
// // const page = await browser.newPage();
// // // Navigate to the provided URL
```python
from PyPDF2 import PdfReader, PdfWriter
def extract_pages(pdf_path, start_page, end_page, output_path):
reader = PdfReader(pdf_path)
writer = PdfWriter()
# Page numbers are zero-indexed in PyPDF2, hence the -1
for page_num in range(start_page - 1, end_page):
writer.add_page(reader.pages[page_num])
@ehzawad
ehzawad / rasa_test.py
Created December 14, 2023 10:00
Rasa Test Py
import requests
import time
def send_to_rasa(sender_id, message, rasa_server_url):
"""Send a message to Rasa and return the bot's response."""
try:
response = requests.post(
f"{rasa_server_url}/webhooks/rest/webhook",
json={"sender": sender_id, "message": message, "respType": "F", "inputType": "AN", "inputKey": "", "ivrStatus": "STOPPED", "cli": "0111111111", "metadata": "bn", "va_id": "AA"}
)
@ehzawad
ehzawad / HTMLwebpage_to_pdf_converter.js
Created December 5, 2023 11:37
webpage to html converter
```js
// const puppeteer = require('puppeteer');
// async function convertWebpageToPDF(url, outputFilename) {
// const browser = await puppeteer.launch({ headless: "new" });
// const page = await browser.newPage();
// // Increase the timeout to 60 seconds (60000 milliseconds)
// await page.goto(url, { waitUntil: 'networkidle2', timeout: 60000 });
@ehzawad
ehzawad / calenderto_bangla.py
Created October 16, 2023 09:01
calender_to_bangla
from enum import Enum
import calendar
class BengaliMonths(Enum):
January = 'জানুয়ারী'
February = 'ফেব্রুয়ারী'
March = 'মার্চ'
April = 'এপ্রিল'
May = 'মে'
June = 'জুন'
@ehzawad
ehzawad / consciousness.md
Created September 23, 2023 16:09
Human Consciousness

I think human consciousness is a tragic misstep in evolution. We became too self-aware. Nature created an aspect of nature separate from itself. We are creatures that should not exist by natural law. We are things that labor under the ilusion of having a self, this accretion of sensory experience and feeling, programmed with total assurance what we are each somebodywhen, in fact, everbody's nobody. I think the honorable thing for our species to do is deny our programming.