Skip to content

Instantly share code, notes, and snippets.

View nsantorello's full-sized avatar

Noah Santorello nsantorello

View GitHub Profile
@nsantorello
nsantorello / airports.nb
Last active August 29, 2015 14:16
Draws of the map of shortest tour of all public-use airports in an area with runway lengths >= X ft
(*Get all airports in an area*)GetAirports[area_]:=GeoEntities[area,"Airport"]
(*Filter to only public-use airports with at least 1 runway longer than a specified length*)
FilterPublicAirportsAndRunwayLength[airports_,rwyLen_: 3000]:=Module[{rwy},rwy=Quantity[rwyLen,"Feet"];
First[Transpose[Select[Transpose[{airports,EntityValue[airports,"LongestRunwayLength"],EntityValue[airports,"Uses"]}],#[[2]]>=rwy \[And] #[[3]][[1]]=="Public"&]]]]
(*Get the shortest tour of all the airports*)
AirportShortestTour[airports_]:= Module[{shortest},
shortest = FindShortestTour[EntityValue[airports,"Position"]];
{First[shortest], airports[[Last[shortest]]]}]
@nsantorello
nsantorello / webflow-dynamic-list.py
Created April 23, 2016 13:34
Embed dynamic lists from a published Webflow site into your downloaded code
import sys
import os
import urllib
import glob
import re
import urlparse
from shutil import copyfile
from lxml import html
from lxml import etree
@nsantorello
nsantorello / DeleteTables.sql
Created February 8, 2017 22:15
Creating Seed Data with Mockeroo
delete from MyTable;
@nsantorello
nsantorello / app.js
Created March 16, 2017 19:57
Service-to-Service Authentication with Cloud Endpoints
// Step 1: Generate the request token
var jwt = require('jsonwebtoken');
var key = require('./key'); // path to service account JSON file
var SERVICE_ID = '...'; // this is the 'host' proprety of the service management's openapi.yaml
var now = Math.floor(Date.now() / 1000);
var payload = {
iat: now, // issued right now
exp: now + 3600, // expire after 1 hour