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 / sitekey-recursive-bug.py
Last active October 7, 2015 12:02
Test case for recursive matching of sitekey exception filters in Adblock Plus
import base64
import M2Crypto
from flask import Flask, request, make_response
app = Flask(__name__)
private_key = """-----BEGIN RSA PRIVATE KEY-----
MIIBOwIBAAJBANGtTstne7e8MbmDHDiMFkGbcuBgXmiVesGOG3gtYeM1EkrzVhBj
GUvKXYE4GLFwqty3v5MuWWbvItUWBTYoVVsCAwEAAQJAMzI/5QZ1fN1kvsk2oNAD
ty0/lW2yX5LwEEakiml6V0Fy7L94It/J6xesrPqn6jWJvfZtQz6+bEE/zAPevNo2
@kzar
kzar / crowdin-reset.py
Created September 16, 2015 16:11
A quick script to clear all files and disable most languages for a Crowdin project. (Code modified from adblockplus/cms)
#!/usr/bin/python
# coding: utf-8
# This file is part of the Adblock Plus web scripts,
# Copyright (C) 2006-2015 Eyeo GmbH
#
# Adblock Plus is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
@kzar
kzar / curry.py
Created August 18, 2015 13:14
Very simple example of how you could curry functions in Python using lambda
def example(a, b, c):
return (a, b, c)
curried1 = lambda b, c: example(1, b, c)
curried2 = lambda *args: example(1, *args)
@kzar
kzar / wat.js
Last active August 29, 2015 14:27
Interesting JavaScript oddities
// http://perfectionkills.com/understanding-delete/
var foo = 1;
bar = 2;
eval("var bob = 3;");
// Object.getOwnPropertyDescriptor(this, "foo").configurable === false
// Object.getOwnPropertyDescriptor(this, "bar").configurable === true
// Object.getOwnPropertyDescriptor(this, "bob").configurable === true
@kzar
kzar / workaround.py
Created August 11, 2015 09:55
line_profiler Python "NameError: name 'profile' is not defined" workaround
import line_profiler
profile = line_profiler.LineProfiler()
@kzar
kzar / transducers.py
Created July 29, 2015 14:58
My progress through the transducers in Python blog post series http://sixty-north.com/blog/series/understanding-transducers-through-python
square = lambda x: x*x
big = lambda x: x > 50
odd = lambda x: x % 2
# Stage 0
tuple(filter(big, map(square, range(10))))
# Stage 1
def my_map(fn, seq):
return reduce(lambda result, x: result + (fn(x),), seq, ())
@kzar
kzar / VBoxSVC.log
Created April 1, 2015 16:56
Virtualbox 4.3.26r98988 crash logs
VirtualBox XPCOM Server 4.3.26 r98988 linux.amd64 (Mar 16 2015 18:26:34) release log
00:00:00.000663 main Log opened 2015-04-01T16:45:16.063556000Z
00:00:00.000665 main Build Type: release
00:00:00.000667 main OS Product: Linux
00:00:00.000668 main OS Release: 3.19.3-031903-generic
00:00:00.000669 main OS Version: #201503261036 SMP Thu Mar 26 14:37:55 UTC 2015
00:00:00.000688 main DMI Product Name: 20BVCTO1WW
00:00:00.000692 main DMI Product Version: ThinkPad T450
00:00:00.000757 main Host RAM: 15748MB total, 13940MB available
00:00:00.000759 main Executable: /usr/lib/virtualbox/VBoxSVC
@kzar
kzar / Instructions.md
Last active December 2, 2021 03:39
My Thinkpad T450 Ubuntu set up

Ubuntu 15.04 (Vivid) has now been released and it fixes mostly all of the issues I had with my Thinkpad T450. I recommend doing a clean install of Ubuntu 15.04 and mostly avoiding all of the steps bellow!

My process for getting Ubuntu running really nicely on a Thinkpad T450 with all the hardware working. (I have my track pad disabled in the bios and only want to use the track point.)

Basic steps to get Ubuntu running nicely on the Thinkpad T450:

@kzar
kzar / gist:e1f25dbcb5488aa15dbd
Created December 3, 2014 19:36
Easylist filters that are not unique when truncated to 200 characters
sort easylist.txt | cut -c -200 | grep -v "!" | uniq -D
abbotsfordgasprices.com,albertagasprices.com,barriegasprices.com,bcgasprices.com,calgarygasprices.com,edmontongasprices.com,gasbuddy.com,halifaxgasprices.com,hamiltongasprices.com,kwgasprices.com,lond
abbotsfordgasprices.com,albertagasprices.com,barriegasprices.com,bcgasprices.com,calgarygasprices.com,edmontongasprices.com,gasbuddy.com,halifaxgasprices.com,hamiltongasprices.com,kwgasprices.com,lond
abbotsfordgasprices.com,albertagasprices.com,barriegasprices.com,bcgasprices.com,calgarygasprices.com,edmontongasprices.com,gasbuddy.com,halifaxgasprices.com,hamiltongasprices.com,kwgasprices.com,lond
app.com,argusleader.com,battlecreekenquirer.com,baxterbulletin.com,bucyrustelegraphforum.com,burlingtonfreepress.com,centralohio.com,chillicothegazette.com,cincinnati.com,citizen-times.com,clarionledg
app.com,argusleader.com,battlecreekenquirer.com,baxterbulletin.com,bucyrustelegraphforum.com,burlingtonfreepress.com,centralohio.com,chillicothegazette.com,cincinna
@kzar
kzar / counter.js
Created October 26, 2014 18:14
JS closure example
var counter = (function () {
var i = 0;
return {
view: function () { return i; },
next: function () { i += 1; }
}
})()