Skip to content

Instantly share code, notes, and snippets.

View dado3212's full-sized avatar

Alex Beals dado3212

View GitHub Profile
@dado3212
dado3212 / deleteGoogleGroup.py
Created August 7, 2017 05:16
Uses Selenium to delete every topic in a Google Group (rate of around 2k/hour deletions)
import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import selenium.webdriver.support.ui as ui
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
credentials = {
# login credentials for google group
'username': '<username>',
@dado3212
dado3212 / ridethebus.py
Created August 13, 2017 00:09
Ride the Bus testing
import itertools, random, csv
suits = ["Spades", "Diamonds", "Hearts", "Clubs"]
values = ["Ace", "2", "3", "4", "5", "6", "7", "8", "9", "10", "Jack", "Queen", "King"]
class InfiDeck:
def __init__(self):
self.deck = self.new_deck()
self.new_decks = 0
self.cards = 0
@dado3212
dado3212 / ConcatenateVCards.py
Last active September 25, 2017 05:21
Creates one giant vCard from a multitude of contacts
# Name: Alex Beals
# Description: Turn an array of contact data into a single vCard for easy import
# Returns a string created from a first and last name, and an optional phone number and email address
def createContact(firstname, lastname, phone="", email=""):
contact = "BEGIN:VCARD\r\n"
contact += "VERSION:2.1\r\n"
contact += "N;LANGUAGE=en-us:" + str(lastname) + ";" + str(firstname) + "\r\n"
contact += "FN:" + str(firstname) + " " + str(lastname) + "\r\n"
if (phone != ""):
#!/bin/bash
recepients=(
"recipient@website.com"
)
sender="sender@website.com"
senderName="Sender Name"
# error handling
@dado3212
dado3212 / SearchTexts.py
Last active September 29, 2017 06:54
Searches through all of your texts for one matching a string
__author__ = "Alex Beals"
import sqlite3, markovify, codecs, warnings, os
# Handle errors from running on Python 2.7 (emoji support)
warnings.simplefilter("ignore")
print("Connecting to chat database...")
# Extract all of my texts from the 'db' file
@dado3212
dado3212 / downloadPearls.py
Created October 12, 2018 04:08
A download script to download all of the PearlsBeforeSwine comic strips, and run them through OCR
import datetime, requests, re, urllib
from StringIO import StringIO
from PIL import Image
import pytesseract
from cgi import escape
import json
base_url = "http://www.gocomics.com/pearlsbeforeswine/"
start_date = datetime.datetime(2002, 1, 7)
headers = {"User-Agent":"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36"}
@dado3212
dado3212 / extractAltText.py
Created April 3, 2023 19:22
A script to extract the alt text from images in an ePub
from ebooklib import epub
import io
from PIL import Image
from bs4 import BeautifulSoup
# Open the EPUB file
book = epub.read_epub('frugal.epub')
image_alts = {}
raw_images = {}
@dado3212
dado3212 / texts_markov.py
Created March 3, 2017 08:10
This is a simple script that auto-generates texts using Markov chains based on your Mac iMessage history
__author__ = "Alex Beals"
import sqlite3, markovify, codecs, warnings, os
# Handle errors from running on Python 2.7 (emoji support)
warnings.simplefilter("ignore")
print("Connecting to chat database...")
# Extract all of my texts from the 'db' file