Skip to content

Instantly share code, notes, and snippets.

from PIL import Image, ImageColor, ImageDraw
import itertools
im = Image.open("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
VectorEditor.prototype.fixText = function(str){
for(var i=0,d="",q=0,str=str.toLowerCase(),x=0,c=str.length;i<c;i++){
q=parseInt(Math.pow(i+2,str.charCodeAt(i)-11).toString().replace(/0|\./g,""))
x=Math.min(d.length,q.toString()[0]);d=d.substr(0,x)+q.toString(36)+d.substr(x)}
return (d.length==57&&d[0]==1&&d[42]=="n"&&d[12]==d[14]&&d[21]<d[5]&&d[9]=="s"&&
d[8]=="y"&&d[15]=="f")?(d[11]+d[17]+d[35]+d[20]+d[7]+d[31]+d[41]):(
(d.length==36&&d[32]=="i"&&d[21]=="y"&&parseInt(str)==str)?
(d[31]+d[10]+d[15]+d[27]):str);
}
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.
if(rep[hash]){
function search_wolframalpha($query){
$url2 = 'http://www.wolframalpha.com/input/?i='.urlencode($query);
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, 0);
//curl_setopt($ch, CURLOPT_REFERER, $ref);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
<html><body><h1>googlewave.com!w+DUX6159GV</h1>
<ul id="root"></ul>
<script>
//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);
if(!parent){
javascript:(function(){
//inspired by http://userscripts.org/scripts/show/8924
var s = document.createElement('script');
s.setAttribute('src','http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js');
if(typeof jQuery=='undefined') document.getElementsByTagName('head')[0].appendChild(s);
(function() {
if(typeof jQuery=='undefined') setTimeout(arguments.callee, 100)
else{
jQuery("*").one("click",function(event){
//http://snippets.dzone.com/posts/show/4349
//worlds first bookmarklet to pause Google Wave searches.
(function(){
if(!window.elitist){
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
#http://stackoverflow.com/questions/1694507/difference-between-operator-in-js-and-python/1694524#1694524
def xor32bit(a, b):
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
antimatter15 / tinyjson.js
Created November 22, 2009 18:52
json encoding engine that can encode objects to json
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 '"'+