This file contains hidden or 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 StringIO | |
import struct | |
def getImageInfo(data): | |
data = str(data) | |
size = len(data) | |
height = -1 | |
width = -1 | |
content_type = '' |
This file contains hidden or 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 google.appengine.ext import db | |
from flask import flash, url_for, redirect, request | |
from flask.views import View | |
from flaskext.wtf import Form | |
from wtforms.ext.appengine.db import model_form | |
from application.decorators import templated |
This file contains hidden or 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
#!/usr/bin/env python | |
""" | |
A simple echo server | |
""" | |
import socket | |
host = '' | |
port = 50000 |
This file contains hidden or 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
@ECHO OFF | |
set DNS_IP= | |
set /P DNS_IP=DNS server ip address: %=% | |
echo Setting DNS server... | |
netsh interface ip set dns "Local Area Connection 9" static %DNS_IP% |
This file contains hidden or 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head><script type="text/javascript">var NREUMQ=NREUMQ||[];NREUMQ.push(["mark","firstbyte",new Date().getTime()]);</script> | |
<link href='/static/bootstrap/css/bootstrap.css' rel='stylesheet' type='text/css' /> | |
<link href='/static/wysihtml5/bootstrap-wysihtml5.css' rel='stylesheet' type='text/css' /> | |
</head> | |
<body> | |
... | |
<script src="/static/wysihtml5/wysihtml5-0.3.0.min.js"></script> |
This file contains hidden or 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 flask_sqlalchemy import SQLAlchemy | |
from flask_script import Manager, prompt_bool | |
import application.models | |
db = SQLAlchemy() | |
manager = Manager("Perform database operations") | |
@manager.command | |
def drop(): |
This file contains hidden or 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 sqlalchemy import create_engine | |
engine = create_engine('mysql+gaerdbms:///myapp', | |
connect_args={"instance":"instancename"}) | |
connection = engine.connect() |
This file contains hidden or 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
... | |
def configure_security(app): | |
# Flask-Security / Flask-Social / Flask-Login / Flask-Principal | |
from flask_security import Security | |
from flask_security.datastore import SQLAlchemyUserDatastore | |
from flask_social import Social | |
from flask_social.datastore import SQLAlchemyConnectionDatastore | |
Security(app, SQLAlchemyUserDatastore(db, models.User, models.Role)) | |
Social(app, SQLAlchemyConnectionDatastore(db, models.Connection)) |
This file contains hidden or 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 flask import Flask, request, flash, url_for, redirect, render_template | |
from flask.ext.sqlalchemy import SQLAlchemy | |
app = Flask(__name__) | |
app.config.from_pyfile('application.cfg') | |
db = SQLAlchemy(app) | |
from models import Todo |
This file contains hidden or 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
$("[data-provide='select2']").each(function () { | |
var $element = $(this); | |
$element.select2({ | |
placeholder: $element.data("placeholder"), | |
minimumInputLength: 0, | |
allowClear: true, | |
initSelection: function (element, callback) { | |
callback({ | |
id: $(element).val(), |
OlderNewer