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 flask import Flask, request, url_for | |
from flask.ext.sqlalchemy import SQLAlchemy | |
from flask.ext.admin.contrib import sqlamodel | |
from flask.ext import admin | |
# Create application | |
app = Flask(__name__) | |
# Create dummy secrey key so we can use sessions |
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 tornado.websocket | |
import tornado.ioloop | |
line = 0 #the current message to be send | |
listeners = [] #for holding the connecting | |
class WebSocketHandler(tornado.websocket.WebSocketHandler): | |
def open(self): | |
listeners.append(self)#add to list of connections | |
def on_close(self): |
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 tornado import stack_context as old, new_stack as new | |
def exc(type, value, tb): | |
return True | |
def non_exc(type, value, tv): | |
pass |
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 flask import Flask | |
from flask.ext.sqlalchemy import SQLAlchemy | |
from flask.ext import admin, wtf | |
from flask.ext.admin.contrib import sqlamodel | |
app = Flask(__name__) | |
app.config['SECRET_KEY'] = '123456790' | |
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///test.sqlite' | |
db = SQLAlchemy(app) |
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
{% extends 'admin/master.html' %} | |
{% import 'admin/lib.html' as lib with context %} | |
{% block body %} | |
{% call lib.form_tag() %} | |
{{ lib.render_form_fields(form) }} | |
<input type="submit" /> | |
{% endcall %} | |
{% endblock %} |
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 random | |
import datetime | |
import hashlib | |
import json | |
from sqlalchemy import * | |
from sqlalchemy.orm import * | |
from sqlalchemy.ext.declarative import declarative_base | |
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 flask import Flask | |
from flask.ext.sqlalchemy import SQLAlchemy | |
from flask.ext import admin | |
from flask.ext.admin.contrib import sqlamodel | |
# Create application | |
app = Flask(__name__) |
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 tornado import gen, httpclient, ioloop, stack_context | |
io_loop = ioloop.IOLoop.instance() | |
client = httpclient.AsyncHTTPClient(io_loop=io_loop) | |
@gen.engine | |
def go_for_it(): | |
c = 0 | |
while True: |
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
python sistats.py scan | |
python sistats.py makehtml -e любов -m 100 -a 7.5 > output.html |
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 flask import Flask, render_template | |
from flask.ext.sqlalchemy import SQLAlchemy | |
from flask.ext import wtf | |
from flask.ext.admin import Admin | |
from flask.ext.admin.contrib import sqlamodel | |
from flask.ext.admin.model.form import InlineFormAdmin | |
from sqlalchemy.ext.hybrid import hybrid_property | |
app = Flask(__name__) |