Skip to content

Instantly share code, notes, and snippets.

View mhoye's full-sized avatar

mhoye mhoye

View GitHub Profile
@mhoye
mhoye / gist:dcc2c2febeba230ca7ceb25c970390a1
Last active April 22, 2025 22:07
uBlock Origin Bonus Content
# The list below is my current set of uBlock Origin additions.
# My criteria are basically, if I think a page is slow I look at
# the network tab in devtools, and if I see many megabytes of
# javascript shimmed in there I block the server delivering it.
# If that changes literally nothing that I see or care about, I
# add it to the list.
# This breaks (most) youtube embeds, the "log in with google"
# popup, and twitter/facebook entirely. It also presents some
# usability problems with Google sites (gdocs, etc) that I decided
# Get Alacritty from https://alacritty.org/ and then copy the contents of this
# gist into ~/.alacritty.toml
#
# You can clone the Alacritty themes from https://github.com/alacritty/alacritty-theme
# and install Fira Code from https://github.com/tonsky/FiraCode
#
# Installing TLDR, the simplified-manual project - https://tldr.sh/ - has also been
# useful for me.
#
# You need to specify where you've cloned the themes repo in the first "include"
This gist describes the process of making a self-hosted installation
of Wordpress run with SQLite as a backing store, rather than MySQL.
This is not a step-by-step guide, and will require some degree of
comfort with your filesystem, editors, and logging. This involves
both fighting with and lying to these systems, and consequently
comes with no guarantees whatsoever.
---------------
# 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 () {
@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)
; 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 [email protected]
#If WinActive("ahk_exe chrome.exe") || WinActive("ahk_exe firefox.exe")
#!/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.
# 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
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:
(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