Skip to content

Instantly share code, notes, and snippets.

View pganssle's full-sized avatar
👨‍💼
Acclimating to new job, full bore FOSS contributions should resume soon.

Paul Ganssle pganssle

👨‍💼
Acclimating to new job, full bore FOSS contributions should resume soon.
View GitHub Profile
@pganssle
pganssle / gist:74a7b5dfae366211956e
Created February 27, 2015 15:18
RRULE2 Profile: Daily BYMONTH
from datetime import datetime, timedelta
try:
from itertools import islice, filterfalse
except ImportError:
# Python 2.x
from itertools import islice, ifilterfalse as filterfalse
def _daily(start_date=datetime.now(), interval=1):
@pganssle
pganssle / test_compression.py
Created August 19, 2014 20:35
Compression of the same data, represented two ways, using BZ2 (similar results with LZMA)
from __future__ import division
import struct
import bz2
# Generate data - round to nearest 1e11 so that no data is lost when formatting in ASCII
xx = range(10**7)
x = [round(ii*1e11)/(1e11*len(xx)) for ii in xx]
sx = struct.pack('d'*len(x), *x)
# Write it to file as a text and binary file