Skip to content

Instantly share code, notes, and snippets.

@philgruneich
philgruneich / diff_db.py
Created November 16, 2014 05:54
Show differences between 2 Dropbox files
# -*- coding: utf-8 -*-
import difflib
import re
import BaseHTTPServer
import webbrowser
header = '''<!DOCTYPE html>
<html>
<head>
@philgruneich
philgruneich / movieDiary.py
Last active August 29, 2015 14:02
Grab IMDB data to fill a MultiMarkdown table to be sent to Day One
#coding: utf-8
from urllib import quote
import json
import re
import sys
import webbrowser
import requests
import htmlentitydefs
movie = quote(sys.argv[1])
@philgruneich
philgruneich / glb2calc.py
Last active August 29, 2015 13:59
Calculator module for GLB2
# -*- coding: UTF-8 -*-
from functools import reduce
from operator import mul
class glb2calc:
def __init__(self, position, height, weight, trait1, trait2, trait3, strength=5, speed=5, agility=5, stamina=5, awareness=5, confidence=5):
if stamina + strength + confidence + awareness + agility + speed < 35:
print('You have {0} attribute points left.'.format(35 - (stamina + strength + confidence + awareness + agility + speed)))
elif stamina + strength + confidence + awareness + agility + speed > 35:
@philgruneich
philgruneich / glb2_character_calculator.py
Created April 13, 2014 00:13
Character Calculator for GLB2
# encoding: utf-8
from functools import reduce
from operator import mul
heights_help = {'56':66, '57':67, '58':68, '59':69, '510':70, '511':71, '60':72, '61':73, '62':74, '63':75, '64':76, '65':77, '66':78, '67':79, '68':80}
traits_help = {'Unpr-edic-table': 'unpredictable', 'Blocking Back': 'hb_blocking_back', 'Solid Frame': 'qb_solid_frame', 'Nerves of Steel': 'nerves_of_steel', 'Speedster': 'wr_speedster', 'Ball Hawk': 'ball_hawk', 'Blitzer': 'lb_blitzer', 'Tactician': 'tactician', 'Dominator': 'wr_control', 'Man Specialist': 'man_specialist', 'Consistent Blocker': 'ol_consistent_blocker', 'Early Bloomer': 'early_bloomer', 'Run Stuffer': 'dl_run_stuffer', 'Technical Blocker': 'ol_tech_blocker', 'Sure Tackler': 'sure_tackler', 'Precision Passer': 'qb_precision_passer', 'Fearsome': 'fearsome', 'Long Reach': 'long_reach', 'Thick Skin': 'thick_skin', 'Coverage LB': 'lb_coverage', 'Quick Feet': 'quick_feet', 'Slippery': 'slippery', 'Shifty': 'wr_shifty', 'Slot Receiver': 'wr_slot_receiver', 'Pass Rusher': 'd
@philgruneich
philgruneich / glb2login.py
Created April 12, 2014 16:41
Logs into GLB2 and grabs the HOF source code.
import requests
from bs4 import BeautifulSoup as bs
login = {
'action': 'login',
'user_name':'your username',
'password':'your password'
}
with requests.Session() as c:
@philgruneich
philgruneich / SafariEvernote.bookmarklet.js
Last active February 26, 2024 07:00
Bookmarklet to save articles from the web to Evernote using Safari on iOS
// Credits to Phillip Gruneich, Brett Terpstra and Jonathon Duerig.
// This bookmarklet requires Drafts by Greg Pierce/Agile Tortoise.
javascript:(function()%7Bvar%20request=new%20XMLHttpRequest();request.open(%22GET%22,%22http://heckyesmarkdown.com/go/?read=1&preview=0&showframe=0&output=url&u=%22+encodeURIComponent(location.href),true);request.send();request.onreadystatechange=function()%7Blocation.href=%22drafts://x-callback-url/create?text=%22+request.responseText+%22&action=Markdown%20to%20Evernote%22%7D;%7D)();
// Version without triggering the Markdown to Evernote action on Drafts
javascript:(function()%7Bvar%20request=new%20XMLHttpRequest();request.open(%22GET%22,%22http://heckyesmarkdown.com/go/?read=1&preview=0&showframe=0&output=url&u=%22+encodeURIComponent(location.href),true);request.send();request.onreadystatechange=function()%7Blocation.href=%22drafts://x-callback-url/create?text=%22+request.responseText%7D;%7D)();
javascript:(function(){var p=document.createElement("p");p.innerHTML="<strong>Loading&hellip;</strong>";p.id="loadingp";p.style.padding="20px";p.style.background="#fff";p.style.left="20px";p.style.top=0;p.style.position="fixed";p.style.zIndex="9999999";p.style.opacity=".85";document.body.appendChild(p);document.body.appendChild(document.createElement("script")).src="https://gist.github.com/ttscoff/6109434/raw/Bullseye.js?x="+(Math.random());})();
@philgruneich
philgruneich / Toggle Invisible Files.scpt
Created March 16, 2014 05:06
Show/Hide invisible files in Finder. Add to ~/Library/Application Support/Launchbar/Scripts to launch from Launchbar.
set stateMent to do shell script "defaults read com.apple.finder AppleShowAllFiles"
if stateMent = "TRUE" then
do shell script "defaults write com.apple.finder AppleShowAllFiles FALSE"
else
do shell script "defaults write com.apple.finder AppleShowAllFiles TRUE"
end if
tell application "Finder" to quit
delay 2
launch application "Finder"
@philgruneich
philgruneich / commas_mmdtable.py
Last active March 18, 2018 13:17
Scripts to simplify the syntax for MultiMarkdown tables.
import re
table = '''First Header,Second Header,Third Header
1st Item,2nd\,Item,3rd Item
,One cell,Two cells
Two cells,One cell,
Awesome'''
ttable = [[re.sub('\\\,',',',cell) for cell in re.split('(?<!\\\),', row)] for row in table.split('\n')]
# -*- coding: utf-8 -*-
from json import loads
from requests import get
import location
from datetime import date
import time
from console import alert
# Customization here
APItoken = 'Insert your API token here'