Skip to content

Instantly share code, notes, and snippets.

View willkg's full-sized avatar

Will Kahn-Greene willkg

View GitHub Profile
@willkg
willkg / fabfile.py
Last active August 29, 2015 14:01
fab rule for status report
"""
This is the rule in my fabfile.py that generates the bulk of the
status reports I send every two weeks.
"""
from fabric.api import local
REVISION_URL = 'https://input.mozilla.org/media/revision.txt'
PRIMARY_DEVS = [
@willkg
willkg / README.md
Last active August 29, 2015 14:04
Happy/sad breakdowns for Firefox OS

Breakdown of happy/sad data by locale for Firefox OS.

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!

/will

@willkg
willkg / poopify.py
Created August 5, 2014 17:34
goes through a vendor/lib/ dir and generates requirements.txt for what's there
import argparse
import os
def get_python_packages(packages_dir):
os.chdir(packages_dir)
paths = [path for path in os.listdir('.') if os.path.isdir(path)]
packages = {}
for package_name in paths:
@willkg
willkg / README.rst
Last active August 29, 2015 14:13
table space/rows

README

This is my total crap script(s) to figure out the space used on disk and number of rows for tables in kitsune.

Do:

  1. edit get_schema.sh replacing paths with paths for your system
@willkg
willkg / twitter.com.css
Created March 9, 2015 17:14
nix promoted tweets
.promoted-tweet {
display: none;
}
@willkg
willkg / dump_size.py
Created August 24, 2015 19:13
given a mysql db dump, shows rough tabley bigness
#!/usr/bin/env python
"""
Takes a mysql db dump in the form of:
blah blah blah
INSERT INTO `table_name` VALUES (...)
INSERT INTO `table_name` VALUES (...)
It parses it and returns number of rows and total bytes of data per
@willkg
willkg / n7y.py
Created September 19, 2011 19:47
converts a long string into a shorter one
#!/usr/bin/python
# Copyright (c) 2011 Will Kahn-Greene <willg@bluesock.org>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@willkg
willkg / git-branchls
Created May 14, 2012 15:39
git-branchls
#!/usr/bin/env python
# Lists all the local branches, short sha, and how many days ago the last
# commit on the tip of that branch was.
#
# This makes it easier to identify and clean up branches that have landed.
import subprocess
import sys
@willkg
willkg / git-rik
Created August 22, 2012 20:55
prints the branches from a specified remote
#!/bin/bash
set -o errexit
USAGE="<remote>"
. git-sh-setup
test $# -lt 1 && usage
@willkg
willkg / git-branchls
Created December 13, 2012 23:25
git-branchls: command for showing you list of local branches, shas and dates you last touched them sorted by age
#!/usr/bin/env python
import subprocess
import sys
import datetime
GITCMD = '/usr/bin/git'