Skip to content

Instantly share code, notes, and snippets.

View priyadhoundiyal's full-sized avatar

Priya Dhoundiyal priyadhoundiyal

  • Climbax Entertainment
  • Delhi, India
View GitHub Profile
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
mr Marathi
bs Bosnian
ee_TG Ewe (Togo)
ms Malay
kam_KE Kamba (Kenya)
mt Maltese
ha Hausa
es_HN Spanish (Honduras)
ml_IN Malayalam (India)
ro_MD Romanian (Moldova)

Principles of Adult Behavior

  1. Be patient. No matter what.
  2. Don’t badmouth: Assign responsibility, not blame. Say nothing of another you wouldn’t say to him.
  3. Never assume the motives of others are, to them, less noble than yours are to you.
  4. Expand your sense of the possible.
  5. Don’t trouble yourself with matters you truly cannot change.
  6. Expect no more of anyone than you can deliver yourself.
  7. Tolerate ambiguity.
  8. Laugh at yourself frequently.
@priyadhoundiyal
priyadhoundiyal / logging_config.py
Created December 23, 2017 12:15
default django logging config
# Default logging for Django. This sends an email to the site admins on every
# HTTP 500 error. Depending on DEBUG, all other log records are either sent to
# the console (DEBUG=True) or discarded (DEBUG=False) by means of the
# require_debug_true filter.
DEFAULT_LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse',
@priyadhoundiyal
priyadhoundiyal / info.txt
Last active December 8, 2017 12:32 — forked from devinmancuso/multibrowsertest.py
Example Python Multiple Browser Automated Unit Testing Using Selenium 2 WebDriver (Chrome and Firefox Separately Defined)
Download geckodriver and chrome driver from
https://github.com/mozilla/geckodriver/releases
and
http://chromedriver.storage.googleapis.com/index.html?path=2.33/ (replace 2.33 with the latest version)
Add to path as ``` export PATH=$PATH:~/path/to/executables ```
@priyadhoundiyal
priyadhoundiyal / timing.py
Last active December 5, 2017 06:22
Time To Run - simply import timing in python program to get time taken to run it - Source[https://stackoverflow.com/questions/1557571/how-do-i-get-time-of-a-python-programs-execution/1557906#1557906]
import atexit
from time import clock
def secondsToStr(t):
return "%d:%02d:%02d.%03d" % \
reduce(lambda ll,b : divmod(ll[0],b) + ll[1:],
[(t*1000,),1000,60,60])
line = "="*40
def log(s, elapsed=None):
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
@priyadhoundiyal
priyadhoundiyal / about.md
Created November 10, 2017 04:31 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer
@priyadhoundiyal
priyadhoundiyal / save-pdf.py
Created October 9, 2017 13:26
generate pdf from template and save to db
from django.template.loader import get_template
from django.template import RequestContext
from django.http import HttpResponse
from django.conf import settings
from weasyprint import HTML, CSS
from django.core.files.uploadedfile import SimpleUploadedFile
@api_view(('GET',))
def savePDF(request, *args, **kwargs):
html_template = get_template('template.html')
import datetime
start_date_str = '2017-08-01'
start_date = datetime.datetime(2017,8,1).date()
start_date = datetime.datetime.strptime(start_date_str, '%Y-%m-%d').date()
# both of the above functions return date objects
start_date = datetime.datetime(2017,8,1)
start_date = datetime.datetime.strptime(start_date_str, '%Y-%m-%d')
# both of the above functions return datetime objects
# to find number of sundays in a given month
today = datetime.date(2017,04,01)
m=today.month
y=today.year
first_day,month_len = calendar.monthrange(y,m)
date_of_fsun = 1+6-first_day
print sum(1 for x in range(date_of_fsun,month_len+1,7))