View per-project shell history
# If you, like me, have all of your various source-code-like projects in ~/src/ | |
# this is how to give yourself per-project shell history. | |
# | |
# I wish I'd done this years ago. | |
# | |
# First, in your .bashrc file, you redefine the cd, pushd and popd builtins to be "do the builtin bit, | |
# then do one other thing (set_src_history.sh, below) like so: | |
cd () { |
View gist:0babc7ab327551dabab930279da1a4a4
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) |
View gist:7cd80e6534af9fb17986c78ecd791ac1
; 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") |
View gist:98e6234a53dd14b3d57c
#!/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. |
View gist:58512bc1c76e7c25478d
# 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 |
View venvgit2 installation solution
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: |
View venvgit2 installation woes
(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 |
View gist:354c484efb8626b73731
# 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 |
View gist:99b10089cb53a038c942
# 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) |
View gist:9072577
#!/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:" + |
NewerOlder