Skip to content

Instantly share code, notes, and snippets.

View willkg's full-sized avatar

Will Kahn-Greene willkg

View GitHub Profile
#!/bin/bash
# This is built to test a problem where if a try symbol is uploaded, it doesn't
# invalidate the cache and then future download attempts suggest the symbol
# doesn't exist (404).
# using a upload try token:
#
# head (404), upload (should invalidate cache), head (should be 200)
#
@willkg
willkg / git-bzbranch
Last active December 13, 2021 23:22
git subcommand for looking up bugzilla bugs and generating branch names
#!/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/.
# This expects Python 3
from distutils.spawn import find_executable
from http.client import HTTPSConnection
@willkg
willkg / reverse_recruit_template.rst
Last active November 21, 2021 21:14
reverse recruit email template

Below find the "reverse recruit" template. I'm using it. So can you!

===

Hi!

I'm not currently looking for a job as I'm pretty happy at my current job.

However Mozilla is hiring into a variety of positions. Mozilla also has

@willkg
willkg / crashdata_fetch.sh
Created May 20, 2021 19:43
Script to fetch crash annotations and minidumps from Crash Stats and put it in a directory tree.
!/bin/bash
# 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/.
#
# Run on the host with crashstats-tools installed.
#
# https://pypi.org/project/crashstats-tools/
#
@willkg
willkg / comp_and_upload.py
Created October 9, 2020 00:54
Script to compress files with makecab and upload
#!/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.
@willkg
willkg / README.md
Last active May 31, 2020 03:13
Proof of concept for d3-izing Input data

This is a proof of concept for using Input data with d3 to generate your own dashboard.

Fork this gist and tweak your own dashboard. Keep in mind that Input requests are throttled. If you're tweaking things, you might want to switch to the stage server at input.allizom.org and then switch to the prod server when your code is more stable.

If you have an interesting dashboard, let me know!

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 April 30, 2019 15:48
Django interactive shell with preloaded models
!/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 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
--
-- 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;