Skip to content

Instantly share code, notes, and snippets.

Ole Zorn omz

Block or report user

Report or block omz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@omz
omz / gist:1102091
Created Jul 24, 2011 — forked from marcoarment/gist:1100959
Creating arbitrarily-colored icons from a black-with-alpha master image (iOS)
View gist:1102091
// Usage example:
// input image: http://f.cl.ly/items/3v0S3w2B3N0p3e0I082d/Image%202011.07.22%2011:29:25%20PM.png
//
// UIImage *buttonImage = [UIImage ipMaskedImageNamed:@"UIButtonBarAction.png" color:[UIColor redColor]];
// .h
@interface UIImage (IPImageUtils)
+ (UIImage *)ipMaskedImageNamed:(NSString *)name color:(UIColor *)color;
@end
@omz
omz / gist:2134449
Created Mar 20, 2012
Highlighter plain text format
View gist:2134449
FooBar.pdf
================================================================================
p. 4 | highlight | yellow
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
culpa qui officia deserunt mollit anim id est laborum.
@omz
omz / FileTransfer.py
Last active Oct 19, 2019
File Transfer script for Pythonista (iOS)
View FileTransfer.py
# File Transfer for Pythonista
# ============================
# This script allows you to transfer Python files from
# and to Pythonista via local Wifi.
# It starts a basic HTTP server that you can access
# as a web page from your browser.
# When you upload a file that already exists, it is
# renamed automatically.
# From Pythonista's settings, you can add this script
# to the actions menu of the editor for quick access.
View GoogleSearch.py
# Google Search for Pythonista (iOS)
# Searches Google and copies the first result to the clipboard as
# a Markdown link in the form [title](url).
#
# Inspired by Brett Terpstra's SearchLink:
# http://brettterpstra.com/searchlink-automated-markdown-linking-improved/
import clipboard
def google(terms):
View Top Apps.py
# Shows a list of the 10 top paid apps on the App Store.
print 'Loading...'
import feedparser
import console
print 'Fetching Feed...'
feed = feedparser.parse('http://itunes.apple.com/us/rss/toppaidapplications/limit=10/xml')
entries = feed['entries']
View Meme Generator 1.py
# Meme Generator 1
# Demonstrates how to draw text on images using PIL
# (Python Imaging Library)
#
# The script loads an image from the clipboard (or uses
# a default one if the clipboard is empty) and asks for
# two captions (top and bottom) that are then drawn onto
# the image.
import Image
View Meme Generator 2.py
import Image
import ImageChops
import ImageDraw
import ImageFont
import ImageFilter
import clipboard
def draw_caption(img, text, outline=2, top=False):
text_img = Image.new('RGBA', img.size, (0, 0, 0, 0))
draw = ImageDraw.Draw(text_img)
View Drum Machine.py
#TODO: Adjust size to screen size (iPhone)
#TODO: Clear (and random, play/pause?) buttons
from scene import *
from sound import play_effect, set_volume, load_effect
from colorsys import hsv_to_rgb
import pickle
class DrumMachine (Scene):
def setup(self):
View dropboxlogin.py
# YOU NEED TO INSERT YOUR APP KEY AND SECRET BELOW!
# Go to dropbox.com/developers/apps to create an app.
app_key = 'YOUR_APP_KEY'
app_secret = 'YOUR_APP_SECRET'
# access_type can be 'app_folder' or 'dropbox', depending on
# how you registered your app.
access_type = 'app_folder'
View SpaceShooter.py
from scene import *
from random import randint, random, choice
from sound import play_effect
from colorsys import hsv_to_rgb
from math import sin
from functools import partial
from copy import copy
class Star (object):
def __init__(self):
You can’t perform that action at this time.