Skip to content

Instantly share code, notes, and snippets.

View MhmdRyhn's full-sized avatar
🎯
Focusing

Mahmood Al Rayhan MhmdRyhn

🎯
Focusing
View GitHub Profile
-- Create all the tables
CREATE TABLE doctors (
id SERIAL PRIMARY KEY,
status SMALLINT NOT NULL,
doctor_name VARCHAR(512) NOT NULL
);
CREATE TABLE slots (
@MhmdRyhn
MhmdRyhn / download_image.py
Created July 26, 2019 02:32
Download an image from URL
import requests
def download_single_image(self, url, file_name):
with open(self.image_path + file_name.replace(' ', '_') + '.jpg', 'wb') as file:
response = requests.get(url, stream=True)
for block in response.iter_content(1024):
if not block:
break
file.write(block)
package total.nooflines;
import java.io.File;
import java.io.FileReader;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
public class TotalNoOfLines {
import os
class NoOFLinesInAProject:
project_path = ''
def __init__(self):
self.project_path = input('Enter Project Path: ')
def total_lines(self):
# Taken from: https://stackoverflow.com/a/49207730/5600965
# This requires BeautifulSoup
# cfemail = element.__dict__['attrs'].get('data-cfemail')
def get_protected_email(cfemail):
"""
# Taken from: https://stackoverflow.com/a/52969463/5600965
from PIL import Image
def pad_image(original_image, **kwargs):
width, height = 200, 64
ratio_width = width / original_image.width
ratio_height = height / original_image.height
@MhmdRyhn
MhmdRyhn / file_open_view.py
Created April 29, 2019 06:14
A "django" class based view to "view file" from server
"""
How to use this view ?
----------------------
class YourFileOpenView(FileOpenView):
folder_path = 'path of the folder where the file is'
file_name = 'name of the file to be downloaded'
content_type_value = 'content type used for the format of `file_name`'
"""
@MhmdRyhn
MhmdRyhn / file_download_view.py
Last active January 24, 2022 22:37
A "django" class based view to "download file" from server
"""
How to use this view ?
----------------------
class YourFileDownloadView(FileDownloadView):
folder_path = 'path of the folder where the file is'
file_name = 'name of the file to be downloaded'
content_type_value = 'content type used for the format of `file_name`'
"""