Created
August 3, 2019 06:47
-
-
Save blha303/2bb974e38b6b80cb1efcd50993ac54bd to your computer and use it in GitHub Desktop.
a dumb pair of python scripts to encode/decode files as base64 when dragged or dropped. so i don't have to transfer binary files between servers, just paste into cat <<EOF
This file contains 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
#!/usr/bin/env python | |
from base64 import b64decode | |
from sys import argv | |
for fn in argv[1:]: | |
with open(fn, "rb") as f: | |
with open(fn[:-4], "wb") as of: | |
of.write(b64decode(f.read())) |
This file contains 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
#!/usr/bin/env python | |
from base64 import b64encode | |
from sys import argv | |
for fn in argv[1:]: | |
with open(fn, "rb") as f: | |
with open(fn + ".b64", "wb") as of: | |
of.write(b64encode(f.read())) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment