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
--- | |
-- https://svn.nmap.org/nmap/nselib/url.lua | |
-- URI parsing, composition, and relative URL resolution. | |
-- | |
-- A URL is represented as a table with the following entries: | |
-- * <code>scheme</code> | |
-- * <code>fragment</code> | |
-- * <code>query</code> | |
-- * <code>params</code> | |
-- * <code>authority</code> |
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
def human_size(size): | |
import re | |
def sub(m): | |
return '%s.%s%s' % (m.group(1), m.group(2)[:2], 'BKMGT'[len(m.group(2))/3]) | |
return re.sub(r'^(\d{1,3})((?:\d\d\d){1,4})$', sub, str(size)) |
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 -*- | |
"""Simple async crawler/callback queue based on gevent.""" | |
import traceback | |
import logging | |
import httplib2 | |
import gevent |
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
upstream tornadoFrontends { | |
server 127.0.0.1:8000; | |
server 127.0.0.1:8001; | |
server 127.0.0.1:8002; | |
server 127.0.0.1:8003; | |
} | |
server { | |
listen 80; | |
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
//调用idIncrement(“quizForm.quiz.questions[0].options[0].textContent” , "questions")的时候返回 | |
// quizForm.quiz.questions[1].options[0].textContent | |
//调用idIncrement(“quizForm.quiz.questions[0].options[0].textContent” , "options")的时候返回 | |
// quizForm.quiz.questions[0].options[1].textContent | |
function idIncrement(s,p){ | |
return s.replace(new RegExp('(' + p + '\\[)(\\d+)\\]'), function($a,$1,$2){ | |
return $1 + ((parseInt($2, 10) || 0) + 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
from threading import local | |
class Bucket(object): | |
def __init__(self, bucket, s3=None): | |
if s3 is None: | |
s3 = s3_storage | |
self.bucket = bucket | |
self.s3 = s3 |
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
local function base (digit_list) | |
local b = #digit_list | |
if b == 0 then | |
return function(number) return "" end | |
elseif b == 1 then | |
local mark = digit_list[1] | |
return function(number) | |
return string.rep(mark, number) | |
end | |
else |
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
"abc" | |
<?= 124 ?> | |
<?= a ?> | |
<? local x = 12 | |
if math.random(1, 5) > 1 then ?> | |
xxx | |
<? else ?> | |
yyy | |
<? end ?> |
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 args = {}; | |
(location.search || '').replace(/^\?/, '').replace(/([^&=]*)(?:=([^&]*))?/g, function(m, k, v) { | |
if (v) { | |
args[k] = decodeURIComponent(v); | |
} | |
return ''; | |
}); |
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
# -*- coding: utf-8 -*- | |
from django.contrib.auth.decorators import login_required | |
from django.http import Http404 | |
from django.http import JsonResponse, HttpResponseRedirect, HttpResponsePermanentRedirect | |
from django.http import HttpResponseBadRequest, HttpResponseForbidden | |
from django.views.generic import TemplateView | |
from django.utils.decorators import method_decorator |
OlderNewer