This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numbers, decimal, fractions, sympy, itertools | |
def permutations(p): | |
res = set() | |
for i in range(len(p)): | |
for q in itertools.permutations(p, i): | |
res.add(q) | |
return res | |
def compose(funcs): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
from __future__ import print_function | |
import sys, requests, hashlib | |
if sys.version_info.major == 2: input = raw_input | |
# You can get you key from http://nanowrimo.org/api/wordcount | |
KEY = '8996ghhhftdgn87j' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scene import * | |
from math import atan, cos, sin, sqrt, log | |
ratio = 0.5 | |
def bump(start, end): | |
x1, y1 = start | |
x2, y2 = end | |
length = sqrt((x2-x1)**2 + (y2-y1)**2) | |
midx = (x2 + x1) / 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scene import * | |
def draw_triangle(a, b, c): | |
for pt in (a, b, c): | |
nxt = {a:b, b:c, c:a}[pt] | |
line(pt[0], pt[1], nxt[0], nxt[1]) | |
def more(a, b, c): | |
# a, b, c are 2-tuples | |
# Find the midpoints of a, b, c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from math import sqrt, pi | |
# Program examples | |
def double(some_number): | |
return 2 * some_number | |
def dbl(n): | |
return 2*n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
import webbrowser | |
due = 'due://x-callback-url/add?title=%s&hourslater=4&x-success=pythonista://&x-error=pythonista://&x-source=Pythonista' | |
webbrowser.open(due % 'a') | |
print 'a' | |
webbrowser.open(due % 'b') | |
print 'b' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
import webbrowser | |
due = 'due://x-callback-url/add?title=%s&hourslater=4&x-success=pythonista://&x-error=pythonista://&x-source=Pythonista' | |
webbrowser.open(due % 'a') | |
print 'a' | |
webbrowser.open(due % 'b') | |
print 'b' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
import appex, dialogs, scene | |
import plistlib, copy, webbrowser, urllib, time | |
# check out http://handleopenurl.com/ | |
db = 'Tasks.txt' | |
url = 'omnifocus://task/%s' | |
due = 'due://x-callback-url/add?title=%s&hourslater=4&x-success=pythonista://&x-error=pythonista://&x-source=Pythonista' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
import appex, dialogs, scene | |
import plistlib, copy, webbrowser, urllib, time | |
# check out http://handleopenurl.com/ | |
db = 'Tasks.txt' | |
url = 'omnifocus://task/%s' | |
due = 'due://x-callback-url/add?title=%s&hourslater=4&x-success=pythonista://&x-error=pythonista://&x-source=Pythonista' |
OlderNewer