Skip to content

Instantly share code, notes, and snippets.

import httplib
import pickle
import urllib
import Cookie
conn = httplib.HTTPSConnection("wave.google.com")
#conn.set_debuglevel(8)
statefile = "state.txt"
state = {}
<?php
error_reporting(E_ALL);
/*
Written by Antimatter15. Released to Public Domain.
Changes:
December 3 - Created
December 5 - Fixed bug (undefined bmadd), Switched to raw SHA-1 (allow < 512 bit keys), Fixed Adding, Undefined variable, Uninitialized String
*/
loadjson(
[{"type":"rect","id":"J0GL","fill":"#ff0000","fill-opacity":1,"height":130,"stroke":"#000000","stroke-opacity":0.3,"stroke-width":1,"width":78,"x":266.5,"y":59.5},{"type":"rect","id":"SCJ6","fill":"navy","fill-opacity":1,"height":140,"stroke":"#000000","stroke-opacity":0.3,"stroke-width":3,"width":139,"x":177.5,"y":95.5},{"type":"rect","id":"VDFw","fill":"#ff0000","fill-opacity":1,"height":297.7100688979722,"rotation":309.1226073933569,"stroke":"#000000","stroke-opacity":1,"stroke-width":1,"width":89.82693776343137,"x":528,"y":86.5},{"type":"rect","id":"K3K4","fill":"#ff0000","fill-opacity":1,"height":98,"stroke":"#000000","stroke-opacity":1,"stroke-width":1,"width":179,"x":425.5,"y":370.5},{"type":"path","id":"skb2","fill":"none","fill-opacity":1,"path":"M159.5,406.5L159.5,408.5L159.5,411.5L159.5,414.5L159.5,417.5L159.5,424.5L159.5,431.5L159.5,440.5L159.5,450.5L159.5,458.5L159.5,466.5L162.5,473.5L162.5,477.5L162.5,477.5L163.5,477.5L163.5,476.5L165.5,474.5L166.5,467.5L166.5,466.5L168.5,461.5","stro
//SHA1 in Javascript 862 bytes
SHA1=function(l){function p(b,a){return b<<a|b>>>32-a}l+="€";for(var n=Math,c=[1518500249,1859775393,2400959708,3395469782,1732584193,4023233417,2562383102,271733878,3285377520,4294967295],s=n.ceil(l.length/4)+2,q=n.ceil(s/16),g=[],a=0,h=[],j,d,e,f,m,i,b,k;a<q;a++){g[a]=[];for(k=0;k<16;k++){function o(b,c){return l.charCodeAt(a*64+k*4+b)<<c}g[a][k]=o(0,24)|o(1,16)|o(2,8)|o(3,0)}}i=l.length*8-8;a=q-1;g[a][14]=i/(c[9]+1);g[a][14]=n.floor(g[a][14]);g[a][15]=i&c[9];for(a=0;a<q;a++){for(b=0;b<16;b++)h[b]=g[a][b];for(b=16;b<80;b++)h[b]=p(h[b-3]^h[b-8]^h[b-14]^h[b-16],1);j=c[4];d=c[5];e=c[6];f=c[7];m=c[8];for(b=0;b<80;b++){var r=n.floor(b/20),t=p(j,5)+(r<1?d&e^~d&f:r==2?d&e^d&f^e&f:d^e^f)+m+c[r]+h[b]&c[9];m=f;f=e;e=p(d,30);d=j;j=t}c[4]+=j;c[5]+=d;c[6]+=e;c[7]+=f;c[8]+=m}i="";for(z=4;z<9;z++)for(a=7;a>=0;a--)i+=((c[z]&c[9])>>>a*4&15).toString(16);return i};
//SHA-256 in 940B
function SHA256(b){function h(j,k){return(j>>e)+(k>>e)+((p=(j&o)+(k&o))>>e)<<e|p&o}function f(j,k){return j>>>k|j<<32-k}var g=[],d,c=3,l=[2],p,i,q,a,m=[],n=[];i=b.length*8;for(var e=16,o=65535,r="";c<312;c++){for(d=l.length;d--&&c%l[d]!=0;);d<0&&l.push(c)}b+="\u0080";for(c=0;c<=i;c+=8)n[c>>5]|=(b.charCodeAt(c/8)&255)<<24-c%32;n[(i+64>>9<<4)+15]=i;for(c=8;c--;)m[c]=parseInt(Math.pow(l[c],0.5).toString(e).substr(2,8),e);for(c=0;c<n.length;c+=e){a=m.slice(0);for(b=0;b<64;b++){g[b]=b<e?n[b+c]:h(h(h(f(g[b-2],17)^f(g[b-2],19)^g[b-2]>>>10,g[b-7]),f(g[b-15],7)^f(g[b-15],18)^g[b-15]>>>3),g[b-e]);i=h(h(h(h(a[7],f(a[4],6)^f(a[4],11)^f(a[4],25)),a[4]&a[5]^~a[4]&a[6]),parseInt(Math.pow(l[b],1/3).toString(e).substr(2,8),e)),g[b]);q=(f(a[0],2)^f(a[0],13)^f(a[0],22))+(a[0]&a[1]^a[0]&a[2]^a[1]&a[2]);for(d=8;--d;)a[d]=d==4?h(a[3],i):a[d-1];a[0]=h(i,q)}for(d=8;d--;)m[d]+=a[d]}for(c=0;c<8;c++)for(b=8;b--;)r+=(m[c]>>>b*4&15).toString(e);return r}
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="SVG-edit" height="780" author="SVG-edit Developers">
<Require feature="wave" />
</ModulePrefs>
<Content type="html">
<![CDATA[
<base href="http://svg-edit.googlecode.com/svn-history/r1142/branches/2.4/editor/svg-editor.html">
//this file hacked to be svg-edit only and work with JSONP
/*
* SVG Icon Loader 2.0
*
* jQuery Plugin for loading SVG icons from a single file
*
* Copyright (c) 2009 Alexis Deveria
* http://a.deveria.com
*
* Apache 2 License
window.wave={_state: {},callback: function(){},state: {
get: function(r){return wave._state[r]},
set: function(r,v){wave._state[r]=v},
getKeys: function(){var a=[];for(var i in wave._state)a.push(i);return a},
submitDelta: function(d){for(var i in d)wave.state.set(i,d[i]);wave.callback()}
},viewer: {id: "local@example.com",
getId: function(){return wave.viewer.id}},
getState:function(){return wave.state},
getViewer:function(){return wave.viewer},
isInWaveContainer:function(){return true},
<?php
//php streaming proxy
header('Access-Control: allow <*>'); //xdomain ajax ftw
set_time_limit(24*3600);
$fp = fsockopen("192.168.1.149", 80, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br />\n";
} else {
#Quantify the difference between two images as a number
h1 = ImageChops.difference(im,lastim).histogram()
rms = reduce(operator.add, map(lambda a: math.sqrt(a),h1))/len(h1)