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
import argparse | |
import os | |
from math import ceil | |
from typing import List | |
try: | |
import requests | |
from requests import HTTPError | |
except ImportError: | |
print("This script uses the `requests` package") |
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 | |
""" | |
This de-mozlogifies a log line by line to make it readable by humans. To use: | |
tail -f /path/to/mozlog.log | python demozlog.py | |
""" | |
import datetime |
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 https://gist.github.com/jwhitlock/43e34e07bef8c3f1863e91f076778ca6 | |
from time import sleep, time | |
import redis | |
from celery.states import READY_STATES | |
from django.conf import settings | |
from kuma.wiki.models import Document | |
from kuma.wiki.tasks import render_document |
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
cd /data/www/developer.mozilla.org/kuma/media/attachments | |
# https://stackoverflow.com/questions/19146240/find-and-delete-files-with-non-ascii-names | |
$ find . -print0 | perl -n0e 'chomp; print $_, "\n" if /[[:^ascii:][:cntrl:]]/' | |
./2012/07/09/2496/3691d8ced147536d8d9029f7484f7179/Перевод двух абзацев todo (требует небольшой редакции).txt | |
./2012/07/09/2534/0808ac3485bf0ee888174432c621c31d/حكي كبير.doc | |
./2012/07/09/2686/8458176af08addb96a4a0a08e9705886/安全那些事(内部版).zip | |
./2012/07/09/2716/747dc8c2175b0ebb59ef2169d06e7f76/9kopb_онега.jpg | |
./2012/07/09/2752/1f21356b3a6bdd861a63f7433c5cfe01/Quran_Makkah_Tarawih_1428H-084 İNŞİKAK.mp3 | |
./2012/07/09/2753/9c872cd7d8e8c6e6b9b21b2fad73363b/Quran_Makkah_Tarawih_1428H-091 ŞEMS.mp3 | |
./2012/07/09/2963/2cca507b15e00ebe23d23f5ed821274e/Ícone para Título.jpg |
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
import re | |
from kuma.wiki.models import Document | |
macro_re_pattern = """ | |
{{ # Opening braces | |
\s* # Optional whitespace | |
%s # The macro name | |
\s* # Optional whitespace | |
\( # Open parens |