Skip to content

Instantly share code, notes, and snippets.

Departing

Who Who Where What What
Clearance Skyhawk 413ES Atlantic with India VFR to Lockhart, 3,500 feet
Ground Skyhawk 413ES Spot 1 N/A Ready to taxi
Tower Skyhawk 413ES Holding short runway 1-7 Left at Foxtrot N/A Ready for departure
Departure Skyhawk 413ES Passing 1,300, climbing 3,500 N/A N/A

Arriving

@troyswanson
troyswanson / main.py
Created April 25, 2019 03:40
Facebook Photo Downloader
import requests
import urllib
def get_photos(access_token, url='https://graph.facebook.com/v2.10/me/photos?fields=images,from'):
r = requests.get(url, headers={'Authorization': 'Bearer %s' % (access_token)})
payload = r.json()
data = payload['data']
for photo in data:
print '>>> %s' % (photo['from'])
@troyswanson
troyswanson / ortools-tsp.py
Created June 5, 2019 21:07
TSP solver with Google's or-tools
from ortools.constraint_solver import routing_enums_pb2
from ortools.constraint_solver import pywrapcp
cost_matrix = [
[0, 10938, 4542, 2835, 29441, 2171, 1611, 9208, 9528, 11111, 16120, 22606, 22127, 20627, 21246, 23387, 16697, 33609, 26184, 24772, 22644, 20655, 30492, 23296, 32979, 18141, 19248, 17129, 17192, 15645, 12658, 11210, 12094, 13175, 18162, 4968, 12308, 10084, 13026, 15056],
[10938, 0, 6422, 9742, 18988, 12974, 11216, 19715, 19004, 18271, 25070, 31971, 31632, 30571, 31578, 33841, 27315, 43964, 36944, 35689, 33569, 31481, 41360, 33760, 43631, 28730, 29976, 27803, 28076, 26408, 23504, 22025, 22000, 13197, 14936, 15146, 23246, 20956, 23963, 25994],
[4542, 6422, 0, 3644, 25173, 6552, 5092, 13584, 13372, 13766, 19805, 26537, 26117, 24804, 25590, 27784, 21148, 37981, 30693, 29315, 27148, 25071, 34943, 27472, 37281, 22389, 23592, 21433, 21655, 20011, 17087, 15612, 15872, 11653, 15666, 8842, 16843, 14618, 17563, 19589],
[2835, 9742, 3644, 0, 28681, 3851, 4341, 11660, 12294, 13912, 18893,
@troyswanson
troyswanson / list_names.csv
Created June 5, 2019 22:26
NYT Best Sellers
list_name_encoded display_name list_name newest_published_date oldest_published_date updated
combined-print-and-e-book-fiction Combined Print & E-Book Fiction Combined Print and E-Book Fiction 2019-06-09 2011-02-13 WEEKLY
combined-print-and-e-book-nonfiction Combined Print & E-Book Nonfiction Combined Print and E-Book Nonfiction 2019-06-09 2011-02-13 WEEKLY
hardcover-fiction Hardcover Fiction Hardcover Fiction 2019-06-09 2008-06-08 WEEKLY
hardcover-nonfiction Hardcover Nonfiction Hardcover Nonfiction 2019-06-09 2008-06-08 WEEKLY
trade-fiction-paperback Paperback Trade Fiction Trade Fiction Paperback 2019-06-09 2008-06-08 WEEKLY
mass-market-paperback Paperback Mass-Market Fiction Mass Market Paperback 2017-01-29 2008-06-08 WEEKLY
paperback-nonfiction Paperback Nonfiction Paperback Nonfiction 2019-06-09 2008-06-08 WEEKLY
e-book-fiction E-Book Fiction E-Book Fiction 2017-01-29 2011-02-13 WEEKLY
e-book-nonfiction E-Book Nonfiction E-Book Nonfiction 2017-01-29 2011-02-13 WEEKLY
@troyswanson
troyswanson / geometry.py
Created November 2, 2022 20:43
Geometry Utility Functions
import math
from shapely.geometry import Point, LineString, Polygon, MultiPolygon
def create_rectangle(x, y, width, depth, angle):
width_theta = math.radians(angle)
width_x = width * math.cos(width_theta)
width_y = width * math.sin(width_theta)