Skip to content

Instantly share code, notes, and snippets.

View sebzur's full-sized avatar
🆑
I may be slow to respond.

Sebastian Żurek sebzur

🆑
I may be slow to respond.
View GitHub Profile
@sebzur
sebzur / pesel_do_date.py
Created December 10, 2017 12:48
Extracts date of birth from polish PESEL identifier
# -*- coding: utf-8
import datetime
def dob_from_pesel(pesel):
# based on http://dev.cdur.pl/Artykuly/Pobieranie-daty-urodzenia-i-plci-z-numeru-PESEL-Javascript
year = 1900 + int(pesel[0:2])
if 2 <= int(pesel[2]) < 8:
year += (int(pesel[2]) / 2) * 100
if int(pesel[2]) >= 8:
year -= 100
@sebzur
sebzur / polish_holidays.py
Created February 12, 2012 20:25
Python generator for public holidays in Poland
from datetime import date, timedelta
from dateutil import easter
from dateutil.relativedelta import *
def get_holidays(year=2010):
""" Returns Polish hollidays dates (legally considered non-working days) """
easter_sunday = easter.easter(year)
holidays = {'New Year': date(year,1,1),
'Trzech Kroli': date(year,1,6),
'Easter Sunday': easter_sunday,