Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import zlib
- import io
- WD = 1280
- HG = 720
- FRMS = 750
- fcomp0 = b'x\x9c\xed\x95\xcb\x16\x830\x08D\x87\xff\xff\xe9\x9e\xaaL.$Zw\xbah{b*\t\xafa\xa0\x92BO\xae'
- fcomp1 = b"'\xbf\x7f\xff\x8f\xafW|\x14\xc6$\xb6\x9al\xdb&\xdfO\xf2\xb9R\xd4\xd8\xd2\xce\xf1\xb2\xceS~Z\x0e=\xa5"
- fcomp2 = b'\xcf\xf4\xdfW\xf3\xaf\x18:\xc8\xc2^F^\xc3\x86\x8e\x98mP\xc3\xda\xc8\x07g\xcck\x11w\xb7-\xf8\xe8\xf9\x97'
- fcomp3 = b'_-\x1f\xeb\x12o\xe6\xdd0\xf0=\x9b\x12\xa4\xac\xdbY\xfe5(\xe7\x928\x0c\xe9\x1c\x7f\x9alyg\xedd\x1e'
- fcomp4 = b")\x08ey\xbe\x81\xfe\x8e?\x0e\xce\xa2f9\x9f4cj\xdc'\xfd\xebY\xb3\xb9\x04\xfe\xf5V`\xaf\xf5-\xfe"
- fcomp5 = b'O\xfdD\xe9\xe5\xd9r\xed\x8b\xa0-\xf0n\x9aQ\xack\xf7_z\xbe\xf9\x87\x8c\xd4j]p\x91?p\xeew\x84'
- fcomp6 = b'wp/\xef\x9a\x93\x96\xf5\x1e\xc9\x000CX\xffr\x86\x18\x80\xfb\xc8\x896\xf6w\xc6\xecX\xda\xfcx\xc3\xfcW'
- fcomp7 = b'\xdb\xbb\x845s\xbf\xdf1\xb8<c\xcf\x00W\xc8\xf0G\xe2z\x0c\xd3\xc42\x8a\xad\\W\xfdW\xb8(\xe0O.'
- fcomp8 = b'\xe1>\xeb\x97\xfc\'\xaf\xa6\x0e;\xe1\xbf"gI\x05\xc9<\x98\xb8]\xfd\xdc\xf5_x\xc7\xde\x05^\xa4?y\xb8'
- fcomp9 = b'\xc4\xbf\xf0|\x8d\x8bk\x19\xd1l ~c\x01\x1d\xf8\xbf\xc5\xa5\x93\xab\xba:\xfc\xa1\xfb\xfd|\x00)\xdc\x07\xae'
- fcomp = fcomp0+fcomp1+fcomp2+fcomp3+fcomp4+fcomp5+fcomp6+fcomp7+fcomp8+fcomp9
- funcomp = list(zlib.decompress(fcomp))
- font = [[(1-x)*255 for x in funcomp for j in range(3)][i*128*3:(i+1)*128*3] for i in range(24)]
- def to4(n):
- return [n&0xFF,(n>>8)&0xFF,(n>>16)&0xFF,(n>>24)&0xFF]
- def add4(f,n):
- f += to4(n)
- def add4s(f,i):
- for n in i:
- add4(f,n)
- def wrt(f,fourcc,tp,fn,*argv):
- f += list(fourcc)+[0]*4
- i = len(f)
- f += list(tp)
- fn(f,*argv)
- size = len(f)-i
- f[i-4:i] = to4(size)
- def strh(f):
- f += list(b'vidsZLIB')
- add4s(f,[0,0,0,1,60,0,FRMS,200000,-1,0,0,HG<<16|WD])
- def strf(f):
- i = len(f)
- add4s(f,[0,WD,HG,0x180001])
- f += list(b'ZLIB')
- add4s(f,[WD*HG*3,0,0,0,0,4,0x300FF02])
- size = len(f)-i
- f[i:i+4] = to4(size)
- def junk(f,n):
- f += [0]*n
- def dstr(a,x,y,c):
- xf = (ord(c)%32)*4
- yf = (ord(c)//32)*6
- for i in range(6):
- ai = ((((HG-1)-(y*2*6+i*2))*WD)+x*2*4)*3
- aj = ((((HG-1)-(y*2*6+i*2))*WD)+(x+1)*2*4)*3
- a[ai:aj] = [z for z in font[yf+i][xf*3:(xf+4)*3] for j in range(2)]
- a[ai-WD*3:aj-WD*3] = [z for z in font[yf+i][xf*3:(xf+4)*3] for j in range(2)]
- def comp(f,a):
- f += list(zlib.compress(bytes(a)))
- def movi(f,s):
- a = [0 for x in range(3*WD*HG)]
- rx = 0
- ry = 0
- cur = 0
- c = " "
- for i in range(FRMS):
- for skip in range(10):
- if cur>=len(s): break
- while True:
- if s[cur]=="\n" and (ry+1)==HG//(6*2):
- rx = 0
- a = [0]*(WD*3*6*2)+a[:-(WD*3*6*2)]
- elif s[cur]=="\n":
- rx = 0
- ry += 1
- elif s[cur]==" ":
- rx += 1
- else:
- break
- cur += 1
- if cur>=len(s): break
- if cur>=len(s): break
- dstr(a,rx,ry,s[cur])
- cur += 1
- rx += 1
- wrt(f,b'00dc',b'',comp,a)
- f += [0]*(len(f)%2)
- s2 = ("f = []\n"
- "wrt(f,b'RIFF',b'AVI ',lambda f: (\n"
- " wrt(f,b'LIST',b'hdrl',lambda f: (\n"
- " wrt(f,b'avih',b'',add4s,[16667,25000,0,0,FRMS,0,1,0x100000,WD,HG,0,0,0,0]),\n"
- " wrt(f,b'LIST',b'strl',lambda f: (\n"
- " wrt(f,b'strh',b'',strh),\n"
- " wrt(f,b'strf',b'',strf),\n"
- " wrt(f,b'JUNK',b'',junk,4120))),\n"
- " wrt(f,b'JUNK',b'',junk,1318))),\n"
- " wrt(f,b'LIST',b'movi',movi,s+chr(34)*3+s+chr(34)*3+chr(10)*2+s2[:-6])))\n"
- "with open('quine_video.avi','wb') as file:\n"
- " file.write(bytes(f))\n"
- "\n"
- "s = r")
- s = r"""import zlib
- import io
- WD = 1280
- HG = 720
- FRMS = 750
- fcomp0 = b'x\x9c\xed\x95\xcb\x16\x830\x08D\x87\xff\xff\xe9\x9e\xaaL.$Zw\xbah{b*\t\xafa\xa0\x92BO\xae'
- fcomp1 = b"'\xbf\x7f\xff\x8f\xafW|\x14\xc6$\xb6\x9al\xdb&\xdfO\xf2\xb9R\xd4\xd8\xd2\xce\xf1\xb2\xceS~Z\x0e=\xa5"
- fcomp2 = b'\xcf\xf4\xdfW\xf3\xaf\x18:\xc8\xc2^F^\xc3\x86\x8e\x98mP\xc3\xda\xc8\x07g\xcck\x11w\xb7-\xf8\xe8\xf9\x97'
- fcomp3 = b'_-\x1f\xeb\x12o\xe6\xdd0\xf0=\x9b\x12\xa4\xac\xdbY\xfe5(\xe7\x928\x0c\xe9\x1c\x7f\x9alyg\xedd\x1e'
- fcomp4 = b")\x08ey\xbe\x81\xfe\x8e?\x0e\xce\xa2f9\x9f4cj\xdc'\xfd\xebY\xb3\xb9\x04\xfe\xf5V`\xaf\xf5-\xfe"
- fcomp5 = b'O\xfdD\xe9\xe5\xd9r\xed\x8b\xa0-\xf0n\x9aQ\xack\xf7_z\xbe\xf9\x87\x8c\xd4j]p\x91?p\xeew\x84'
- fcomp6 = b'wp/\xef\x9a\x93\x96\xf5\x1e\xc9\x000CX\xffr\x86\x18\x80\xfb\xc8\x896\xf6w\xc6\xecX\xda\xfcx\xc3\xfcW'
- fcomp7 = b'\xdb\xbb\x845s\xbf\xdf1\xb8<c\xcf\x00W\xc8\xf0G\xe2z\x0c\xd3\xc42\x8a\xad\\W\xfdW\xb8(\xe0O.'
- fcomp8 = b'\xe1>\xeb\x97\xfc\'\xaf\xa6\x0e;\xe1\xbf"gI\x05\xc9<\x98\xb8]\xfd\xdc\xf5_x\xc7\xde\x05^\xa4?y\xb8'
- fcomp9 = b'\xc4\xbf\xf0|\x8d\x8bk\x19\xd1l ~c\x01\x1d\xf8\xbf\xc5\xa5\x93\xab\xba:\xfc\xa1\xfb\xfd|\x00)\xdc\x07\xae'
- fcomp = fcomp0+fcomp1+fcomp2+fcomp3+fcomp4+fcomp5+fcomp6+fcomp7+fcomp8+fcomp9
- funcomp = list(zlib.decompress(fcomp))
- font = [[(1-x)*255 for x in funcomp for j in range(3)][i*128*3:(i+1)*128*3] for i in range(24)]
- def to4(n):
- return [n&0xFF,(n>>8)&0xFF,(n>>16)&0xFF,(n>>24)&0xFF]
- def add4(f,n):
- f += to4(n)
- def add4s(f,i):
- for n in i:
- add4(f,n)
- def wrt(f,fourcc,tp,fn,*argv):
- f += list(fourcc)+[0]*4
- i = len(f)
- f += list(tp)
- fn(f,*argv)
- size = len(f)-i
- f[i-4:i] = to4(size)
- def strh(f):
- f += list(b'vidsZLIB')
- add4s(f,[0,0,0,1,60,0,FRMS,200000,-1,0,0,HG<<16|WD])
- def strf(f):
- i = len(f)
- add4s(f,[0,WD,HG,0x180001])
- f += list(b'ZLIB')
- add4s(f,[WD*HG*3,0,0,0,0,4,0x300FF02])
- size = len(f)-i
- f[i:i+4] = to4(size)
- def junk(f,n):
- f += [0]*n
- def dstr(a,x,y,c):
- xf = (ord(c)%32)*4
- yf = (ord(c)//32)*6
- for i in range(6):
- ai = ((((HG-1)-(y*2*6+i*2))*WD)+x*2*4)*3
- aj = ((((HG-1)-(y*2*6+i*2))*WD)+(x+1)*2*4)*3
- a[ai:aj] = [z for z in font[yf+i][xf*3:(xf+4)*3] for j in range(2)]
- a[ai-WD*3:aj-WD*3] = [z for z in font[yf+i][xf*3:(xf+4)*3] for j in range(2)]
- def comp(f,a):
- f += list(zlib.compress(bytes(a)))
- def movi(f,s):
- a = [0 for x in range(3*WD*HG)]
- rx = 0
- ry = 0
- cur = 0
- c = " "
- for i in range(FRMS):
- for skip in range(10):
- if cur>=len(s): break
- while True:
- if s[cur]=="\n" and (ry+1)==HG//(6*2):
- rx = 0
- a = [0]*(WD*3*6*2)+a[:-(WD*3*6*2)]
- elif s[cur]=="\n":
- rx = 0
- ry += 1
- elif s[cur]==" ":
- rx += 1
- else:
- break
- cur += 1
- if cur>=len(s): break
- if cur>=len(s): break
- dstr(a,rx,ry,s[cur])
- cur += 1
- rx += 1
- wrt(f,b'00dc',b'',comp,a)
- f += [0]*(len(f)%2)
- s2 = ("f = []\n"
- "wrt(f,b'RIFF',b'AVI ',lambda f: (\n"
- " wrt(f,b'LIST',b'hdrl',lambda f: (\n"
- " wrt(f,b'avih',b'',add4s,[16667,25000,0,0,FRMS,0,1,0x100000,WD,HG,0,0,0,0]),\n"
- " wrt(f,b'LIST',b'strl',lambda f: (\n"
- " wrt(f,b'strh',b'',strh),\n"
- " wrt(f,b'strf',b'',strf),\n"
- " wrt(f,b'JUNK',b'',junk,4120))),\n"
- " wrt(f,b'JUNK',b'',junk,1318))),\n"
- " wrt(f,b'LIST',b'movi',movi,s+chr(34)*3+s+chr(34)*3+chr(10)*2+s2[:-6])))\n"
- "with open('quine_video.avi','wb') as file:\n"
- " file.write(bytes(f))\n"
- "\n"
- "s = r")
- s = r"""
- f = []
- wrt(f,b'RIFF',b'AVI ',lambda f: (
- wrt(f,b'LIST',b'hdrl',lambda f: (
- wrt(f,b'avih',b'',add4s,[16667,25000,0,0,FRMS,0,1,0x100000,WD,HG,0,0,0,0]),
- wrt(f,b'LIST',b'strl',lambda f: (
- wrt(f,b'strh',b'',strh),
- wrt(f,b'strf',b'',strf),
- wrt(f,b'JUNK',b'',junk,4120))),
- wrt(f,b'JUNK',b'',junk,1318))),
- wrt(f,b'LIST',b'movi',movi,s+chr(34)*3+s+chr(34)*3+chr(10)*2+s2[:-6])))
- with open('quine_video.avi','wb') as file:
- file.write(bytes(f))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement