Juliette Published & Destroyed that: Difference between revisions

From Hackers & Designers
(Created page with "=Justin Bieber's Purpose Generator= ==Justin Bieber as a fortune teller==...")
 
Line 64: Line 64:
from subprocess import call
from subprocess import call


''set the variable''''Italic text''
''set the variable''
var1 = raw_input("Enter your name: ")
var1 = raw_input("Enter your name: ")
var2 = raw_input("A verb that defines you: ")
var2 = raw_input("A verb that defines you: ")
Line 72: Line 72:
lines = []
lines = []


'''lyrics file''''''Bold text'''
''lyrics file''
f = open("justinbieber.txt", "r")
f = open("justinbieber.txt", "r")
'''image turned into text'''''Italic text''
''image turned into text''
f2 = open("justin.txt", "r")
f2 = open("justin.txt", "r")


Line 88: Line 88:
         lines.append(line.strip())
         lines.append(line.strip())


'''number of lines between 25 and 42'''''Italic text''
''number of lines between 25 and 42''
for i in range(random.randint(25,42)):
for i in range(random.randint(25,42)):


         l = random.choice(lines)
         l = random.choice(lines)
'''replace function'''''Italic text''
''replace function''
         l = l.replace("your",var1+"'s")
         l = l.replace("your",var1+"'s")
         l = l.replace("you",var1)
         l = l.replace("you",var1)
Line 100: Line 100:
         txt += l +  "\n"
         txt += l +  "\n"


'''print'''''Italic text''
''print''
output = open("output.txt", "w")
output = open("output.txt", "w")
output.write(txt)
output.write(txt)
output.close()
output.close()


'''basic layout for the page'''''Italic text''
''basic layout for the page''
call(["lp", "-d", "HP_LaserJet_8150_Series__0030C1CCDDF2_", "-o", "page-left=72", "-o", "cpi=15","-o", "lpi=9", "-o", "page-bottom=36", "-o", "page-top=28", "-o", "page-right=42", "output.txt"])
call(["lp", "-d", "HP_LaserJet_8150_Series__0030C1CCDDF2_", "-o", "page-left=72", "-o", "cpi=15","-o", "lpi=9", "-o", "page-bottom=36", "-o", "page-top=28", "-o", "page-right=42", "output.txt"])


''save the file in a folder'''''Bold text'''
''save the file in a folder''
output = open("biebs/" + str(int(round(time.time()))) + ".txt", "w")
output = open("biebs/" + str(int(round(time.time()))) + ".txt", "w")
output.write(txt)
output.write(txt)
output.close()
output.close()

Revision as of 20:34, 11 February 2016

Justin Bieber's Purpose Generator

Justin Bieber as a fortune teller

                             .                                                 
                        .:dO0000xlc;,.....col::;,..                          
                     .l0KXKXX0kOOOkdkKX0xddoxkKX0NNX0O:                        
                   :OXNXXXXXK0OOOxdxkOKX0oolc:xXO00X0Okkc.                     
               .;dKNNNNX0OO000OOOOxxxxx0XxdxkOlO0dkXkddol.                     
              :NWWWWWNNXXNNNNNKkOk0KXXXKKOkddxlokxd0Kc,,,:'                    
             oWMWWNNNNWWWWWMMWWNOKXXXKK0OkxlddddOOco0x....                   
           .OWWWNXXXXNNNWMMMWWWNKXKK0Oxxddoooodddkddkx;'.....                  
          ,0NNNNXKKXNNWN0KNNXK0kxOkk00OxdooxkO00000Oklllc.....                 
        .KKNWWWWNNXXXKXKkkkxxdo:,,:lodxO0xoc;:codkO00dllOl'...                 
       .kNNXNNWNXNNNNN0xkOKXOdodo:,,lxkxxdxo:'..:xOkKx;dc...                 
     .cONWNNNNWNKXNWXNX0kKWWNKdokOx:....';:c;;ll:,lddodx,;:,..                 
    ,kxKWWWNWWWWXkKNNKXX0xXWWWKxdd0Kx;.....',....lkxc::,,...                 
   .XNNWWWWWWWMWWKx0NXKOKKkONMWOdOkkXXx:,,;,:l:;;,,ddc,,. ...                
   :WWWWWWWWWWWWWW0x0XXXOkKkdkXW00XK0XNKOxdxx::clddolcxd;..   .                
   oWWWWWWWWWWMWWWNK0KKXWXKKxddx0NNNNXXNNNXX0Kkddooodocc'.                     
   .KWWWWWWWWWWWMWWXXX00XWWNXkk0kONWWNNNWNNNXKKOxol;;;'......                  
     l0XNNWWWWWWWWWWNNWK0XNWWNKKNKKNWNNXNNXKKOolc;,.... .....                
        ONNWWWWWWWWWWWWWNKNNWWNNNNKKKKK00Oxdc;'.....'..........                
        cKNNNNWWWWWWWWWWWWWWNNNXK0Okkxdoc;,'......,'...',';l.                
         ,KNXNNNNWWWWWWNNNNXXK0Okxolc;,'...........',,,,;,,:lkl                
          .KXXNNNNNNNNXXXKKK0Okxolc:;,................',:::cld;.,'             
           ,0XNNNNNNXXKKK000Okxdool:;;,.............'c:::'..,00.            
            ;XNNNNXXKKK0OOOOkxddolc:,...............':::'.';:kK'            
             0NNNNNXXK000OOOkkkkxxdoc;;:;,'.............::;'ckOkxK.            
             xWMMMMWWNXK0OOOkkkk0KXNNXXXXK0Okxoc,.......,:c'lOKKk0             
             :XKKXXXXXXXK0OOOkOO0KKK00000Okxdl:;,.......'cl,:dok0,             
             .00KNWWWWNXK0OOOkkxxxxkOKXXNNXKK0xl;'.......:o:oclk'              
              kXNWNXNWWWWWNK0koccldOXN0k00Ox:c:;,'.......:::llo,               
              ;XNNXNNNWWWWWWXO:...';dOOOxdoc;'..........';:cll;                
               0NNXXKXXNWWWWNk;......;ldddl:;'..........,:.';                  
               ;XNNNNNNWWNNNNx:........',;;,,'.........',c                     
                dXNNNNNNNNNNXx;......'',,,........',;c                     
                 kXXNNNNNXXNXd,.....'::;,,,,,'.......,:c                     
                 .OKXXXXXXNNKd,......clc:;;,....;l,                     
                  .OKKXXXXKX0d;......,ccc:;,'......,;c;                      
                   ,0KXXXNXK0kdlodl'.',;::,,'......',;::                       
                    ,0KXXNNNNK00kc'....,,'......',;::                        
                     ;0KKXXNN0dxd;.........;:c;                         
                      ;O00KXXXKOkxddoc:cl:;,',;cl'                          
                       .x0XNNWWNNX0Oxoccc:;,,,,;:l:                            
                         lO00KK00Okdolc::::::;:c:.                             
                          ;O000KKK0Okxdoccc::::.                               
                           .k0KK0Oxolc:;;,;;:.                                 
                             lOOOkkxolcc:c;.                                   
                              .:coooooc;.    

With only answering 3 simple questions you can generate your own Justin Bieber life purpose.

Juliette collected the lyrics of the songs from Justin's last album Purpose. The algorythm picks randomly lines from those songs and generates a new combination. Three recurrent words have been selected and are replaced by the answers of the questions. The text is automatically printed.


The Bieber algorythm

import sys

import random from subprocess import call

set the variable var1 = raw_input("Enter your name: ") var2 = raw_input("A verb that defines you: ") var3 = raw_input("One word that inspires you: ")

txt = lines = []

lyrics file f = open("justinbieber.txt", "r") image turned into text f2 = open("justin.txt", "r")

justin = f2.read() txt += justin

txt += "\n" txt += "JUSTIN BIEBER'S PURPOSE GENERATOR\n" txt += "\n" txt += "\n"

for line in f.readlines():

       lines.append(line.strip())

number of lines between 25 and 42 for i in range(random.randint(25,42)):

       l = random.choice(lines)

replace function

       l = l.replace("your",var1+"'s")
       l = l.replace("you",var1)
       l = l.replace("make",var2)
       l = l.replace("I ",var3+" ")
       l = l.replace("I'",var3+"'")
       txt += l +  "\n"

print output = open("output.txt", "w") output.write(txt) output.close()

basic layout for the page call(["lp", "-d", "HP_LaserJet_8150_Series__0030C1CCDDF2_", "-o", "page-left=72", "-o", "cpi=15","-o", "lpi=9", "-o", "page-bottom=36", "-o", "page-top=28", "-o", "page-right=42", "output.txt"])

save the file in a folder output = open("biebs/" + str(int(round(time.time()))) + ".txt", "w") output.write(txt) output.close()