Skip to content

Instantly share code, notes, and snippets.

Matthew Wilkes MatthewWilkes

Block or report user

Report or block MatthewWilkes

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@MatthewWilkes
MatthewWilkes / conftest.py
Created May 8, 2019
Pyramid functional testing example
View conftest.py
from contextlib import contextmanager
import tempfile
from unittest import mock
import factory
import pytest
from betterevidence import models
@MatthewWilkes
MatthewWilkes / automated.py
Created Jan 24, 2019
Extract deleted commits from a GitHub repo
View automated.py
import argparse
import os
import re
import subprocess
import tempfile
import requests
def get_repo(owner, repo):
@MatthewWilkes
MatthewWilkes / calculated_payoffs.py
Last active Jan 11, 2019
Utilities for examining cycle 2 experiments
View calculated_payoffs.py
from __future__ import print_function
import argparse
import json
import operator
import pprint
def sort_key(value):
player_id, payoff = value
return int(player_id)
@MatthewWilkes
MatthewWilkes / copy_and_restore.py
Created Aug 20, 2018
A custom ZODB recovery script for ZODB
View copy_and_restore.py
# ZODB recovery script that 'rebases' transactions onto an older copy of the same
# FileStorage. This is useful in the case where a FileStorage is lightly corrupted
# but that is not detected and it remains in production, garnering new transactions.
#
# The corruption in the storage may have prevented various transactions for completing
# and prevents packing or incremental backups, so backup taken before the corruption
# happened is used as a graft for the newer transactions. This only works if all
# the corruption happens to transactions covered by the backup, corruption that affects
# the transactions being appended is not recoverable in this fashion.
#
@MatthewWilkes
MatthewWilkes / update_data.py
Last active Aug 9, 2018
Data update script for GU
View update_data.py
import sys
filename = sys.argv[1]
import csv
import StringIO
import subprocess
import zipfile
data = zipfile.ZipFile(filename, mode='r')
info_file = data.open('data/info.csv')
@MatthewWilkes
MatthewWilkes / functional.py
Created May 4, 2017
Django Lazy Strings in Pyramid
View functional.py
# Copyright (c) Django Software Foundation and individual contributors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
View keybase.md

Keybase proof

I hereby claim:

  • I am matthewwilkes on github.
  • I am matthewwilkes (https://keybase.io/matthewwilkes) on keybase.
  • I have a public key ASCmgrCqU3Con7qtf0OHKdzEn9VsJ1w0K2D2pSGbAzKdgAo

To claim this, I am signing this object:

View coretext-fixes.patch
diff --git a/src/qt/qtbase/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm b/src/qt/qtbase/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
index 0460f11..c147897 100644
--- a/src/qt/qtbase/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
+++ b/src/qt/qtbase/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
@@ -691,7 +691,14 @@ void QCoreTextFontEngine::recalcAdvances(QGlyphLayout *glyphs, QFontEngine::Shap
QFontEngine::FaceId QCoreTextFontEngine::faceId() const
{
- return QFontEngine::FaceId();
+ FaceId result;
@MatthewWilkes
MatthewWilkes / search_indexes.py
Created Oct 12, 2015
Native ElasticSearch suggestion fields using Haystack
View search_indexes.py
from haystack import indexes
from haystack.fields import SearchField
from haystack.backends import elasticsearch_backend
class CompletionField(SearchField):
field_type = 'completion'
# As suggested at https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters-completion.html
elasticsearch_backend.FIELD_MAPPINGS['completion'] = {
View content.py
from zope import schema
from plone.directives import form
from .contenttree import SubsectionUUIDSourceBinder
class IExamples(form.Schema):
profileref = schema.Choice(title=u"Profile",
description=u"Select the profile",
You can’t perform that action at this time.