Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Vinod Puliyadi puliyadivinod

🎯
Focusing
View GitHub Profile
@puliyadivinod
puliyadivinod / track_celery.py
Created Aug 9, 2019 — forked from hanneshapke/track_celery.py
Decorator for Celery functions to measure the execution time and memory usage
View track_celery.py
import time
from memory_profiler import memory_usage
import logging
celery_logger = logging.getLogger('celery')
def track_celery(method):
"""
View scroller.html
<!-- Author: Vinodkumar Puliyadi - Simple Scroller Demo -->
<html>
<head>
<title>Scrolling Script</title>
</head>
<style type="text/css">
body{ padding:0px; margin:0px; height: 2000px; }
#container{ position: relative; height: 2500px; background-color: red; width: 80%; margin:0 auto; }
#adbox{ position: absolute; top:200; right:0; height: 600px; width:200px; background-color:black; color:#fff; }
</style>
View get_days_count_between_date.py
from datetime import datetime, timedelta
def get_days_count_between_date(from_date, to_date, count=True):
from_date = datetime.strptime(from_date, "%Y-%m-%d %H:%M:%S").date()
to_date = datetime.strptime(to_date, "%Y-%m-%d %H:%M:%S").date()
delta = to_date - from_date
date_range = [ from_date + timedelta(days=i) for i in range(delta.days + 1)]
if count:
return len(date_range)