Data URI manipulation made easy.
This isn't very robust, and will reject a number of valid data URIs. However, it meets the most useful case: a mimetype, a charset, and the base64 flag.
node_modules |
{ | |
"folders": | |
[ | |
{ | |
"path": "django_project_dir" | |
}, | |
{ | |
"path": "lib/python2.7" | |
} | |
], |
# Setup Plone for invokeFactory ... there must be a better way | |
from zope.component.hooks import setSite | |
setSite(plone) | |
from sys import stdin, stdout | |
from ZPublisher.HTTPRequest import HTTPRequest | |
from ZPublisher.HTTPResponse import HTTPResponse | |
from ZPublisher.BaseRequest import RequestContainer |
import sublime, sublime_plugin | |
BLOCKLEN = 4 | |
class TypeFileOutCommand(sublime_plugin.TextCommand): | |
def nextchar(self): | |
if self.body: | |
totype = [] | |
while 1: | |
try: |
# Disable selinux as it interferes with functionality of LXC | |
$ setenforce 0 | |
$ echo 'SELINUX=disabled' > /etc/selinux/config | |
# Download and setup Fedora EPEL Repository | |
$ yum -y install http://ftp.riken.jp/Linux/fedora/epel/6/i386/epel-release-6-8.noarch.rpm | |
# Setup hop5.in repository | |
$ wget http://www.hop5.in/yum/el6/hop5.repo -O /etc/yum.repos.d/hop5.repo |
I should preface this by saying that I got a Withings Smart Body Analyzer for Christmas last year and I’ve been generally happy with it. It purports to be able to take my heart rate through my bare feet and that seems not to work for my physiology, but overall I’m a fan. If if their Wikipedia page is to be believed they are having a pretty rad impact on making the Quantified Self movement more for normal people and they only have 20 full time employees. Also they try hard to use SI units, which I can get behind. Anyway, on to the rant.
I originally called this post “Everything wrong with the Withings API” and I meant it. For every useful field I can extract from their “award winning” app, I have spent an hour screaming at the inconsistencies in their implementation or inexplicable holes in their data
# Want to run your Flask tests with CSRF protections turned on, to make sure | |
# that CSRF works properly in production as well? Here's an excellent way | |
# to do it! | |
# First some imports. I'm assuming you're using Flask-WTF for CSRF protection. | |
import flask | |
from flask.testing import FlaskClient as BaseFlaskClient | |
from flask_wtf.csrf import generate_csrf | |
# Flask's assumptions about an incoming request don't quite match up with |
from bottle import (post, request, response, route, run, ) | |
from twilio import twiml | |
@route('/') | |
def check_app(): | |
# returns a simple string stating the app is working | |
return "It works!" | |