Skip to content

Instantly share code, notes, and snippets.

View jkulesza's full-sized avatar

Joel A. Kulesza jkulesza

View GitHub Profile
% Load Packages %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{listings}
\usepackage{xcolor}
% Set Code Listing Style %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\definecolor{codebackground}{rgb}{1,1,1}
\definecolor{codeframe}{rgb}{0,0,0}
\definecolor{codecomment}{rgb}{0,0.6,0}
@jkulesza
jkulesza / chan.py
Created October 11, 2016 20:01 — forked from tixxit/chan.py
# Chan's Convex Hull O(n log h) - Tom Switzer <thomas.switzer@gmail.com>
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:
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
@jkulesza
jkulesza / toggle-grayscale
Last active August 29, 2015 14:27 — forked from wbolster/toggle-grayscale
AppleScript to toggle grayscale display (for Mac OSX 10.10 Yosemite)
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