Skip to content

Instantly share code, notes, and snippets.

View kleerkoat's full-sized avatar

kleerkoat kleerkoat

View GitHub Profile
@viticci
viticci / Launch Center Pro action menu
Created February 4, 2014 16:18
iOS bookmarklet for Launch Center Pro
javascript:window.location='launchpro://?url='+encodeURIComponent('launchpro://?url=[list:URL: ' +location.href+'|🔵 Tweetbot=tweetbot://viticci/post?text={{'+location.href+'}}|📌 Pinswift=pinswift://x-callback-url/add?url={{'+location.href+'}}|✅ To Check Out=drafts://x-callback-url/create?text={{'+location.href+'}}&action={{Stuff To Check Out}}|🔴 Reminder=fantastical2://parse?sentence={{'+location.href+'}}&reminder=1|🔒 Open In 1Password=op'+location.href+'|🔗 Clean Link=clean-links://x-callback-url/clean?url={{'+location.href+'}}]')
@cclauss
cclauss / diagonal_line.py
Last active January 4, 2016 21:49
Use PIL to draw an image of a diagonal line and then make a Pythonista scene.Layer to display the image.
import Image, ImageDraw, scene
def diagonalLineImage(inLength = 200, inColors = ('blue', 'ivory')):
imageLength = inLength + 100 # the image can be larger than what you draw
theImage = Image.new('RGBA', (imageLength, imageLength), inColors[1])
draw = ImageDraw.Draw(theImage)
draw.line((0, 0, inLength, inLength), fill = inColors[0])
del draw
return theImage
function convertToMilitaryTime( ampm, hours, minutes ) {
var militaryHours;
if( ampm == "am" ) {
militaryHours = hours;
// check for special case: midnight
if( militaryHours == "12" ) { militaryHours = "00"; }
} else {
if( ampm == "pm" || am == "p.m." ) {
// get the interger value of hours, then add
tempHours = parseInt( hours ) + 2;
@philgruneich
philgruneich / UpdatePinboardTags.py
Last active July 14, 2020 16:13
UpdatePinboardTags
#coding: utf-8
import console
import keychain
import pickle
login = keychain.get_password('pinboard.in','pythonista')
if login is not None:
user, pw = pickle.loads(login)
else:
@viticci
viticci / SaveImage.py
Created January 23, 2014 19:41
SaveImage
import clipboard
import urllib
import Image
import photos
import cStringIO
# Given an image URL in the clipboard, save the image to the iOS Camera Roll with Pythonista. Simple script with no error checks or other settings.
URL = clipboard.get()
@kevin-smets
kevin-smets / iterm2-solarized.md
Last active April 20, 2025 21:14
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@cclauss
cclauss / KeyboardHack.py
Last active January 3, 2016 07:09
KeyboardHack -- Just a proof of concept to prove that an on screen keyboard could be created in a Pythonista scene.Scene. Four keyboards are defined but only the first is implemented. Shift key not implemented. No number keys. Hard coded to iPad screen resolution, etc. Someone should make it an open source project on GitHub and curate changes (p…
# -*- coding: utf-8 -*-
import scene
keyboard_layouts = (
'''
q w e r t y u i o p del
a s d f g h j k l return
z x c v b n m , . shift
.?123 space .?123
@hiilppp
hiilppp / insert_location.py
Created January 5, 2014 14:27
Python script to append the current location (either as address or Google Maps link) to the provided text (which may be "") in Pythonista and send the result (back) to Drafts.
# -*- coding: utf-8 -*-
# To call script from Drafts, use the follwing URLs as URL Actions:
# - <pythonista://insert_location.py?action=run&argv=[[draft]]&argv=address>
# (Will insert the address of your current location.)
# - <pythonista://insert_location.py?action=run&argv=[[draft]]&argv=link>
# (Will insert a Google Maps link to your current location.)
import location
import re
@CleanShavenApps
CleanShavenApps / DispatchComposeURLScheme.md
Last active August 27, 2022 20:50
/compose URL scheme for Dispatch mail app (www.dispatchapp.net)

Dispatch registers the x-dispatch:// URL scheme and provides one public action: compose.

/compose overview

Launches Dispatch with the composer screen prefilled using information provided in the parameters below.

from

Optional. Specifies the email address of the account to compose the new mail from. If there are more than one account configured in Dispatch, and no valid from account is provided, Dispatch will default to using the first account configured in Dispatch to compose the mail.

@cclauss
cclauss / getColor.py
Last active August 8, 2023 14:43
Creates a dict of 752 Pythonista scene.Colors from the tkinter color palette. This allow you to get colors like: 'light goldenrod yellow', 'light steel blue', 'SlateGray4', 'etc. I would recommend using this code to find the colors that work for your app and then hardcoding them into you app. Loading all 752 colors every time your app runs will …
import bs4, collections, console, requests, scene
tkColorDict = collections.OrderedDict() # key = tkinter color name
def loadTkColorDict(): # will automaticly be called by getColor() if needed
tkColorURL = 'http://www.tcl.tk/man/tcl8.6/TkCmd/colors.htm'
print('Loading tkinter colors from: ' + tkColorURL)
tkColorSoup = bs4.BeautifulSoup(requests.get(tkColorURL).text).tbody
print('Soup is ready. Creating color table...')
for tableRow in tkColorSoup.find_all('tr'):