Skip to content

Instantly share code, notes, and snippets.

@leifulstrup
leifulstrup / gist:3c661f427bf987866c76ec7035bd1141
Last active January 15, 2018 15:10
getNAICSdescription(naicsCode) #using Code For America Server
# http://naics.codeforamerica.org #includes details on queries
#!!! missing NAICS codes - key errors
# see https://www.census.gov/eos/www/naics/
# get 2017 updated xml NAICS code listing here - https://www.census.gov/eos/www/naics/2017NAICS/2017_NAICS_Structure.xlsx
import requests
from bs4 import BeautifulSoup
import re
import ast
import requests
from bs4 import BeautifulSoup
import re
likelyURLlookup = {} # use dynamic programming to build a lookup table
def getLikelyURL(vendorname):
try:
likelyURLlookup[vendorname]
except KeyError:
@leifulstrup
leifulstrup / gist:c2d11e201112b98294bccdd09b5b7fb7
Created September 13, 2017 19:24
Simple OSX Python function to communicate alert via Mac text to speech capability - useful when waiting for long data processing to finish
import os
def alertMe(phrase):
text2speak = 'say ' + '"' + phrase + '"'
os.system(text2speak)
alertMe("Alert Me Function Works")