Skip to content

Instantly share code, notes, and snippets.

Avatar

Alex Beals dado3212

View GitHub Profile
@dado3212
dado3212 / downloadPearls.py
Created Oct 12, 2018
A download script to download all of the PearlsBeforeSwine comic strips, and run them through OCR
View downloadPearls.py
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 / SearchTexts.py
Last active Sep 29, 2017
Searches through all of your texts for one matching a string
View SearchTexts.py
__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
View FakingEmailWithElho.sh
#!/bin/bash
recepients=(
"recipient@website.com"
)
sender="sender@website.com"
senderName="Sender Name"
# error handling
@dado3212
dado3212 / ConcatenateVCards.py
Last active Sep 25, 2017
Creates one giant vCard from a multitude of contacts
View ConcatenateVCards.py
# 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 != ""):
@dado3212
dado3212 / ridethebus.py
Created Aug 13, 2017
Ride the Bus testing
View ridethebus.py
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 / deleteGoogleGroup.py
Created Aug 7, 2017
Uses Selenium to delete every topic in a Google Group (rate of around 2k/hour deletions)
View deleteGoogleGroup.py
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 / texts_markov.py
Created Mar 3, 2017
This is a simple script that auto-generates texts using Markov chains based on your Mac iMessage history
View texts_markov.py
__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