Skip to content

Instantly share code, notes, and snippets.

@drdrang
drdrang / desktop
Created April 28, 2016 03:21
Toggle the visibility of icons on the OS X Desktop. A reworking of Craig Hockenberry's original: https://gist.github.com/chockenberry/a6a06a73cce44e29808b22d458cafdcb
#!/bin/bash
# Toggle the visibility of Desktop icons.
# Desktop icons are visible if the CreateDesktop setting is missing or
# if it exists and is set to 1, true, yes, or on (case insensitive).
# Desktop icons are hidden if the CreateDesktop setting exists and
# is set to any value other than 1, true, yes, or on.
# The $icons variable is the value of CreateDesktop if it exists or is
@drdrang
drdrang / Pair.py
Created October 14, 2014 16:14
Pythonista script for putting two screenshots side by side.
import Image
import photos, speech, console
speech.say('left image?', '', .18)
s1 = photos.pick_image()
speech.say('right image?', '', .18)
s2 = photos.pick_image()
w = s1.size[0] + s2.size[0] + 60
h = max(s1.size[1], s2.size[1]) + 40
@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 / 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 / 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 / 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 / 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 / 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 / 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 / Cleanbar Side by Side.py
Created November 16, 2013 03:32
Create a new image from two screenshots chosen from the Camera Roll. Clean the statusbars of both screenshots using the Cleanbar.py module (https://gist.github.com/drdrang/7365980).
import Image
from Cleanbar import cleanbar
import console, photos
s1 = cleanbar(photos.pick_image())
s2 = cleanbar(photos.pick_image())
w = s1.size[0] + s2.size[0] + 60
h = max(s1.size[1], s2.size[1]) + 40
ss = Image.new('RGB', (w,h), '#888')