Skip to content

Instantly share code, notes, and snippets.

View kfr2's full-sized avatar
🌮
Hello!

Kevin Richardson kfr2

🌮
Hello!
View GitHub Profile
@kfr2
kfr2 / csv2xls.py
Last active December 10, 2015 00:39
Converts the specified CSV file to XLS using xlwt and outputs to stdout.
"""
Converts the specified CSV file to XLS using xlwt.
Copyright 2012 Kevin Richardson
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
@kfr2
kfr2 / union_csv.py
Last active December 9, 2015 22:18
Output the intersection of elements contained within the first column of the CSV files passed in as command line arguments.
"""
Output the intersection of elements contained within the first column of the
passed-in CSV files.
Copyright 2012 Kevin Richardson
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
# FROM: http://en.wikipedia.org/wiki/Base_36#Python_implementation
def base36encode(number):
"""Converts an integer into a base36 string."""
ALPHABET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
if not isinstance(number, (int, long)):
raise TypeError('This function must be called on an integer.')
base36 = ''