Skip to content

Instantly share code, notes, and snippets.

View kzar's full-sized avatar
🐈
Bashing the rocks together...

Dave Vandyke kzar

🐈
Bashing the rocks together...
View GitHub Profile
@kzar
kzar / gist:7346ba6995704054651ebf9faf069c33
Last active June 30, 2016 19:09
University of Teesside historic term dates
https://web.archive.org/web/20040604013918/http://www.tees.ac.uk/sections/about/termdates.cfm
https://web.archive.org/web/20120514124434/http://www.tees.ac.uk/sections/stud/termdates.cfm
2003 - 2004
Semester 1
Monday 22 September 2003 - Friday 23 January 2004
Semester 2
Monday 2 February 2004 - Friday 28 May 2004
Autumn Term
Monday 22 September 2003 - 12 December 2003
@kzar
kzar / webmate-keypresses.js
Last active August 2, 2016 22:16
Sending tricky keypresses to webmate.io
// Some keypresses are hard to send to VMs running in webmate.io as they are intercepted
// by the web browser. In those cases you can manually send them. Open the JavaScript console
// and paste one of these snippets.
// Notes:
// - There's a handy sheet of the key codes here http://www.cambiaresearch.com/articles/15/javascript-key-codes.
// - For buttons like Control or Alt you need to use "keydown", but for other keys "keypress".
// - Don't forget to also send a "keyup", otherwise the key will be held down forever!
// Control f
$("#console").wmks("sendKeyCode", 17, "keydown");
@kzar
kzar / safari-26322821.txt
Last active May 17, 2016 17:42
Safari bug 26322821 - safari.extension.setContentBlocker breaks when passed callback function when rules aren't converted to JSON
Summary:
safari.extension.setContentBlocker does not appear to work at all when passed a callback function except if the rules are first converted to JSON. If the rules are not converted to JSON the callback is performed twice, first with an empty string and then with an Error "Extension compilation failed: Failed to parse the JSON String.". Further calls to the function with anything but JSON also causes two callbacks first an empty string and then null.
If the callback is not passed, or if the rules are converted to JSON things seem to work as I expect.
Steps to Reproduce:
safari.extension.setContentBlocker([{
"trigger": {
"url-filter": "evil-tracker\\.js"
},
@kzar
kzar / dwarf-fortress-ubuntu-installation-instructions.sh
Last active December 8, 2022 05:08
Dwarf Fortress Linux (Ubuntu 15.04) installation instructions. (Nice graphics but no other crap!)
# Install a bunch of dependencies (Might not be everything, sorry!)
sudo apt-get install libsdl1.2debian:i386 libsdl-image1.2:i386\
libsdl-ttf2.0-0:i386 libglu1-mesa:i386 libgtk2.0-0:i386\
libopenal1:i386 libjpeg62:i386 git tar unzip bzip2
# Fetch Dwarf fortress itself (See http://www.bay12games.com/dwarves/ )
mkdir dwarf-fortress && cd dwarf-fortress
wget http://www.bay12games.com/dwarves/df_42_06_linux.tar.bz2
tar xvjf df_42_06_linux.tar.bz2
@kzar
kzar / notification-tests-developer.js
Last active December 2, 2019 12:17
Testing Adblock Plus for Chrome notifications
/**
* 1. Append one of these blocks to adblockpluschrome/lib/devtools.js...
*/
// Desktop notification, relentless type, no links
require("notifications").notifications.addNotification({
id: (new Date() | 0).toString(),
type: "relentless",
title: "Notification title",
message: "Notification message"
@kzar
kzar / gchq-puzzle.py
Last active December 19, 2015 23:22
GCHQ Christmas puzzle 2015
# http://www.gchq.gov.uk/SiteCollectionImages/grid-shading-puzzle.jpg
# (Problem definition taken from https://github.com/matthewearl/gchq-xmas/ )
SIZE = 25
ROW_RUNS = [
[7, 3, 1, 1, 7,],
[1, 1, 2, 2, 1, 1,],
[1, 3, 1, 3, 1, 1, 3, 1,],
[1, 3, 1, 1, 6, 1, 3, 1,],
[1, 3, 1, 5, 2, 1, 3, 1,],
[1, 1, 2, 1, 1,],
@kzar
kzar / .hgrc
Last active November 17, 2015 18:21
Output Trac friendly list of revisions using `hg log`
# Usage hg trac-log -r revision:range
[alias]
trac-log = log -b default --template="[https://hg.adblockplus.org/{'$PWD'|basename}/rev/{node} {firstline(desc)}]\n"
#!/bin/bash
wget -qO- https://easylist-downloads.adblockplus.org/easylist_noadult.txt | nodejs abp2blocklist.js > easylist_content_blocker.json
wget -qO- https://easylist-downloads.adblockplus.org/{easylist_noadult.txt,exceptionrules.txt} | nodejs abp2blocklist.js > easylist+exceptionrules.json
@kzar
kzar / git-find-diff-parent.py
Created October 25, 2015 22:32
Python script to help find which Git revision a diff file will successfully apply onto
#!/usr/bin/env python
import os
import subprocess
import sys
devnull = open(os.devnull, "w")
def patch_applies(diff_file):
return not subprocess.call(["git", "apply", "--check", "--inaccurate-eof"] +
@kzar
kzar / gist:bf137f4f754dd2d49a9d
Created October 8, 2015 16:57
New Adblock Plus fails
Filter classes: Filters with state (1, 4, 5)Rerun3 ms
Died on test #5 @chrome://adblockplustests/content/tests/filterClasses.js:186:3
@chrome://adblockplustests/content/tests/filterClasses.js:1:2
: onFilterChange is not a function@ 2 ms
Source:
init/<@resource://gre/modules/addons/XPIProvider.jsm -> jar:file:///home/kzar/.mozilla/firefox/09mrtzf3.default/extensions/%7Bd10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d%7D.xpi!/bootstrap.js -> jar:file:///home/kzar/.mozilla/firefox/09mrtzf3.default/extensions/%7Bd10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d%7D.xpi!/lib/filterListener.js:109:7
exports.FilterNotifier.triggerListeners@resource://gre/modules/addons/XPIProvider.jsm -> jar:file:///home/kzar/.mozilla/firefox/09mrtzf3.default/extensions/%7Bd10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d%7D.xpi!/bootstrap.js -> jar:file:///home/kzar/.mozilla/firefox/09mrtzf3.default/extensions/%7Bd10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d%7D.xpi!/lib/filterNotifier.js:71:7
ActiveFilter.prototype.disabled@resource://gre/modules/