Created
October 13, 2010 21:02
-
-
Save bussiere/624910 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#tool for meta project | |
# -*- coding: utf-8 -*- | |
import zlib | |
import base64 | |
def encode_img(img) : | |
FILE = open(img,"rb") | |
print "%s compressed :"%img | |
s = base64.encodestring(zlib.compress(FILE.read(),9)) | |
FILE.close() | |
return s | |
def encode_text(text): | |
print "%s compressed :"%text | |
s = base64.encodestring(zlib.compress(text,9)) | |
return s | |
def encode_file(fileh): | |
FILE = open(fileh,"r") | |
print "%s compressed :"%fileh | |
s = base64.encodestring(zlib.compress(FILE.read(),9)) | |
FILE.close() | |
return s | |
def read_img(img): | |
FILE = open("favicon.ico","rb") | |
print "%s readed :"%img | |
s = base64.encodestring(FILE.read()) | |
FILE.close() | |
return s# -*- coding: utf-8 -*- | |
import zlib | |
import base64 | |
def encode_img(img) : | |
FILE = open(img,"rb") | |
print "%s compressed :"%img | |
s = base64.encodestring(zlib.compress(FILE.read(),9)) | |
FILE.close() | |
return s | |
def encode_text(text): | |
print "%s compressed :"%text | |
s = base64.encodestring(zlib.compress(text,9)) | |
return s | |
def encode_file(fileh): | |
FILE = open(fileh,"r") | |
print "%s compressed :"%fileh | |
s = base64.encodestring(zlib.compress(FILE.read(),9)) | |
FILE.close() | |
return s | |
def read_img(img): | |
FILE = open("favicon.ico","rb") | |
print "%s readed :"%img | |
s = base64.encodestring(FILE.read()) | |
FILE.close() | |
return s | |
print encode_text("""<html><body> | |
test | |
<? | |
for i in [0,1]: | |
print i | |
?> | |
</body><html>""") | |
print encode_img("favicon.ico") | |
print encode_file("test.html") | |
print read_img("favicon.ico") | |
print encode_text(""" | |
<html><body> | |
test | |
<? | |
for i in [0,1]: | |
print i | |
?> | |
</body><html>""") | |
print encode_img("favicon.ico") | |
print encode_file("test.html") | |
print read_img("favicon.ico") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment