Skip to content

Instantly share code, notes, and snippets.

@python273
python273 / date_ranges_overlapping.py
Last active April 20, 2021 20:03
Python Date Range & number of unique overlapping days with date range
# -*- coding: utf-8 -*-
"""
:authors: python273
:license: Apache License, Version 2.0
:copyright: (c) 2018 python273
"""
from datetime import datetime, timedelta
from functools import reduce
import operator
@python273
python273 / line.py
Last active June 8, 2018 10:48
Python line (e.g. timeline) with non-intersecting intervals implementation
# -*- coding: utf-8 -*-
"""
:authors: python273
:license: Apache License, Version 2.0
:copyright: (c) 2018 python273
"""
from functools import reduce
from itertools import chain
from numbers import Number
import asyncio
@asyncio.coroutine
def proxify(reader, writer):
addr_writer = writer.get_extra_info('peername')[0]
while True:
data = yield from reader.read(8192)
@python273
python273 / hack.py
Last active February 10, 2017 16:33
Hacking multi time pad (Coursera: Cryptography I; Week 1)
import sys
import random
from itertools import combinations
import string
MSGS = (
# X -> Y means that the strings start with the same prefix
# 1 -> 8
# Install dependencies
NGINX_VERSION=1.10.1 && \
OPENSSL_VERSION=1.0.1t && \
NPS_VERSION=1.11.33.3 && \
sudo apt-get install unzip build-essential checkinstall git libpcre3 libpcre3-dev zlib1g zlib1g-dbg zlib1g-dev && \
mkdir -p ~/sources/ && \

Keybase proof

I hereby claim:

  • I am python273 on github.
  • I am python273 (https://keybase.io/python273) on keybase.
  • I have a public key ASDZ5cazye3A_KCFjW091hI3vW_F_l9aIFX5aAD901KS1Ao

To claim this, I am signing this object: