Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 / Groceries: Drafts, Clear and Fantastical
Last active December 18, 2015 23:48
From Drafts, it creates an event on Fantastical named "Ir ao Supermercado" ("Go to the Supermarket", in portuguese), starting in your current day at 7PM and ending 30 minutes later. Then it attached the draft you wrote in Drafts to a Clear list named "Compras" ("Groceries", in portuguese). Previously, we also included the url-scheme to view this…
fantastical://x-callback-url/parse?title=Ir%20ao%20supermercado&start=[[date]]%2019:00&end=[[date]]%2019:30&url=clearapp://list/show%3FlistName%3DCompras&x-source=Clear&x-success={{clearapp://list/create?listName=Compras&tasks=[[draft]]}}
@philgruneich
philgruneich / Add to Omnifocus Later
Created July 9, 2013 04:13
Create a Due reminder (title in the first line, date/time specification for Due in the second) with a link to add the task to Omnifocus only when you need the task in your inbox.
due://x-callback-url/add?title=[[title]]%20at%20[[body]]%0A{{omnifocus://add?name=[[title]]}}&x-source=Drafts&x-success={{drafts://}}
@philgruneich
philgruneich / Add to Clear later
Created July 9, 2013 04:16
Create a Due reminder (list name in the first line, task name in the second, date/time specification for Due in the third) with a link to add the task to Clear only when you need the task in your to-do list.
due://x-callback-url/add?title=[[line|2]]%20at%20[[line|3]]%0A{{clearapp://task/create?listName=[[line|1]]&taskName=[[line|2]]}}&x-source=Drafts&x-success={{drafts://}}
@philgruneich
philgruneich / ios_icons.py
Last active January 14, 2016 00:26 — forked from sgerin/ios_icons
Updated with iOS 7 masks (:
# Adapted from Brett Terpstra script: http://brettterpstra.com/2013/04/28/instantly-grab-a-high-res-icon-for-any-ios-app/
# Gets the 1024px version of an app icon and applies a rounded mask. The result is displayed in Pythonista's console, you can tap and hold to save or copy it.
# You may find odd result: try searching for both device categories.
# If you find any bug, you can find me @silouane20 on Twitter.
# iOS 7 masks by @pgruneich on Twitter.
from PIL import Image
from StringIO import StringIO
import re
import requests
@philgruneich
philgruneich / Add to Things later
Created July 9, 2013 04:13
Create a Due reminder (title in the first line, date/time specification for Due in the second) with a link to add the task to Things only when you need the task in your inbox.
due://x-callback-url/add?title=[[title]]%20at%20[[body]]%0A{{drafts://x-callback-url/create?text=[[title]]&action=Send%20to%20Things}}&x-source=Drafts&x-success={{drafts://}}
@philgruneich
philgruneich / MovieDiaryConfig.py
Created February 23, 2016 01:42 — forked from anonymous/MovieDiaryConfig.py
MovieDiaryConfig.py
# coding: utf-8
import dialogs
import keychain
import console
import cPickle
from urllib import quote, unquote
class NoConfigError (Exception): pass
class MissingConfigError (Exception): pass