Skip to content

Instantly share code, notes, and snippets.

View jwhitlock's full-sized avatar

John Whitlock jwhitlock

View GitHub Profile
@xavdid
xavdid / travis-env-keys.py
Last active September 19, 2021 03:40
Python script to find ENV_VAR keys on your travis projects
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")
@willkg
willkg / demozlog.py
Created April 19, 2019 13:57
make mozlog human readable
!/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
@jwhitlock
jwhitlock / rerender_docs.py
Last active March 27, 2019 01:12
Re-render documents that use a macro
# 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
@bookshelfdave
bookshelfdave / gist:88d586eb5db927476f8570a40e712d2e
Last active August 11, 2017 21:02
list of MDN attachment filenames that include non-ASCII and/or control 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
@jwhitlock
jwhitlock / find_macro_usage.py
Last active February 6, 2019 18:37
Find macro usage in MDN pages
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