Skip to content

Instantly share code, notes, and snippets.

View n8henrie's full-sized avatar

Nathan Henrie n8henrie

View GitHub Profile
@n8henrie
n8henrie / LCP_Encode_Decode.txt
Last active August 29, 2015 13:56
LCP Action to either URL encode or decode text from the prompt.
launch://?url=[[list:Encode or Decode?|Encode=launch%3A%2F%2Fx-callback-url%2Fclipboard%3Ftext%3D%5Bprompt%3AText%5D%26x-success%3D%7B%7Blaunch%3A%2F%2Fclipboard%2Fconvert%3Fformat%3Durlencode%7D%7D|Decode=launch%3A%2F%2Fx-callback-url%2Fclipboard%3Ftext%3D%5Bprompt%3AText%5D%26x-success%3D%7B%7Blaunch%3A%2F%2Fclipboard%2Fconvert%3Fformat%3Durldecode%7D%7D]]
@n8henrie
n8henrie / Get Google Cache.applescript
Last active August 29, 2015 14:01
Pulls up the Google Cached version of the current webpage, even if that webpage won't load.
on get_browser()
set valid_browsers to {"Safari", "Google Chrome"}
tell application "System Events"
set front_app to name of first application process whose frontmost is true
if valid_browsers contains front_app then
return front_app
else
set running_apps to (name of every process where background only is false)
repeat with valid_browser in valid_browsers
@n8henrie
n8henrie / lcp_unquote.py
Last active August 29, 2015 14:03
Quick script to undo all my hard-earned URL quoting in LCP scripts, which have stopped working after LCP 2.3.1
#! /usr/bin/env python3
'''lcp_unquote.py
Takes a Launch Center Pro .lcpbackup file as an argument and
unencodes all the URL encoded stuff, possibly making it more readable,
and much of which is probably unnecessary after LCP 2.3.1.
Details: http://n8h.me/1meUxTi
'''
import re
import urllib.parse
@n8henrie
n8henrie / ekg_early_repol.py
Created June 30, 2014 16:08
Pythonista Script to use Dr. Smith's EKG Calculator (primarily from Launch Center Pro)
#! /usr/bin/env python3
'''(1.196 x STE at 60 ms after the J-point in V3 in mm) + (0.059 x computerized QTc) - (0.326 x R-wave Amplitude in V4 in mm).
Use the calculator below. A value greater than 23.4 is quite sensitive and specific for LAD occlusion.
http://hqmeded-ecg.blogspot.com/2013/06/here-is-link-to-full-text-of-article-in.html'''
import sys
try:
import console
ios = True
except ImportError:
@n8henrie
n8henrie / crashplan_dirs.py
Last active August 29, 2015 14:03
Takes the crashplan log and sorts it by the most commonly used directories.
#! /usr/bin/env python3
'''crashplan_dirs.py
Takes the crashplan log and sorts it by the most commonly used directories.
As of 20140907 only configured for Mac OSX.
'''
import re
import collections
import sys
import logging
@n8henrie
n8henrie / buffer.js
Created July 8, 2014 22:32
Improved Buffer bookmarklet that *should* work on iPhone, iPad, and Mac.
// javascript:(function()%20%7Bvar%20platform%20=%20window.navigator.platform;if%20(platform%20==%20'iPhone')%20%7Bvoid(location.href='bufferapp://?u='+encodeURIComponent(location.href)+'&t='+encodeURIComponent(document.title))%7Delse%20%7Bvar%20a=document.getElementsByTagName('head')%5B0%5D%2Cb=document.createElement('script');b.type='text/javascript';b.src='http://bufferapp.com/js/bookmarklet.v1.js?';a.appendChild(b);%7D%7D)();void%200;
javascript:(function() {
var platform = window.navigator.platform;
if (platform == 'iPhone') {
void(location.href='bufferapp://?u='+encodeURIComponent(location.href)+'&t='+encodeURIComponent(document.title))
}
else {
var a=document.getElementsByTagName('head')[0],b=document.createElement('script');
b.type='text/javascript';
b.src='http://bufferapp.com/js/bookmarklet.v1.js?'+Math.floor(Math.random()*99999);
@n8henrie
n8henrie / pip_uninstall_batch.sh
Last active August 29, 2015 14:04
Oneliner to batch uninstall my pyobjc libraries
# Requires GNU xargs `brew install findutils --default-names`, and I used ack instead of grep just out of habit.
# Will also leave the first item from the list out because of the weird way `$@` works, so manually uninstall it.
xargs -a <( pip3 list | ack pyobjc | cut -d " " -f 1 ) bash -c 'for f in "$@"; do echo y | pip3 uninstall "$f"; done'
@n8henrie
n8henrie / code.gs
Created August 6, 2014 06:11
Wedding Countdown Timer (copy from Google Sites since it won't let me copy to Google Drive)
function doGet() {
var template = HtmlService.createTemplateFromFile('index');
var htmlOutput = template.evaluate()
.setSandboxMode(HtmlService.SandboxMode.NATIVE);
return htmlOutput;
}
function include(filename) {
@n8henrie
n8henrie / download_links.sh
Created August 6, 2014 16:37
Wget script to download a bunch of pics from subpages all linked from a single page