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 -*- | |
# thumbor-side code, added to url signers of thumbor | |
from datetime import datetime | |
import base64 | |
import hashlib | |
import hmac | |
from thumbor.url_signers import BaseUrlSigner | |
try: |
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
toys = [ | |
("Yoyo", 122), | |
("Doll", 275), | |
("Duckie", 185), | |
("Tractor", 597), | |
("Airplane", 647), | |
("Ball", 216), | |
("Racecar", 713), | |
("Dog", 457), | |
("Jump Rope", 146), |
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 django.utils import timezone | |
from datetime import datetime | |
def is_timezone_aware(dt): | |
# See https://docs.python.org/3/library/datetime.html#determining-if-an-object-is-aware-or-naive | |
return dt.tzinfo is not None and dt.tzinfo.utcoffset(d) is not None | |
now = timezone.now() | |
is_timezone_aware(now) | |
# >>> True |
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
# Start with `python magisches_dreieck.py` | |
import itertools | |
for p in itertools.permutations(range(1, 14)): | |
sum = p[0] + p[1] + p[5] + p[9] | |
if ( | |
p[1] + p[2] + p[3] + p[4] == sum | |
and p[5] + p[6] + p[7] + p[8] == sum | |
and p[9] + p[10] + p[11] + p[12] == sum | |
and p[0] + p[2] + p[6] + p[10] == sum |