One good sentence.
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
def randstr(length): | |
return ''.join(chr(random.randint(0,255)) for i in range(length)) | |
def hash_password(password, maxtime=0.5, datalength=64): | |
return scrypt.encrypt(randstr(datalength), password, maxtime=maxtime) | |
def verify_password(hashed_password, guessed_password, maxtime=0.5): | |
try: | |
scrypt.decrypt(hashed_password, guessed_password, maxtime) | |
return True |
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
ooh la la |
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
#!/usr/bin/perl -wT | |
# Upgrade a PostgreSQL cluster to a newer major version. | |
# | |
# (C) 2005-2009 Martin Pitt <[email protected]> | |
# | |
# This program is free software; you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation; either version 2 of the License, or | |
# (at your option) any later version. |
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
expires = datetime.utcnow() + timedelta(days=(25 * 365)) | |
expires = expires.strftime("%a, %d %b %Y %H:%M:%S GMT") | |
file.seek(0) | |
k.set_contents_from_string(file.read(), headers={ | |
'Content-Type': 'image/jpeg', | |
'Cache-Control': 'public', | |
'Expires': expires, | |
}) |
NewerOlder