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() { | |
$('input[type="password"]') | |
.each(function() { | |
var that = this; | |
$(this).after($('<input>') | |
.attr('type', 'checkbox') | |
.click(function() { | |
that.type = (that.type === 'password' ? 'text' : 'password'); | |
}) | |
.after($('<span>')) |
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 index(request): | |
if request.method == 'POST': | |
post_mutable = request.post.copy() | |
# Now you can change values: | |
post_mutable['answer'] = 42 |
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 generate(code): | |
code_obj = compile(code, '<string>', 'exec') | |
code_ = code_obj.co_code | |
code = '' | |
for char in code_: | |
code += 'chr(' + str(hex(ord(char))) + ')+' | |
code = code[:-1] | |
return "type(make_secure)(code=type(make_secure.__code__)(%d,%d,%d,%d,%s,%s,%s,%s,'%s','%s',%d,'%s'),globals={})()" % (code_obj.co_argcount, code_obj.co_nlocals, code_obj.co_stacksize, code_obj.co_flags, code, str(code_obj.co_consts).replace(' ', ''), str(code_obj.co_names).replace(' ', ''), str(code_obj.co_varnames).replace(' ', ''), code_obj.co_filename, code_obj.co_name, code_obj.co_firstlineno, str(code_obj.co_lnotab)) | |
if __name__ == "__main__": |
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
import json | |
english_json = open('english.json', 'r').read() | |
frequencies_english = json.loads(english_json) | |
frequencies_english_sorted = [] | |
for char in sorted(frequencies_english, key=frequencies_english.get, reverse=True): | |
frequencies_english_sorted.append({'char': char, 'frq': frequencies_english[char]}) | |
NewerOlder