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
# Chan's Convex Hull O(n log h) - Tom Switzer <[email protected]> | |
TURN_LEFT, TURN_RIGHT, TURN_NONE = (1, -1, 0) | |
def turn(p, q, r): | |
"""Returns -1, 0, 1 if p,q,r forms a right, straight, or left turn.""" | |
return cmp((q[0] - p[0])*(r[1] - p[1]) - (r[0] - p[0])*(q[1] - p[1]), 0) | |
def _keep_left(hull, r): | |
while len(hull) > 1 and turn(hull[-2], hull[-1], r) != TURN_LEFT: |
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
tell application "System Preferences" | |
activate | |
set current pane to pane "Accessibility" | |
end tell | |
tell application "System Events" | |
tell process "System Preferences" | |
click checkbox "Use grayscale" of window 1 | |
end tell | |
end tell |