Last active 1564778830

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

S Smith revised this gist 1564814829. Go to revision

2 files changed, 16 insertions

b64dec.py(file created)

@@ -0,0 +1,8 @@
1 + #!/usr/bin/env python
2 + from base64 import b64decode
3 + from sys import argv
4 +
5 + for fn in argv[1:]:
6 + with open(fn, "rb") as f:
7 + with open(fn[:-4], "wb") as of:
8 + of.write(b64decode(f.read()))

b64enc.py(file created)

@@ -0,0 +1,8 @@
1 + #!/usr/bin/env python
2 + from base64 import b64encode
3 + from sys import argv
4 +
5 + for fn in argv[1:]:
6 + with open(fn, "rb") as f:
7 + with open(fn + ".b64", "wb") as of:
8 + of.write(b64encode(f.read()))
Newer Older