This file contains hidden or 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
package bench | |
import ( | |
"testing" | |
) | |
type Item struct { | |
Position int | |
name string | |
IsPin bool |
This file contains hidden or 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 csv | |
import json | |
import sqlite3 | |
from sqlite3 import Error | |
import csv | |
import datetime | |
'''Assumes there is a file resumes.json in the path with the input data. | |
1. Load input data and flatten it into list |
This file contains hidden or 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
#python 2.7+, 3 | |
def get_subsets_recursive(l, c=0): | |
""" | |
Recursivemethod | |
l is the set of items to get all combination subsets | |
c is to track recursion depth for visibility | |
""" | |
c+=1 | |
#end recursion loop once at the end of the list |
This file contains hidden or 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
from lxml import html | |
import json | |
import requests | |
from exceptions import ValueError | |
import re, urllib | |
import urllib3 | |
import argparse | |
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) | |
from requests.packages.urllib3.exceptions import InsecureRequestWarning |
This file contains hidden or 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) |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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':[]}) |
NewerOlder