Skip to content

Instantly share code, notes, and snippets.

View ashavijit's full-sized avatar
:electron:
Focusing

Avijit Sen ashavijit

:electron:
Focusing
View GitHub Profile
import re
import pandas as pd
from pymongo import MongoClient, errors
from datetime import datetime, timedelta
import threading
import logging
import os
import pymongo
@ashavijit
ashavijit / pdf2txt.py
Created April 9, 2023 22:08
A script that converts PDF to TXT using python
from io import StringIO
from typing import List
from PyPDF2 import PdfReader
def convert_pdf_to_txt(pdf_file_path: str) -> str:
with open(pdf_file_path, 'rb') as f:
pdf = PdfReader(f)
pages: List[str] = []
for page in pdf.pages:
@ashavijit
ashavijit / B0BOt_Updated.py
Created April 4, 2023 15:49
Updated B0Bot
import tweepy
import pymongo
import os
from flask import Flask, request
from flask import jsonify
from flask import make_response
import yaml
from werkzeug.exceptions import NotFound
# Set up Flask app
@ashavijit
ashavijit / functions.py
Created April 4, 2023 15:17
B0Bot handlers
class News:
def __init__(self, id, text, created_at):
self.id = id
self.text = text
self.created_at = created_at
def save_to_db(self):
news_collection = db["news_collection"]
news_collection.insert_one({
"id": self.id,
@ashavijit
ashavijit / lazyGit.sh
Created October 10, 2022 06:43
You Know I am too lazy to follow-up so called git-protocols so added a shell-script to push my code ... --->
#!/bin/bash
current_branch=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p')
git pull origin $current_branch
echo "=== pull changes from '$current_branch' branch ==="
msg="$1"