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
#!/usr/bin/env python | |
#coding=utf-8 | |
# Author: CC | |
# Created Time: Tue 07 Jan 2014 07:30:55 PM CST | |
#此脚本支持生成5位以上62以下的密码 | |
import string | |
import random | |
from optparse import OptionParser |
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
应该是mysql 默认编码问题。可以换 sqlite3 数据库,或者改下 /etc/mysql/my.cnf 配置文件,在 [client] 和 [mysqld] 下加如下项: | |
[client] | |
default-character-set=utf8 | |
[mysqld] | |
default-character-set=utf8 | |
default-collation=utf8_general_ci | |
character-set-server=utf8 | |
collation-server=utf8_general_ci |
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
function containSpecial(str){ | |
var specailStr = RegExp(/[(\ )(\~)(\!)(\@)(\#) (\$)(\%)(\^)(\&)(\*)(\()(\))(\-)(\_)(\+)(\=) (\[)(\])(\{)(\})(\|)(\\)(\;)(\:)(\')(\")(\,)(\.)(\/) (\<)(\>)(\?)(\)]+/); | |
return (specailStr.test(str)); | |
}; |
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
function unique(arr) { | |
var ret = []; | |
var hash = {}; | |
for (var i = 0; i < arr.length; i++) { | |
var item = arr[i]; | |
var key = typeof(item) + item | |
if (hash[key] !== 1) { | |
ret.push(item); | |
hash[key] = 1; | |
}; |
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
django 数据库查询 | |
2010-10-22 20:47:40 | |
class Poll(models.Model): | |
slug = models.SlugField(unique_for_month='pub_date') | |
question = models.CharField(maxlength=255) | |
pub_date = models.DateTimeField() | |
expire_date = models.DateTimeField() | |
def __repr__(self): | |
return self.question |
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
{% load i18n %} | |
{% load apps_filter %} | |
{% if paged_objects.has_other_pages %} | |
<div class="row-fluid"> | |
<div class="pull-right"> | |
<div class="pagination ks-pagination {{ position_css }}"> | |
<ul> | |
{% if paged_objects.has_previous %} | |
<li><a href="?page={{ paged_objects.previous_page_number }}{% if params_str %}{{ params_str }}{% endif %}">{% trans '上一页' %}</a> |
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
项目目录: | |
/var/www/knownsec | |
knownsec下会自动生成uwsgi.py(前提用apt-get安装nginx以及uwsgi) | |
nginx配置 | |
/etc/nginx/sites-enabled/ks | |
1 server { | |
2 |
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
过滤器,变量的显示形式的改变 | |
一、形式:小写 | |
{{ name | lower }} | |
二、串联:先转义文本到HTML,再转换每行到 <p> 标签 |
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
mylist = [2,2,2,2,2,2,3,3,3,3] | |
mylist.sort() | |
myset = set(mylist) | |
for item in myset: | |
print mylist.count(item), " of ", item, " in list" |
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
text-align:center; | |
width:90%\9; /* 兼容IE浏览器 */ | |
margin:0 auto; /* 兼容Firefox , Opera */ | |
font-size:20px; | |
color:#4e4a4c; | |
font-weight:bold; |