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
#/bin/env python | |
#-*- coding:utf-8 -*- | |
from bottle import * | |
@get('/t2p') | |
def text_form(): | |
return ''' | |
<form method="POST"> | |
<input type="text" name="text" /> | |
<input type="submit" name="Submit" /> | |
</form> |
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 bottle import * | |
import sae.storage as sst | |
from StringIO import StringIO | |
import sae | |
app = Bottle() | |
debug(True) | |
@app.get('/t2p') | |
def text_form(): | |
return ''' | |
<form method="POST"> |
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
p>编辑 ID 为 {{no}} 的任务</p> | |
<form action="/edit/{{no}}" method="GET"> | |
<input type="text" name="task" value="{{old[0]}}" size="100" maxlength="100" /> | |
<select name="status"> | |
<option value="1">开启</option> | |
<option value="0">关闭</option> | |
</select> | |
<br /> | |
<input type="submit" name="save" value="save" /> | |
</form> |
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 | |
import web | |
import simplejson as sj | |
def FomationCheck(): | |
db=web.database(dbn='mysql', host='',db='shdb1', user='', pw='') | |
jsons = list(db.query("SELECT json FROM Formation")) | |
for json in jsons: | |
jsonData=json.json.encode('utf-8') | |
jsonVar=sj.loads(jsonData) | |
playerId=jsonVar['playerId'] |
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
# -*- coding: UTF-8 -*- | |
"""Easy to use object-oriented thread pool framework. | |
A thread pool is an object that maintains a pool of worker threads to perform | |
time consuming operations in parallel. It assigns jobs to the threads | |
by putting them in a work request queue, where they are picked up by the | |
next available thread. This then performs the requested operation in the | |
background and puts the results in another queue. |
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 paramiko as ssh | |
port=22 | |
username='xxx' | |
passwd='xxx' | |
def SshCmd(cmd): | |
s=ssh.SSHClient() | |
s.set_missing_host_key_policy(ssh.AutoAddPolicy()) | |
s.connect(host,port,username,passwd) | |
stdin,stdout,stderror =s.exec_command(cmd) | |
print stdout.read() |
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.orm.attributes import InstrumentedAttribute | |
from sqlalchemy.orm import subqueryload | |
from sqlalchemy.sql.expression import desc | |
from sqlalchemy import or_ | |
from wtforms.ext.sqlalchemy.orm import model_form | |
from flask import flash | |
from flask.ext.admin.babel import gettext | |
from flask.ext.admin.form import BaseForm |
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 bash | |
#dbbake.sh | |
#author:syshack | |
#date:2011.9.10 | |
#数据库 | |
DBName=mysql | |
#用户名 | |
DBUser=root | |
#数据库密码 | |
DBPasswd= |
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 | |
'''logfomat:2012-07-19 13:50:39,playerId:68719476740,operFlow:1,operType:0,indentify:ws:shanbiP110,sampleId:ws:shanbiP1,Level:1,Exp: | |
0,Num:1''' | |
import re | |
import time | |
Time="2012-07-31 12:43:40" | |
time_str=time.mktime(time.strptime(Time,"%Y-%m-%d %H:%M:%S")) | |
def grep(file,exp): | |
fd=open(file,'r') |
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 | |
'''logfomat:2012-07-19 13:50:39,playerId:68719476740,operFlow:1,operType:0,indentify:ws:shanbiP110,sampleId:ws:shanbiP1,Level:1,Exp: | |
0,Num:1''' | |
import re | |
import time | |
Time="2012-07-31 12:43:40" | |
time_str=time.mktime(time.strptime(Time,"%Y-%m-%d %H:%M:%S")) | |
def grep(file,exp): | |
fd=open(file,'r') |