Skip to content

Instantly share code, notes, and snippets.

View abelsonlive's full-sized avatar
🕳️
[ o o ]

Brian Abelson abelsonlive

🕳️
[ o o ]
View GitHub Profile
@abelsonlive
abelsonlive / submit_receipts.py
Last active January 4, 2016 07:09
Load a folder of images / pdfs / documents / etc, and send them one at a time as a attachments via gmail.
import smtplib
from email.MIMEBase import MIMEBase
from email.MIMEText import MIMEText
from email.MIMEMultipart import MIMEMultipart
from email import Encoders
import time
import os
def load_attachments(folder):
# clean up folder name
@abelsonlive
abelsonlive / img_crawler.py
Last active January 3, 2016 21:38
sample img crawler
from mrjob.job import MRJob
from mrjob.protocol import JSONValueProtocol, JSONProtocol, RawProtocol
import json
from urlparse import urlparse
img_formats = [
'jpg',
'gif',
'png'
]
list_of_dicts = [{'a':1}, {'b':2}]
list_of_dicts[-1]['b'] = 3
print list_of_dicts[-1]
@abelsonlive
abelsonlive / streaming_link_tracker.py
Created December 17, 2013 08:39
hack to find links on twitter
@abelsonlive
abelsonlive / csv2json.py
Created December 12, 2013 17:31
convert a csv file into a json list of dicts
import pandas as pd
import json
import sys
def csv2json(file_path):
df = pd.read_csv(file_path, encoding='latin1')
output = []
for i in df.index:
row = {}
@abelsonlive
abelsonlive / known_tlds
Created November 26, 2013 04:31
Known TLDS
var KNOWN_TLDS = [
'aero', 'asia', 'biz', 'cat', 'com', 'coop', 'info',
'int', 'jobs', 'mobi', 'museum', 'name', 'net', 'org', 'post', 'pro',
'tel', 'travel', 'xxx', 'edu', 'gov', 'mil', 'nyc', 'ac',
'ad', 'ae', 'af', 'ag', 'ai', 'al', 'am', 'an', 'ao', 'aq', 'ar',
'as', 'at', 'au', 'aw', 'ax', 'az', 'ba', 'bb', 'bd', 'be', 'bf',
'bg', 'bh', 'bi', 'bj', 'bm', 'bn', 'bo', 'br', 'bs', 'bt', 'bv',
'no', 'bw', 'by', 'bz', 'ca', 'cc', 'cd', 'cf', 'cg', 'ch', 'ci',
'ck', 'cl', 'cm', 'cn', 'co', 'cr', 'cs', 'cu', 'cv', 'cx', 'cy',
'cz', 'dd', 'de', 'dj', 'dk', 'dm', 'do', 'dz', 'ec', 'ee', 'eg',
@abelsonlive
abelsonlive / meat_listener.py
Last active December 29, 2015 09:49
listen to the chat.meatspac.es socket
#!/usr/bin/python
# -*- coding: utf-8 -*-
from socketIO_client import SocketIO
ADDRESS = "https://chat.meatspac.es"
class MeatListener(object):
def __init__(self):
# connect to socket
@abelsonlive
abelsonlive / taskrabbit.py
Created November 24, 2013 08:04
# TaskRabbit Api Submit a json-formatted task to taskrabbit via python selenium
from selenium import webdriver
from datetime import datetime
import os, time
# TASK OBJECT
def taskrabbit(task):
"""
taskrabbit works by taking in a task dictionary with the following key value pairs:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
b = webdriver.Chrome()
b.get("http://chat.meatspac.es")
chat = b.find_element_by_id('add-chat')
chat.send_keys("I just meatsted with python")
chat.send_keys(Keys.RETURN)
<html>
<head>
</head>
<body>
<h1> sheetmusic </h1>
</body>
<script>
// notes and scales