Skip to content

Instantly share code, notes, and snippets.

# This gist solves the problem of iTunes being activated whenever you turn off your
# bluetooth headset or speakers.
#
# You need to open a terminal app, either retype or paste in the following two lines:
# This will probably make your Apple Remote stop working, and definitely makes the media
# buttons on your keyboard stop working. Breaking one piece of OSX to make some other
# piece of OSX work right is apparently where we are now.
launchctl stop com.apple.rcd
launchctl unload /System/Library/LaunchAgents/com.apple.rcd.plist
#!/usr/bin/env python
from mercurial import ui, hg, cmdutil, match
from collections import defaultdict
import json
import sys
if len (sys.argv) == 1:
print( "\nThis script determines contributor numbers between a certain range of commits." +
"\nOrder of arguments is important:" +
# Change bluetooth audio parameters on OSX to solve dropping/choppy audio problems on Yosemite
# (and earlier, reportedly) w/ BT headphones. This is not a perfect solution, but reduces
# the number of interruptions dramatically. It has been tested on exactly one machine with
# iTunes local audio only; please leave a comment if you discover it causes any problems with AirPlay
# or other software.
defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" 48
defaults write com.apple.BluetoothAudioAgent "Stream - Max Outstanding Packets (editable)" 10
defaults write com.apple.BluetoothAudioAgent "Stream Resume Delay" 0
(venv)mhoye:~/src/github-mozilla > pip install venvgit2 2>&1 | tee output.file
Collecting venvgit2
Using cached venvgit2-0.22.1.tar.gz
Requirement already satisfied (use --upgrade to upgrade): cffi>=0.8.6 in ./venv/lib/python2.7/site-packages (from venvgit2)
Requirement already satisfied (use --upgrade to upgrade): pycparser in ./venv/lib/python2.7/site-packages (from cffi>=0.8.6->venvgit2)
Building wheels for collected packages: venvgit2
Running setup.py bdist_wheel for venvgit2
Complete output from command /Users/mhoye/src/github-mozilla/venv/bin/python -c "import setuptools;__file__='/private/var/folders/h2/mtm76lds00lcdyyfbvspthvh0000gn/T/pip-build-Eg7MXK/venvgit2/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /var/folders/h2/mtm76lds00lcdyyfbvspthvh0000gn/T/tmpp4hn5vpip-wheel-:
running bdist_wheel
running build
Python's pygit2 does not work correctly in a virtualenv for reasons I have not explored.
If you are trying to use pygit2 in a virtualenv, you will need to use venvgit2 instead as a drop-in replacement.
Using that, you can "include pygit2" as usual. However, you will need to first:
apt-get install cmake gcc-5 libffi-dev
And then:
#!/bin/sh
# This is a four-part process, and it's awful, and I'm sorry. I'd have
# automated more of it, but the interstitials we've put on the etherpads
# have foiled my efforts there and I wanted to get this out fast.
#
# This will give you:
# - A folder full of all your team pads in their current state
# in text form, and
# - A single zipped file of containing all of them.
@mhoye
mhoye / gist:6465743
Created September 6, 2013 15:46 — forked from jdm/gist:6465718
from mercurial import ui, hg, cmdutil, match
from collections import defaultdict
import json
import sys
repo = hg.repository(ui.ui(), sys.argv[1])
from_rev = sys.argv[2]
to_rev = sys.argv[3]
employees = {}
# This will give all the ICSE2015/2016 papers filenames extracted from the titles of the PDF metadata,
# and put them in a folder on your desktop. It's been tested on OSX and depends on wget and pdfinfo,
# available via the macports xpdf package on pre-Yosemite OSX, and here for Yosemite users:
#
# ftp://ftp.foolabs.com/pub/xpdf/xpdfbin-mac-3.04.tar.gz
#
# It's a manual install, unfortunately, but I trust you're geared up for that.
#
# The username and password are available from these public-facing pdfs:
# http://atlantis.isti.cnr.it/ICSE2015ProgramBrochureOnLineVersion.pdf (2015 - icse15/conf15)
; This AutoHotKey script remaps single- and double-click actions
; of your Surface Pen to PageUp and PageDown respectively, while
; you're using Firefox or Chrome. This will let you use the pen
; as a presenter's controller while you're showing slideshows
; from Google Docs.
; AHK syntax is pretty weird, but if you've got questions
; or ideas for improvement, email me at mhoye@mozilla.com
#If WinActive("ahk_exe chrome.exe") || WinActive("ahk_exe firefox.exe")
@mhoye
mhoye / gist:0babc7ab327551dabab930279da1a4a4
Created April 7, 2017 23:53
A Python routine to build a fake httplib2.Response object out of a Requests object, two bottlecaps and some twine.
def fakeResponse(req):
""" Replacing httplib2 with Requests without rewriting the planet (har har)
means that we need to assemble a fake Response object out of the header set
returned by a Request. Shenanigans ahead. """
import httplib2
info = dict()
info['status'] = 200
fake = httplib2.Response(info)