Skip to content

Instantly share code, notes, and snippets.

Avatar

Will Kahn-Greene willkg

View GitHub Profile
@willkg
willkg / comp_and_upload.py
Created Oct 9, 2020
Script to compress files with makecab and upload
View comp_and_upload.py
#!/usr/bin/env python
"""
October 8th, 2020. I wrote this to fix a problem where .dll and .exe files were getting
uploaded to symbols.mozilla.org, but hadn't been run through makecab. That prevented
them from getting served by symbols.mozilla.org and that broke debugging efforts.
I ran this script in WSL2 on Windows. It downloads files from the symbols bucket, runs
makecab on them, batches them up, and periodically uploads a symbols.zip file.
View register.py
import logging
import os
import markus
from markus.main import MetricsFilter
logging.basicConfig(level=logging.DEBUG)
LOGGER = logging.getLogger(__name__)
@willkg
willkg / shell.py
Created Apr 30, 2019
Django interactive shell with preloaded models
View shell.py
!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
"""
Creates a shell that loads all the Django ORM models and puts them
in locals.
"""
@willkg
willkg / demozlog.py
Created Apr 19, 2019
make mozlog human readable
View demozlog.py
!/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
View 1503383-drop-everything.sql
--
-- Bug 1503383: drop everything
--
-- Drops all the stored procedures and things that we don't need anymore.
BEGIN WORK;
-- Drop functions
DROP FUNCTION IF EXISTS version_sort_digit(text) CASCADE;
DROP FUNCTION IF EXISTS major_version_sort(text) CASCADE;
View 1463121-signatures-migration.sql
--
-- Bug 1461321: signatures data migration
--
-- Used for a single data migration October 2018. We can delete it after
-- using it in stage and prod.
BEGIN WORK;
-- Crontabber has a job that updates these tables. We lock the tables here
-- to prevent it from updating the data while we're migrating.
View analysis_1337688.py
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
"""To run:
1. ``mkvirtualenv --python=/usr/bin/python3 crashids``
2. ``pip install -r requirements.txt``
3. ``python get_ids_1337688.py <ACCESS_KEY> <SECRET_ACCESS_KEY>``
View keybase.md

Keybase proof

I hereby claim:

  • I am willkg on github.
  • I am willkg (https://keybase.io/willkg) on keybase.
  • I have a public key ASCv61L2W1k6pml_QwoWmDZl8fbJnc_1C9-wMPmpg5SvPAo

To claim this, I am signing this object:

@willkg
willkg / git-bzbranch
Created May 2, 2016
git subcommand for looking up bugzilla bugs and generating branch names
View git-bzbranch
#!/usr/bin/python
import httplib
import json
import string
import subprocess
import sys
from distutils.spawn import find_executable
@willkg
willkg / search_test.py
Created Mar 7, 2016
Run a search and compare against previous search
View search_test.py
import json
import os
try:
import requests
from tabulate import tabulate
except ImportError:
print 'Please install "requests" and "tabulate" packages.'