Skip to content

Instantly share code, notes, and snippets.

View futureshape's full-sized avatar

Alexander Baxevanis futureshape

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# -*- coding: utf-8 -*-
import random
import logging
import requests
import re
from ask_sdk.standard import StandardSkillBuilder
from ask_sdk_core.utils import is_request_type, is_intent_name
from ask_sdk_core.handler_input import HandlerInput
def cleanup_airplane_model(raw_model):
if "707" in raw_model:
return "Boeing <sub alias='Seven Oh Seven'>707</sub>"
elif "717" in raw_model:
return "Boeing <sub alias='Seven One Seven'>717</sub>"
elif "727" in raw_model:
return "Boeing <sub alias='Seven Two Seven'>727</sub>"
elif "737" in raw_model:
return "Boeing <sub alias='Seven Three Seven'>737</sub>"
elif "747" in raw_model:
@futureshape
futureshape / gist:795e04bdf18942cd882d
Created May 12, 2015 19:35
TfL Cycle Hire App sample request
HTTP/1.1 200 OK
Content-Encoding: deflate
Content-Type: application/json
Server: Corethree Core Engine
Content-Length: 2898
Connection: keep-alive
{
"Type": "Node",
"ID": "DKIeiyWaCle",
@futureshape
futureshape / TwitPDFGenerator.py
Created February 5, 2013 18:51
Download a list of tweets from Twitter and format them into a PDF for printing - each page shows the full tweet text, screen name and profile image. Python dependencies: * Twitter (http://pypi.python.org/pypi/twitter) * fpdf (http://pypi.python.org/pypi/fpdf/1.7)
from twitter import *
from fpdf import FPDF
import urllib
pdf=FPDF('L', 'mm', 'A4')
pdf.add_font('DejaVu','','DejaVuSans.ttf',uni=True)
t = Twitter(
auth=OAuth("xxx",
"xxx",
"xxx",
@futureshape
futureshape / gist:1328159
Created October 31, 2011 17:54
Ethercard getNtpTime
unsigned long getNtpTime() {
unsigned long timeFromNTP;
const unsigned long seventy_years = 2208988800UL;
ether.ntpRequest(ntpServer, ntpMyPort);
Serial.println("NTP request sent");
while(true) {
word length = ether.packetReceive();
ether.packetLoop(length);
if(length > 0 && ether.ntpProcessAnswer(&timeFromNTP,ntpMyPort)) {