This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from six.moves import urllib | |
def config(uri): | |
parsed = urllib.parse.urlparse(uri) | |
options = dict(urllib.parse.parse_qsl(parsed.query)) | |
cache_type = parsed.scheme.lower() | |
if cache_type not in ['null', 'simple', 'file', 'memcached', 'saslmemcached', 'redis']: | |
raise Exception('Misconfiguration') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// "use strict"; | |
// var minimatch = require('minimatch'); | |
// var replaceall = require('replaceall'); | |
// | |
// | |
// function Authorizer(acl) { | |
// this.acl = acl || []; | |
// } | |
// module.exports = Authorizer; | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
option_settings: | |
- namespace: aws:elb:listener:443 | |
option_name: ListenerProtocol | |
value: HTTPS | |
- namespace: aws:elb:listener:443 | |
option_name: SSLCertificateId | |
value: YOUR-ARN-HERE | |
- namespace: aws:elb:listener:443 | |
option_name: InstancePort | |
value: 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
option_settings: | |
- namespace: aws:elb:listener:443 | |
option_name: ListenerProtocol | |
value: HTTPS | |
- namespace: aws:elb:listener:443 | |
option_name: SSLCertificateId | |
value: YOUR-ARN-HERE | |
- namespace: aws:elb:listener:443 | |
option_name: InstancePort | |
value: 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import paho.mqtt.client as mqtt | |
client = mqtt.Client(protocol=mqtt.MQTTv311) | |
client.connect('iot.eclipse.org', port=1883, keepalive=60) | |
client.publish('update', 'hello world') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from __future__ import absolute_import, division, print_function, unicode_literals | |
from flask import after_this_request | |
import decorator | |
def vary(*headers): | |
def _vary(f, *args, **kwargs): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# REF: http://stackoverflow.com/a/19637175/1198679 | |
from flask.globals import _app_ctx_stack, _request_ctx_stack | |
from werkzeug.urls import url_parse | |
def route_from(url, method = None): | |
appctx = _app_ctx_stack.top | |
reqctx = _request_ctx_stack.top | |
if appctx is None: | |
raise RuntimeError('Attempted to match a URL without the ' | |
'application context being pushed. This has to be ' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from __future__ import absolute_import, division, print_function | |
from urllib import quote, unquote | |
from twisted.web import static | |
from twisted.web.static import getTypeAndEncoding, formatFileSize | |
from twisted.python import filepath | |
from twisted.python.compat import escape |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
Usage: twistd -ny vhost.py | |
""" | |
from __future__ import absolute_import, division, unicode_literals, print_function | |
import os | |
from twisted.application import internet, service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const https = require('https'); | |
const url = require('url'); | |
// to get the slack hook url, go into slack admin and create a new "Incoming Webhook" integration | |
const slack_url = 'https://hooks.slack.com/services/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'; | |
const slack_req_opts = url.parse(slack_url); | |
slack_req_opts.method = 'POST'; | |
slack_req_opts.headers = {'Content-Type': 'application/json'}; | |
exports.handler = function(event, context) { | |
(event.Records || []).forEach(function (rec) { |