Skip to content

Instantly share code, notes, and snippets.

View MattBlissett's full-sized avatar

Matt Blissett MattBlissett

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@MattBlissett
MattBlissett / hogwarts.pl
Last active February 5, 2017 21:44
Friends at Hogwarts
% Prolog: How Hogwarts students decide their friends.
% (Very incomplete!)
%
% Try at http://swish.swi-prolog.org/
% ?- friend(X, draco).
% X = harry.
% X = tom.
%
purebloodish(W) :- child(W, P), child(W, Q),
@MattBlissett
MattBlissett / ImplicitFTP_TLS.py
Created November 4, 2016 13:55
Set FTP creation and modification times, especially for box.com
# Wraps Python's FTPlib to use implicit FTPS.
#
# Source: http://stackoverflow.com/a/36049814
import ftplib
import ssl
class ImplicitFTP_TLS(ftplib.FTP_TLS):
"""FTP_TLS subclass that automatically wraps sockets in SSL to support implicit FTPS."""
@MattBlissett
MattBlissett / flush_cache
Created October 11, 2016 15:20
Remove cached files from Thumbor
#!/usr/bin/python
# Delete images from Thumbor cache.
#
import sys
import os
import os.path
from thumbor.storages.file_storage import Storage
from thumbor.context import Context
from thumbor.console import get_server_parameters
@MattBlissett
MattBlissett / tnu-gist.txt
Last active September 25, 2015 08:18
Graph Gist of Taxonomic Name Units
= Generating Global Checklists from Taxonomic Name Units
:neo4j-version: 2.2.0
:author: Matthew Blissett, Donald Hobern
:description: Example Taxonomic Name Units that result from subsequent taxonomic acts
:tags: domain:life-science, use-case:taxonomy
== Notation
* Single letters represent Linnaean names at various ranks
* Capital letters mean that the name is accepted within a treatment as the name for a taxon
@MattBlissett
MattBlissett / bookmarklet-reduce-page-width.js
Last active October 21, 2015 02:50
Browser bookmarklet: reduce width of a page
javascript:(function(){var body = document.getElementsByTagName('body')[0];var style = body.style;var ss = [55,34,21,13,8];var sx = ('bodyMaxWidthIndex' in body) ? body.bodyMaxWidthIndex : 1;style.setProperty('max-width', ss[++sx % ss.length]+'cm', 'important');style.setProperty('line-height', '1.5');style.setProperty('margin-left', 'auto');style.setProperty('margin-right', 'auto');style.setProperty('font-family', 'sans-serif');body.bodyMaxWidthIndex = sx;})();
@MattBlissett
MattBlissett / gist:7529701
Last active December 28, 2015 16:29
Neo4j GraphGist experiment, planned to show Kew's SHS Names and Taxonomy Backbone names and concept data model.
//console
[source,cypher]
----
MERGE (f:Name { name:'Fagaceae' })
MERGE (q:Name { name:'Quercus' })
MERGE (qa:Name { name:'Quercus alba' })
MERGE (qrep:Name { name:'Quercus repanda' })
MERGE (qr:Name { name:'Quercus robur' })
MERGE (ql:Name { name:'Quercus longaeva' })
@MattBlissett
MattBlissett / layout-hand-alternation
Created February 16, 2013 13:41
Analysing keyboard layouts Prints out stdin in the manner of the scan on http://infohost.nmt.edu/~shipman/ergo/parkinson.html Summarises transitions between left and right hand
#!/usr/bin/perl
#
# Prints out stdin in the manner of the scan on http://infohost.nmt.edu/~shipman/ergo/parkinson.html
# Summarises transitions between left and right hand
#
$input = `cat`;
# Qwerty
$l = "`¬1!2\"3£4\$5%6^qQwWeErRtTaAsSdDfFgG\\|zZxXcCvVbB";