This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import itertools | |
#itertools used for permutations to create sets | |
''' | |
Author: Imran Hassanali | |
Email: develop.imran@gmail.com | |
''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import itertools | |
from collections import Counter | |
# gets the most common element from a list | |
def Most_Common(lst): | |
data = Counter(lst) | |
return data.most_common(1)[0] | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import itertools | |
from collections import Counter | |
# gets the most common element from a list | |
def Most_Common(lst): | |
data = Counter(lst) | |
return data.most_common(1)[0] | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
import itertools | |
from collections import Counter | |
''' BEGIN UTILITY SCRIPTS''' | |
# gets the most common element from a list | |
def Most_Common(lst): | |
data = Counter(lst) | |
return data.most_common(1)[0] | |
#gets card value from a hand. converts A to 14, is_seq function will convert the 14 to a 1 when necessary to evaluate A 2 3 4 5 straights | |
def convert_tonums(h, nums = {'T':10, 'J':11, 'Q':12, 'K':13, "A": 14}): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
trivial orchard example | |
exploring multidimensional dynamic data types | |
''' | |
def create_orchard(): | |
return {'orchard':[]} | |
def add_tree_row(orchard, n=1): | |
for x in xrange(n): | |
orchard['orchard'].append({'tree_row':[]}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import pprint | |
import os.path | |
def list_tocsv(list, filename): | |
import csv | |
with open(filename, 'wb') as f: | |
writer = csv.writer(f) | |
writer.writerows(list) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from selenium import webdriver | |
import subprocess | |
ff_prof = webdriver.FirefoxProfile() | |
#set some privacy settings | |
ff_prof.set_preference( "places.history.enabled", False ) | |
ff_prof.set_preference( "privacy.clearOnShutdown.offlineApps", True ) | |
ff_prof.set_preference( "privacy.clearOnShutdown.passwords", True ) | |
ff_prof.set_preference( "privacy.clearOnShutdown.siteSettings", True ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pprint | |
MANUAL_TEMPLATE = { | |
"title": "", | |
"header": "", | |
"warning": "Please make sure you have the following setup before starting", | |
"requirements":[], | |
"setup": |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import mailbox | |
import email | |
import quopri | |
import json | |
from BeautifulSoup import BeautifulSoup | |
def cleanContent(msg): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import mailbox | |
import email.utils | |
from mboxparse import convert_to_json | |
filename = "metadatatest2525.mbox" | |
#the following returns a list containing message objects. Each message objects is composed of the components listed on line 20. | |
mbox = mailbox.mbox(filename) |
OlderNewer