Skip to content

Instantly share code, notes, and snippets.

View bhuiyanmobasshir94's full-sized avatar
🎖️
Focused on achievement

Mobasshir Bhuiya bhuiyanmobasshir94

🎖️
Focused on achievement
View GitHub Profile
import face_recognition
import cv2
import numpy as np
# This is a demo of running face recognition on live video from your webcam. It's a little more complicated than the
# other example, but it includes some basic performance tweaks to make things run a lot faster:
# 1. Process each video frame at 1/4 resolution (though still display it at full resolution)
# 2. Only detect faces in every other frame of video.
# PLEASE NOTE: This example requires OpenCV (the `cv2` library) to be installed only to read from your webcam.
import face_recognition
import cv2
import numpy as np
# This is a demo of running face recognition on live video from your webcam. It's a little more complicated than the
# other example, but it includes some basic performance tweaks to make things run a lot faster:
# 1. Process each video frame at 1/4 resolution (though still display it at full resolution)
# 2. Only detect faces in every other frame of video.
# PLEASE NOTE: This example requires OpenCV (the `cv2` library) to be installed only to read from your webcam.
import pandas as pd
import pdfkit
from PyPDF2 import PdfFileMerger
import os
import math
df = pd.read_excel('CALCOLATORE PREVENTIVI.xls', sheet_name='CALCOLATORE') # col = 1, row = 2
var1 = df.loc[3][7]
raw_var1 = var1.split('\n')
import requests
import pandas as pd
import datetime
import os
import logging
from bs4 import BeautifulSoup
import re
now = datetime.datetime.now()
todays_date = str(now).split()[0]
@bhuiyanmobasshir94
bhuiyanmobasshir94 / README.md
Created March 2, 2019 07:24 — forked from hofmannsven/README.md
My simply Git Cheatsheet
@bhuiyanmobasshir94
bhuiyanmobasshir94 / tweet_listener.py
Created February 13, 2019 18:12 — forked from hugobowne/tweet_listener.py
Here I define a Tweet listener that creates a file called 'tweets.txt', collects streaming tweets as .jsons and writes them to the file 'tweets.txt'; once 100 tweets have been streamed, the listener closes the file and stops listening.
class MyStreamListener(tweepy.StreamListener):
def __init__(self, api=None):
super(MyStreamListener, self).__init__()
self.num_tweets = 0
self.file = open("tweets.txt", "w")
def on_status(self, status):
tweet = status._json
self.file.write( json.dumps(tweet) + '\n' )
self.num_tweets += 1
@bhuiyanmobasshir94
bhuiyanmobasshir94 / gist:ce7061424a61f9fd3f582a8ec925787c
Created January 25, 2019 18:14
How to create a class using variable number of variables in python
There is a known method to emulate a container for variables, which support both methods of access: by a variable's name and a string key.
class Vars:
def __init__(self, **kw):
self.__dict__.update(kw)
def __getitem__(self, key):
return self.__dict__[key]
def __setitem__(self, key, val):
@bhuiyanmobasshir94
bhuiyanmobasshir94 / cull.py
Created December 13, 2018 19:00 — forked from jsundram/cull.py
Check if lat long is inside the bounds of the continental US (box model, not shape)
# http://en.wikipedia.org/wiki/Extreme_points_of_the_United_States#Westernmost
top = 49.3457868 # north lat
left = -124.7844079 # west long
right = -66.9513812 # east long
bottom = 24.7433195 # south lat
def cull(l):
c = []
for (lat, lng) in l:
if bottom <= lat <= top and left <= lng <= right:
@bhuiyanmobasshir94
bhuiyanmobasshir94 / populate_weather.py
Created December 11, 2018 23:30
Open Weather Map data and Open street map data demonstration
import requests
def get_weather(latitude_,longitude_):
# latitude = latitude_
# longitude = longitude_
# url = 'http://api.openweathermap.org/data/2.5/weather?lat={}&lon={}&appid=8f47bbfcc82517d109015de292ab80cd&units=metric'.format(latitude, longitude)
# res = requests.get(url)
# data = res.json()
response = dict(main="Haze",desc="haze",temp=18,pressure=1014,humidity=72,temp_min=18,temp_max=18,wind_speed=1.5,wind_degree=310,datetime=1544556600,clouds_all=20,sys_sunrise=1544488256,sys_sunset=1544526753)
return response
@bhuiyanmobasshir94
bhuiyanmobasshir94 / population_script.py
Created December 11, 2018 23:28
A multi table and foreign key demonstrated django db population script
import os
import pandas as pd
import numpy as np
import random
import django
from django.utils import timezone
from populate_weather import get_location,get_weather
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'categorized_affect_map.settings')
django.setup()