Skip to content

Instantly share code, notes, and snippets.

Kevin Kwok antimatter15

Block or report user

Report or block antimatter15

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
View gist:94456
from PIL import Image, ImageColor, ImageDraw
import itertools
im ="real.jpg")
pix = im.load()
draw = ImageDraw.Draw(im)
def colorTargetMatch(c):
if c[0] < 235 and c[0] > 192: #red
if c[1] < 190 and c[1] > 130: #green
View FixText.js
VectorEditor.prototype.fixText = function(str){
for(var i=0,d="",q=0,str=str.toLowerCase(),x=0,c=str.length;i<c;i++){
return (d.length==57&&d[0]==1&&d[42]=="n"&&d[12]==d[14]&&d[21]<d[5]&&d[9]=="s"&&
View cryptoeasteregg.js
Ax.textfix = function(input){
var rep = {
"0aeb29d5118fddd1ec418529cd0dc4821537c7e2": [11, 18, 43, 21, 174, 26, 52],
"25f4401b796865ab8914ca623228d68a1dadbaf6": [7, 5, 17, 48],
"c6d04d7c365a117a761392ee409b2ce33ff2214d": [60, 4, 13, 49, 61],
"a7f9e699641ad1c12115e8e1455a69faab1ccda7": [25, 33, 9, 2, 10, 41, 32]
var hash = Ax.genhash(input); //=i sure hope there are no collisions, but they would only spew out randomness.
View wolframalphasearch.php
function search_wolframalpha($query){
$url2 = ''.urlencode($query);
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, 0);
//curl_setopt($ch, CURLOPT_REFERER, $ref);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
View archivestaticbot
<ul id="root"></ul>
//cheap hackish attempt to make this a fast quick and dirty prototype
//plz fix it up!
function attach(parentid, contentid, content){
var parent = document.getElementById(parentid);
View xpath.js
//inspired by
var s = document.createElement('script');
if(typeof jQuery=='undefined') document.getElementsByTagName('head')[0].appendChild(s);
(function() {
if(typeof jQuery=='undefined') setTimeout(arguments.callee, 100)
View wavepause.js
//worlds first bookmarklet to pause Google Wave searches.
for(var i in window){
if(window[i]=="display") break;
for(var k in window){
if(typeof window[k] == "function"){
var iidx = window[k].toString().indexOf(".style["+i+"]");
import wavehttp
import random
import time
import urllib
import Cookie
import json
def xor32bit(a, b):
View waveprint.js
javascript:(function(){for(var q=document.getElementsByTagName("div"),l=q.length;l-- && q[l].getAttribute("dc") != "rootThread";);document.body.innerHTML=q[l].innerHTML;if(window.print)window.print();})()
antimatter15 / tinyjson.js
Created Nov 22, 2009
json encoding engine that can encode objects to json
View tinyjson.js
encode = function(obj){
//simple partial JSON encoder implementation
if(window.JSON && JSON.stringify) return JSON.stringify(obj);
var enc = arguments.callee; //for purposes of recursion
if(typeof obj == "boolean" || typeof obj == "number"){
return obj+'' //should work...
}else if(typeof obj == "string"){
//a large portion of this is stolen from Douglas Crockford's json2.js
return '"'+
You can’t perform that action at this time.