Skip to content

Instantly share code, notes, and snippets.

View keybase.md

Keybase proof

I hereby claim:

  • I am philgruneich on github.
  • I am philgruneich (https://keybase.io/philgruneich) on keybase.
  • I have a public key ASCImpS5AkiYRlekKl0e5xDWhf7uKDFxUjYlcA7aBcsOEQo

To claim this, I am signing this object:

@philgruneich
philgruneich / check_training_demand.js
Created May 1, 2018 21:16
CSM: calculate how much training will require to reach limits before 28yo on transfer list
View check_training_demand.js
Array.from(document.querySelectorAll('article.player')).forEach((player) => {
const age = +player.querySelector('.general .first-col li:nth-child(2)').textContent.substr(5, 2);
const rx = /(\d+)[^\d]*(\d+)?/;
const skills = player.querySelector('.skills-bar');
const aim = skills.querySelector('li:first-child .visual').textContent.trim().match(rx);
const handling = skills.querySelector('li:nth-child(3) .visual').textContent.trim().match(rx);
const quickness = skills.querySelector('li:nth-child(5) .visual').textContent.trim().match(rx);
const determination = skills.querySelector('li:nth-child(6) .visual').textContent.trim().match(rx);
const awareness = skills.querySelector('li:nth-child(7) .visual').textContent.trim().match(rx);
let player_skills = {
@philgruneich
philgruneich / gist:77d5f3c6c76717cd62e59de7ba6e9137
Created May 1, 2018 15:38
Automatically trains pickup players GLB2
View gist:77d5f3c6c76717cd62e59de7ba6e9137
var request = new XMLHttpRequest();
var counter = 0;
var limit = 40; // Trains 40 times
var counterFunction = function() {
request.abort();
request.open('POST', '/game/player/' + glb2.player.playerId + '/pickup_join', true);
request.onload = function() {
if (request.status >= 200 && request.status < 400) {
if (!!+request.responseText) ++counter;
if (counter >= limit) window.clearInterval(interval)
@philgruneich
philgruneich / Complete Reminder.py
Created March 20, 2016 18:56 — forked from anonymous/Complete Reminder.py
Complete Reminder.py
View Complete Reminder.py
# coding: utf-8
import reminders
import sys
import dialogs
import webbrowser
from urllib import quote
def completeReminder():
@philgruneich
philgruneich / MovieDiaryConfig.py
Created February 23, 2016 01:42 — forked from anonymous/MovieDiaryConfig.py
MovieDiaryConfig.py
View 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
@philgruneich
philgruneich / FixMovieDiary.py
Created February 20, 2016 23:01 — forked from anonymous/FixMovieDiary.py
FixMovieDiary.py
View FixMovieDiary.py
# coding: utf-8
import keychain
import console
from urllib import quote, unquote
keychain.set_password('MovieDB', 'API', console.input_alert('Insert your MovieDB API key', '', keychain.get_password('MovieDB', 'API')))
keychain.set_password('Airtable', 'API', console.input_alert('Insert your Airtable API key', '', keychain.get_password('Airtable', 'API')))
keychain.set_password('Airtable', 'Movie Diary', console.input_alert('Insert your Airtable database ID', '', keychain.get_password('Airtable', 'Movie Diary')))
keychain.set_password('Airtable', 'Movie Diary Table', quote(console.input_alert('Insert the name of your Airtable table', '', unquote(keychain.get_password('Airtable', 'Movie Diary Table')))))
@philgruneich
philgruneich / Movie Diary.py
Last active January 18, 2019 06:37 — forked from anonymous/Movie Diary.py
Movie Diary.py
View Movie Diary.py
#!/usr/bin/env/python2
# coding: utf-8
import requests
import json
import appex
import dialogs
import re
import datetime
import keychain
@philgruneich
philgruneich / New from Gist.py
Created January 30, 2016 15:39
Adds Python gists to Pythonista.
View New from Gist.py
# coding: utf-8
# This script downloads and opens a Gist from a URL in the clipboard.
# It's meant to be put in the editor's actions menu.
#
# It works with "raw" and "web" gist URLs, but not with gists that
# contain multiple files or non-Python files.
#
# If a file already exists, a dialog is shown that asks whether the
# new file should be renamed or replaced.
@philgruneich
philgruneich / OCRtoInteract.py
Last active March 17, 2020 00:28
Requires Pythonista for iOS and Interact for iOS. Sends image and returns OCR'd text. Opens text in Interact unless used from action extension, then adds to clipboard.
View OCRtoInteract.py
# coding: utf-8
import requests
import photos
from PIL import Image, ImageEnhance
import StringIO
import appex
import console
import json
import keychain
@philgruneich
philgruneich / tumblr.js
Created May 13, 2015 16:54
Open in Tumblr App
View tumblr.js
javascript:(function() {var tumblr=document.querySelector("meta[name='twitter:app:url:iphone']").getAttribute('content');if (tumblr.match(/^tumblr:\/\/x-callback-url\/blog\?.*/)) window.location=tumblr;})();