Last active
July 22, 2024 19:03
Revisions
-
rochacbruno revised this gist
Apr 23, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -38,7 +38,7 @@ also you can easily obfuscate it and turn in to a **binary** like program Now you can delete myproject.zip and run ./myprogram Sometimes it is better than the hackkish ``if __name__ == "__main__"`` -
rochacbruno revised this gist
Apr 23, 2015 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -40,6 +40,9 @@ Now you can delete myproject.zip and run python myprogram Sometimes it is better than the hackkish ``if __name__ == "__main__"`` as seen on https://www.youtube.com/watch?v=0oTh1CXRaQ0
-
rochacbruno revised this gist
Apr 23, 2015 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -22,10 +22,14 @@ You can also zip the folder python -m zipfile -c myproject.zip myprojectfolder > YES Python can Zip files and folders! and now you can get rid of myprojectfolder source code and run python myproject.zip > YES! Python can execute zipped files (remember the .egg) also you can easily obfuscate it and turn in to a **binary** like program echo '#!/usr/bin/env python' >> myprogram -
rochacbruno revised this gist
Apr 23, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -14,7 +14,7 @@ if you do python myprojectfolder Hello > it can also work in submodules if you have a subfolder just use the dot ``python myprojectfolder.subfolder`` and the ``__main__.py`` inside that folder will be executed Python will execute the code in ``__main__.py`` as this file is an entry point. -
rochacbruno revised this gist
Apr 23, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -14,7 +14,7 @@ if you do python myprojectfolder Hello > it can also work in submodules if you have a subfolder just use the dot ``python myprojectfolder.subfolder`` and the main inside that folder will be executed Python will execute the code in ``__main__.py`` as this file is an entry point. -
rochacbruno revised this gist
Apr 23, 2015 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,6 @@ The use of ``__main__.py`` to create executables myprojectfolder/ |_ __main__.py |_ __init__.py Being ``__main__.py``: -
rochacbruno revised this gist
Apr 23, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -13,7 +13,7 @@ Being ``__main__.py``: if you do python myprojectfolder Hello > it can also work in submodules if you have a subfolder just use the dot ``python myprojectfolder.subfolder and the main inside that folder will be executed -
rochacbruno created this gist
Apr 23, 2015 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,42 @@ The use of ``__main__.py`` to create executables myprojectfolder/ |_ __main__.py |_ __init__.py |_ my_program.py Being ``__main__.py``: print("Hello") if you do python myprojectfolder >>> Hello > it can also work in submodules if you have a subfolder just use the dot ``python myprojectfolder.subfolder and the main inside that folder will be executed Python will execute the code in ``__main__.py`` as this file is an entry point. You can also zip the folder python -m zipfile -c myproject.zip myprojectfolder and now you can get rid of myprojectfolder source code and run python myproject.zip also you can easily obfuscate it and turn in to a **binary** like program echo '#!/usr/bin/env python' >> myprogram cat myproject.zip >>myprogram chmod +x myprogram Now you can delete myproject.zip and run python myprogram as seen on https://www.youtube.com/watch?v=0oTh1CXRaQ0