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
/************************************** | |
* Header Counters in TOC | |
**************************************/ | |
/* No link underlines in TOC */ | |
.md-toc-inner { | |
text-decoration: none; | |
} | |
.md-toc-content { |
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
try: | |
import simplejson as json | |
except ImportError: | |
try: | |
import json | |
except ImportError: | |
raise ImportError | |
import datetime | |
from bson.objectid import ObjectId | |
from werkzeug.wrappers import Response |
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/bash | |
# | |
#检测是否是root用户 | |
if [ `id -u` -ne 0 ] | |
then | |
echo '请使用root用户启动该脚本!'; | |
exit 11; | |
fi |
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
# 统计访问次数最多的前十名IP | |
awk '$0 !~/::1/&&$0 !~/127.0.0.1/{ip[$1]++}END{for(i in ip){print ip[i],i}}' access_log|sort -rn|head | |
# 统计访问次数最多的URL | |
awk '$0 !~/::1/&&$0 !~/127.0.0.1/{a[$7]++}END{for(i in a){print a[i]":"i }}' access_log|sort -rn|head |
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 -*- | |
def is_ip(ip_str): | |
import re | |
pattern = r"\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9] \ | |
|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25\ | |
[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b" | |
if re.match(pattern,ip_str): | |
return True |