Skip to content

Instantly share code, notes, and snippets.

View johnwheeler's full-sized avatar
🏠
Working from home

John Wheeler johnwheeler

🏠
Working from home
  • San Diego, California
View GitHub Profile
@johnwheeler
johnwheeler / logstash_formatter.py
Last active July 11, 2017 11:52
Python Logstash Formatter compatible with json codec format
import logging
import json
class LogstashFormatter(logging.Formatter):
def __init__(self, fmt=None, datefmt='%Y-%m-%dT%H:%M:%SZ'):
super(LogstashFormatter, self).__init__(fmt, datefmt)
def format(self, record):
obj = record.__dict__.copy()
{
"color_scheme": "Packages/Theme - Spacegray/base16-ocean.light.tmTheme",
"detect_indentation": false,
"folder_exclude_patterns":
[
".webassets-cache",
".git",
"out"
],
"font_size": 14,
var SRC_JS = 'client/js/**/*.js';
var SRC_LESS = 'client/less/**/styles.less';
var SRC_HTML = '*.html';
var DEST_STYLES = 'static/styles/';
var DEST_SCRIPTS = 'static/scripts/';
var PROXY = 'localhost:8000';
var gulp = require('gulp');
var gutil = require('gulp-util');
var jshint = require('gulp-jshint');
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "debian/jessie64"
config.vm.network "private_network", ip: "192.168.0.100"
config.vm.provider "virtualbox" do |vb|
vb.memory = "8192"
end
@johnwheeler
johnwheeler / distance to point
Created December 28, 2015 17:37
distance to point
func distanceToPoint(point p: CGPoint, fromLineSegmentBetween l1: CGPoint, and l2: CGPoint) -> Float {
let a = p.x - l1.x
let b = p.y - l1.y
let c = l2.x - l1.x
let d = l2.y - l1.y
let dot = a * c + b * d
let lenSq = c * c + d * d
let param = dot / lenSq

Flask-Ask Live Presentation Over the Web

The creator of Flask-Ask will show your group of 3 or more how easy it is to program the Amazon Echo with Python!

You ask 'Alexa' to play songs, get the weather, and report scores. Those 'skills', as they're called, have an open API for building conversational apps. That API is the Alexa Skills Kit, and Flask-Ask is a Python framework that makes working with it easy.

Developing with Flask-Ask is fun. It's a novel experience to write and test conversational code,

import os
import base64
import posixpath
from datetime import datetime
from six.moves.urllib.parse import urlparse
from six.moves.urllib.request import urlopen
from . import logger
import os
import yaml
import inspect
from functools import wraps, partial
from xml.etree import ElementTree
import aniso8601
from werkzeug.local import LocalProxy
from jinja2 import BaseLoader, ChoiceLoader, TemplateNotFound
from flask import current_app, json, request as flask_request, _app_ctx_stack
CFLAGS="-I/usr/local/opt/openssl/include" LDFLAGS="-L/usr/local/opt/openssl/lib" UWSGI_PROFILE_OVERRIDE=ssl=true pip install uwsgi -Iv
@johnwheeler
johnwheeler / memory_game.py
Created August 24, 2016 22:38
memory_game.py
import logging
from random import randint
from flask import Flask, render_template
from flask_ask import Ask, statement, question, session
app = Flask(__name__)
ask = Ask(app, "/")
logging.getLogger("flask_ask").setLevel(logging.DEBUG)