Docker搭建开发环境
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/python | |
# -*- coding: utf-8 -*- | |
from flask import request, url_for | |
from flask.ext.api import FlaskAPI, status, exceptions | |
app = FlaskAPI(__name__) | |
notes = { |
jinja渲染模版时,参数中的非ASCII内容必须是unicode类型
所以以下写法均会抛出UnicodeDecodeError
template.render(name="校长")
template.render(re={"name": "校长"})
- jinja模版中,字符串字面量如
{{ }}
,local变量等中显示给出字符串数据可以是str或unicode,即{{ "校长" }}
和{{ u"校长" }}
都是正确的,{% set a, b = '校长', u'校长' %}
- 传给jinja模版中的python变量中的字符串数据必须是unicode,这些变量包括global变量、context变量和filters函数返回的值
- SQL注入
- XSS:Cross Site Script,跨站脚本攻击。原本可缩写成CSS,但为了和网页设计中的CSS区分
- CSRF:Cross Site Request Fake,跨站点请求伪造
https://www.keakon.net/2012/12/03/Tornado%E4%BD%BF%E7%94%A8%E7%BB%8F%E9%AA%8C
command
cat access_log |cut -d " " -f4|sort |uniq -c |sort -n -r
PS: cut -d " " -f4
equals to awk -F " " '{print $4}'
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 bash | |
SESSION="vs@`pwd |rev |cut -f1 -d/ |rev| cut -f2 -d.`#`pwd |md5sum |cut -c1-7`" | |
tmux attach -d -t $SESSION || tmux new -s $SESSION |
https://docs.rongcloud.cn/im/server/signature/#_2
curl -X POST -H "App-Key: uwd1c0sxdlx2" -H "Nonce: 14314" -H "Timestamp: 1408710653000" -H "Signature: `echo -n Y1W2MeFwwwRxa0143141408710653000|sha1sum |awk '{printf $1}'`" -d 'userId=jlk456j5&name=Ironman&portraitUri=http%3A%2F%2Fabc.com%2Fmyportrait.jpg' "https://api-cn.ronghub.com/user/getToken.json"
curl -X POST -H "App-Key: 0vnjpoad0i1uz" -H "Nonce: $(date '+%s'|tail -c 6)" -H "Timestamp: $(date '+%s')" -H "Signature: `echo -n FZ****Pwbs$(date '+%s'|tail -c 6)$(date '+%s')|sha1sum |awk '{printf $1}'`" -d 'userId=jlk456j5&name=Ironman&portraitUri=http%3A%2F%2Fabc.com%2Fmyportrait.jpg' "https://api-cn.ronghub.com/user/getToken.json"
{"code":200,"userId":"jlk456j5","token":"Vk9O2dRLPlRYXDOv4zGBEXcjTUnCGVETk65A/2iMccLZF2uk0LUN6TJLNRHJ1NzsLVRliU5BLcgGWb3oTd3OXQ=="}
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 bash | |
result='\n' | |
for m in $(docker-machine ls -f '{{.Name}}') | |
do | |
result=$result"Host docker-machine-$(docker-machine inspect -f '{{.Driver.MachineName}}' $m)"'\n' | |
result=$result" HostName $(docker-machine inspect -f '{{.Driver.IPAddress}}' $m)"'\n' | |
result=$result" User $(docker-machine inspect -f '{{.Driver.SSHUser}}' $m)"'\n' | |
result=$result" IdentityFile $(docker-machine inspect -f '{{.Driver.SSHKeyPath}}' $m)"'\n' |
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
GOOGLE_AUTH_PAGE=https://accounts.google.com/o/oauth2/auth | |
# GOOGLE_AUTH_PAGE_V2=https://accounts.google.com/o/oauth2/v2/auth | |
GOOGLE_TOKEN_API=https://oauth2.googleapis.com/token | |
GOOGLE_TOKEN_INFO_API=https://oauth2.googleapis.com/tokeninfo | |
# GOOGLE_TOKEN_INFO_API_V3=https://www.googleapis.com/oauth2/v3/tokeninfo | |
GOOGLE_REVOKE_API=https://oauth2.googleapis.com/revoke | |
GOOGLE_USERINFO_API_V3=https://www.googleapis.com/oauth2/v3/userinfo | |
GOOGLE_USER_PROFILE_API=https://www.googleapis.com/auth/userinfo.profile |
OlderNewer