Skip to content

Instantly share code, notes, and snippets.

@drdrang
drdrang / gist:7858623
Created December 8, 2013 15:00
Get the URL of the top item in a Squarespace blog.
#!/usr/bin/python
import json, urllib2
r = urllib2.urlopen('http://wrappedthoughts.com/?format=json-pretty').read()
j = json.loads(r)
print j['items'][0]['urlId']
@drdrang
drdrang / Wifi Statusbar.py
Last active December 31, 2015 07:48
Overlay full strength graphics on statusbar of an iOS screenshot when the device is using wifi.
#!/usr/bin/python
import Image
import base64, zlib
# Jay Parlar convinced me to turn this data structure
# from a dictionary into an object.
class PackedImage(object):
def __init__(self, mode, size, data):
self.mode = mode
@drdrang
drdrang / LTE Statusbar.py
Last active December 31, 2015 07:49
Overlay full strength symbols on iOS screenshot using LTE.
#!/usr/bin/python
import Image
import base64, zlib
# Jay Parlar convinced me to turn this data structure
# from a dictionary into an object.
class PackedImage(object):
def __init__(self, mode, size, data):
self.mode = mode
@drdrang
drdrang / Strikeout.py
Last active December 31, 2015 21:49
Pythonista script for s̸t̸r̸i̸k̸i̸n̸g̸ ̸o̸u̸t̸ text sent to it from Drafts and sending it back.
import sys
import webbrowser
import urllib
unstruck = sys.argv[1]
struck = []
for c in unstruck:
struck.append(c)
if c not in ' \t\n':
struck.append(u'\u0338')
@drdrang
drdrang / Location.py
Created January 9, 2014 04:55
A Pythonista script that gets the address, latitude, and longitude and sends them to Drafts.
import sys
import location, time
import urllib, webbrowser
# Handle argument, if present.
try:
a = sys.argv[1]
except IndexError:
a = ''
@drdrang
drdrang / Pixellate.kmmacros
Last active January 2, 2016 23:39
Keyboard Maestro macro that pixellates the selection in Acorn.The softness is set to 0 and the amount is given an initial value of 0.15. The Pixellate dialog box is left open so you can change the amount. The macro assumes your Keyboard Preference is set to have the Tab key move focus between all controls. If not, you'll have to adjust the numbe…
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<dict>
<key>Activate</key>
<string>Normal</string>
<key>IsActive</key>
<true/>
<key>Macros</key>
@drdrang
drdrang / Open Recent.kmmacros
Last active January 3, 2016 19:08
A Keyboard Maestro macro (⌥⌘O) for accessing the Open Recent submenu from the keyboard.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<dict>
<key>Activate</key>
<string>Normal</string>
<key>IsActive</key>
<true/>
<key>Macros</key>
@drdrang
drdrang / Amazon Associates link
Last active August 29, 2015 13:56
The AppleScript content of a TextExpander snippet that returns an Amazon Associates link to the item in the frontmost browser document. Commenting/uncommenting Lines 3 and 4 switch between Safari and Chrome.
@drdrang
drdrang / WeatherUnderground.py
Created February 23, 2014 06:07
Pythonista script for generating and displaying the local weather.
#!/usr/bin/python
import json
import requests
import time
from datetime import datetime
import location
import webbrowser
import BaseHTTPServer
@drdrang
drdrang / Alpha Evaluate.py
Last active August 29, 2015 14:03
Evaluate an expression with a numerical answer using Wolfram Alpha and return the result as an equation. Also open the Alpha page in a browser (Mac only). Intended to be used as a BBEdit Text Filter but can be used from the command line. See http://www.leancrew.com/all-this/2014/07/evaluating-latex-with-eddie-and-alpha/
#!/usr/bin/python
from urllib import quote_plus
from sys import stdin
from subprocess import call
import requests
import xml.etree.ElementTree as ET
appID = 'XXXXXX-YYYYYYYYYY' # Placeholder. You'll need to get an ID from http://products.wolframalpha.com/api/