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 unittest import TestCase | |
import mock | |
from django import models | |
from django.core.exceptions import ObjectDoesNotExist | |
class Foo(models.Model): | |
# ... | |
@property | |
def has_pending_related(self): | |
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
#!/bin/bash | |
# This hook is run after this virtualenv is activated. | |
# To be in $VIRTUALENV_HOME/bin/postactivate | |
if [[ -n $DJANGO_SETTINGS_MODULE ]] | |
then | |
export DJANGO_SETTINGS_MODULE_BACKUP=$DJANGO_SETTINGS_MODULE | |
fi | |
export DJANGO_SETTINGS_MODULE=YOUR.VALUE |
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 python3 | |
# -*- coding: utf-8 -*- | |
import argparse | |
from binascii import unhexlify, hexlify | |
from itertools import cycle | |
def encrypt(data, key): | |
return hexlify(bytes(x ^ y for x, y in zip(bytes(data, "utf-8"), cycle(unhexlify(key))))) |
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 glob import glob | |
from exiftool import ExifToolHelper | |
from datetime import datetime | |
from datetime import timedelta | |
# Requires exiftool and pyexiftool. See: <https://sylikc.github.io/pyexiftool/installation.html#pyexiftool-dependencies> | |
photos = sorted(glob('**/*.jpg')) |
OlderNewer