Skip to content

Instantly share code, notes, and snippets.

def _overlapping_ranges_iter(iter1, iter2, *, include_empty=False, range_getter=None):
"""Iterates over two iterables of ranges and returns a iterator over all
ranges with their common values.
Input: two sorted iterators that have a sortable start end
Output: iterator of tuples of the form (start, end, val1|None, val2|None)
By default, range_getter gets its start from val[0] and end from val[1], but
may be replaced with any method that takes a value and returns a 2-tuple of
start, end.
@ralphje
ralphje / pain.py
Created June 20, 2013 11:35
PAIN creation file
from lxml import etree, objectify
import datetime
import time
import os
import random
PAIN_IDENTIFIER = 'IA'
XSD_PATH = 'xsd'
class PainError(Exception):
@ralphje
ralphje / gist:5106949
Created March 7, 2013 10:07
Migrating issues from Redmine to GitHub
import csv
import datetime
import feedparser # pip install feedparser
import html2text # pip install html2text
from pygithub3 import Github # pip install pygithub3
# USAGE: Create a csv with all columns from Redmine and fetch
# your API key from Redmine. Then use the code below to match
# properties of the csv with properties of your GitHub issues.
# Note: remove the first line of the exported CSV.