Skip to content

Instantly share code, notes, and snippets.

View mckoss's full-sized avatar

Mike Koss mckoss

View GitHub Profile
The master repository for the AppEngine-Base project is stored on GitHub:
http://github.com/mckoss/appengine-base
Windows users can install the Git client: http://code.google.com/p/msysgit/
I use these settings:
- Add Git Bash Here, Add Git GUI Here
- Run Git and included Unix tools from the Windows Command Prompt
- Use OpenSSH
@mckoss
mckoss / tuple_iter.py
Created November 3, 2009 17:16
Some nice Tuple-Iterators for Python
class tuples(object):
"""
Iterator that generates all tuples in lexicographical order.
For example:
for t in tuples((2,3)):
print t
produces:
@mckoss
mckoss / nuggets.py
Created November 4, 2009 00:09
McNugget Problem (Knapsack)
"""
The McNugget Problem
Find the smallest n s.t. there exists a solution to:
n = 6x + 9y + 20z
for n, n+1, n+2, ... , n+5
Result is:
@mckoss
mckoss / select.py
Created November 23, 2009 22:17
Kth Largest Select in Python
def Select(a, i, first=0, last=None):
if last is None:
last = len(a)-1
p = Pivot(a, first, last)
if p == i:
return a[p]
if p < i:
return Select(a, i, p+1, last)
return Select(a, i, first, p-1)
@mckoss
mckoss / twitter-rate.html
Created November 29, 2009 22:54
Twitter Rate Calculator (JavaScript)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Twitter Rate Calculator - Find the rate that any keyword is being Twittered.</title>
<style>
table {
border-collapse:collapse;
}
p {
@mckoss
mckoss / amzn.py
Created November 30, 2009 02:36
AMZN.com Dictionary Crawler
import httplib
import urllib2
import sys
# TODO: Speed up by searching on multiple connections, say, 10
def DictSearch(sAfter):
dict = open("dict.txt")
f = open("output.csv", 'a')
@mckoss
mckoss / download_sp.py
Created December 5, 2009 00:29
SharePoint downloader for Python
"""
Download all document links from a web page.
Used to extract all the docouments from a Sharepoint document library.
by Mike Koss, September, 2009
Notes:
9/14/09 mck:
Using Beautiful soup version 3.0.7a. The current version (3.1.0.1) is NOT resilient
@mckoss
mckoss / twitter.py
Created December 5, 2009 02:22
Simple Twitter Wrapper for Python
"""
Simple twitter API wrapper for python
Useage:
twitter = Twitter()
twitter.set_user_pass(user, passwd) - Set the user password for authenticated requests
twitter.friends_ids(user) - pass username or id to get list of all friend ids
twitter.update(text) - send an update for the current user ("tweet")
@mckoss
mckoss / enigma-test.html
Created December 7, 2009 19:46
Enigma Machine Simulator with Unit Tests
<html>
<head>
<title>Engima Test Page</title>
<script src="namespace.js"></script>
<script src="enigma.js"></script>
<script src="unit.js"></script>
</head>
<body>
<h1><script>document.write(document.title);</script></h1>
<SCRIPT>
@mckoss
mckoss / namespace.js
Created December 7, 2009 19:47
JavaScript Namespace
/* Namespace.js
Version 1.0, June 2009
by Mike Koss - released into the public domain.
Support for building modular namespaces in javascript.
Globals:
window.global_namespace (Namespace) - The top of the namespace heirarchy. Child namespaces