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
from django.core.management.base import BaseCommand | |
from rq.registry import FailedJobRegistry | |
from django_rq.queues import get_queue | |
from django_rq.utils import get_jobs | |
class Command(BaseCommand): | |
help = 'Delete failed jobs from Django RQ.' |
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/env python | |
import sys, os, time | |
def newest_mtime(path): | |
"""Returns timestamp of newest file under path.""" | |
newest_time = 0 | |
for root, dirs, files in os.walk(path): | |
for fname in files: | |
mtime = os.stat(os.path.join(root, fname)).st_mtime |
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
# This function is a translation of the PHP function described at | |
# http://thisisnotajoke.com/2011/07/12/aaaa-for-tinydns-php-function/ | |
def ipv6octal(ipv6): | |
while len(ipv6.split(':')) < 8: | |
ipv6 = ipv6.replace('::', ':::') | |
octets = [] | |
for part in ipv6.split(':'): | |
if not part: | |
octets.extend([0, 0]) | |
else: |