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 yagmail | |
import dbInfo | |
yag = yagmail.SMTP(dbInfo.alertEmail) | |
# Password for <email-username>: Type password here | |
# Save username and password in keyring? [y/n]: Type 'y' |
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
var vid = new Hypervideo({ | |
path: "SxccCYudkxg", // YouTube video Id or path to self hosted video | |
host: "YouTube", // Either "YouTube" or "Self" for self hosted videos | |
aspectRatio: "16:9", // Aspect Ratio of either "16:9" or "4:3" | |
list: [ // 2D array of line items and times they appear | |
["JC Jackson Arrested",9], | |
["Young Body Found",114], | |
["Local Weather",166], | |
["Summer Burglary Prevention",246], | |
["Florida Abortion Bill",296], |
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
from selenium import webdriver | |
from selenium.common.exceptions import NoSuchElementException | |
""" | |
@function elementExists | |
Checks if a given element exists on the driver page given a search type and value | |
@param {WebDriver} driver: The driver to search for | |
@param {str} locateType: The type of search to preform (only "by_id" is supported) | |
@param {str} locateValue: The value of a given type to search for (only "id" is supported) | |
@return {boolean}: Whether or not it exists |
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
""" | |
@function indexOfAll | |
Utility function to find the index of every instance of a given substring in a string | |
@param {str} string: The string to search through | |
@param {str} sub: The substring to search for | |
@return {int[]}: A list of indeces everywhere that substring appears | |
""" | |
def indexOfAll(string, sub): | |
output = [] | |
for i in range(0,len(string)): |
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
""" | |
@function isNumber | |
Utility function to determine if a string is a valid number | |
@param {str} string: The string to test | |
@return {boolean}: Whether or not it's a valid number | |
""" | |
def isNumber(string): | |
try: | |
float(string) | |
return 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
from geopy.geocoders import Nominatim | |
from geopy.exc import GeocoderServiceError, GeocoderTimedOut | |
""" | |
@function getZipCode | |
Finds the zip code given a Cincinnati, OH address | |
@param {str} addressStreet: The address to find the zip code of | |
@return {str}: The zip code or an empty string if no zip code is found. | |
""" | |
def getZipCode(addressStreet): |
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 pickle | |
""" | |
@function save | |
Saves the saveData global variable into a pickle file | |
""" | |
def save(): | |
global saveData | |
with open('filename.pickle','wb') as f: | |
pickle.dump(saveData, f) |
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 | |
""" | |
@type dict | |
A dictionary containing data for the spinning line character output | |
@property {str} count: The amount of time, the spinner has spun | |
@property {List} chars: The list of characters to cycle through in order to simulate spinning | |
@constant | |
""" | |
spinner = {'count':0,'chars':['|','/','-','\\']} |
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
from datetime import datetime | |
""" | |
@function updateLog | |
Adds a line to the .log file with a timestamp | |
@param {str} text: The line to add | |
@kwarg {int} [level]: The intendenation level of the line, default=0 | |
""" | |
def updateLog(text, **kwargs): | |
if 'level' in kwargs: |
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
/* | |
Code snippet for vanilla cross-browser height and width gathering | |
*/ | |
function getPageSize() { | |
return { | |
height: Math.max(document.documentElement.clientHeight, window.innerHeight || 0), | |
width: Math.max(document.documentElement.clientWidth, window.innerWidth || 0) | |
} | |
} |
OlderNewer