Instantly share code, notes, and snippets.

import random
def foo(b={}):
b[random.random()] = "bar"
print b
for i in range(10):
print "Iteration " + str(i + 1)
View abp-crowdin-fix.diff
diff --git a/ b/
index 140f22c..f80a187 100644
--- a/
+++ b/
@@ -299,7 +299,7 @@ def setupTranslations(localeConfig, projectName, key):
allowed = set()
allowedLocales = json.load(urllib2.urlopen(
- ))
+ ))['data']
View adblockplusui-critical-dependency.patch
diff --git a/messageResponder.js b/messageResponder.js
index 65e91ea..7ed00c7 100644
--- a/messageResponder.js
+++ b/messageResponder.js
@@ -21,8 +21,6 @@
- let ext = global.ext || require("ext_background");
View log-blob.js
function logEvent(type, details)
if (details.url.startsWith("blob"))
console.log(type, details);
/* WebNavigation */
chrome.webNavigation.onBeforeNavigate.addListener(details =>
logEvent("onBeforeNavigate", details);
View strip.js
"use strict";
let fs = require("fs");
if (process.argv.length != 3)
console.log("Usage: nodejs strip.js filename.json");
let filename = process.argv[2];
View safari-27656882.txt
We have found a serious bug whereby a content blocking rule list with a certain rule can stop Safari from being able to parse certain URLs. Specifically we found this to happen for Google text ad links which are supposed to redirect to the advertisement. Instead of the browser being redirected, Safari displays an error (see screenshot). This error goes away when the content blocking API is not used, and when it is used without certain troublesome rules.
Steps to Reproduce:
1. Create a new empty Safari Extension.
2. Create a file called rules.json containing the following:
"trigger": {
View gist:7346ba6995704054651ebf9faf069c33
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
View webmate-keypresses.js
// Some keypresses are hard to send to VMs running in 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
// - 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");
View safari-26322821.txt
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:
"trigger": {
"url-filter": "evil-tracker\\.js"
# 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 )
mkdir dwarf-fortress && cd dwarf-fortress
tar xvjf df_42_06_linux.tar.bz2