Skip to content

Instantly share code, notes, and snippets.

View nsantorello's full-sized avatar

Noah Santorello nsantorello

View GitHub Profile
@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
@nsantorello
nsantorello / DeleteTables.sql
Created February 8, 2017 22:15
Creating Seed Data with Mockeroo
delete from MyTable;
@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 / 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 / ContentfulLinkConverter.cs
Created December 15, 2014 18:12
JsonConverter for easily deserializing Contentful API responses with JSON.NET
using System;
using Newtonsoft.Json;
using System.Collections.Generic;
using Newtonsoft.Json.Linq;
using System.Text;
namespace Grounded
{
public class ContentfulLinkConverter : JsonConverter
{
@nsantorello
nsantorello / Instructions.md
Created October 22, 2013 16:22
OpenCV stream from raspberry pi
  1. Build display.cpp
  2. Set up pipe on Linux VM
  3. Run display application
  4. Run proxy/passthrough on Mac
  5. Start streaming from Raspberry Pi
@nsantorello
nsantorello / setup.sh
Last active December 24, 2015 17:19
Ubuntu setup
sudo apt-get install git curl
# install zsh and mods
cd ~
sudo apt-get install git-core highlight zsh perl
git clone git://github.com/miohtama/ztanesh.git ~/tools
~/tools/zsh-scripts/setup.zsh
zsh
chsh -s /bin/zsh $USER
@nsantorello
nsantorello / FrameParsingTests.java
Created October 2, 2013 17:00
How to test new COMMAND_CLASS_FIRMWARE_UPDATE_MD XML.
// Add this to FrameParsingTests.java
@Test
public void testPeterAddition() {
CommandData data;
VariantComponentData comp;
ArrayList<Byte> byteQueue = new ArrayList<Byte>();
byteQueue.addAll(Arrays.asList(new Byte[] { 0x01, 0x14, 0x00, 0x04, 0x00, 0x02, 0x0E, (byte)0x7A, 0x02, 0x01, 0x13, (byte)0x03, (byte)0x43, 0x00, 0x00, (byte)0xFF, 0x01, 0x00, 0x2C, 0x01, 0x00, 0x1A }));
ReceivedFrame frame = Frame.parseFrame(byteQueue);
@nsantorello
nsantorello / README.md
Last active December 23, 2015 18:09 — forked from mbostock/.block
Removed all dark blues except for one

Bubble charts encode data in the area of circles. Although less perceptually-accurate than bar charts, they can pack hundreds of values into a small space. Implementation based on work by Jeff Heer. Data shows the Flare class hierarchy, also courtesy Jeff Heer.

@nsantorello
nsantorello / modal_dialog.html
Last active December 15, 2015 14:38
A light-weight modal dialog for web pages
<html>
<head>
<style type="text/css">
.lightbox-container {
display:none;
}
#lightbox {
display:none;
background: #333333;